From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pg1-f194.google.com ([209.85.215.194]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gYlL7-0003Fn-Nz for barebox@lists.infradead.org; Mon, 17 Dec 2018 05:21:42 +0000 Received: by mail-pg1-f194.google.com with SMTP id v28so5519660pgk.10 for ; Sun, 16 Dec 2018 21:21:03 -0800 (PST) From: Andrey Smirnov Date: Sun, 16 Dec 2018 21:19:24 -0800 Message-Id: <20181217051925.17582-65-andrew.smirnov@gmail.com> In-Reply-To: <20181217051925.17582-1-andrew.smirnov@gmail.com> References: <20181217051925.17582-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v2 64/65] PCI: dwc: Small computation improvement To: barebox@lists.infradead.org Cc: Andrey Smirnov Port of a Linux commit 6995de2168edc6e58a350e7eb76e02dd191b64f4 Replace a division by 2 operation for a right shift rotation of 1 bit. Probably any recent and decent compiler does this kind of substitution in order to improve code performance. Nevertheless it's a coding good practice whenever there is a division / multiplication by multiple of 2 to replace it by the equivalent operation in this case, the shift rotation. Signed-off-by: Gustavo Pimentel Signed-off-by: Lorenzo Pieralisi Acked-by: Jingoo Han Acked-by: Joao Pinto Signed-off-by: Andrey Smirnov --- drivers/pci/pcie-designware-host.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pcie-designware-host.c b/drivers/pci/pcie-designware-host.c index 7af5a6561..6cc4b93a3 100644 --- a/drivers/pci/pcie-designware-host.c +++ b/drivers/pci/pcie-designware-host.c @@ -88,8 +88,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp) cfg_res = dev_get_resource_by_name(dev, IORESOURCE_MEM, "config"); if (cfg_res) { - pp->cfg0_size = resource_size(cfg_res) / 2; - pp->cfg1_size = resource_size(cfg_res) / 2; + pp->cfg0_size = resource_size(cfg_res) >> 1; + pp->cfg1_size = resource_size(cfg_res) >> 1; pp->cfg0_base = cfg_res->start; pp->cfg1_base = cfg_res->start + pp->cfg0_size; @@ -136,8 +136,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp) } if (restype == 0) { of_pci_range_to_resource(&range, np, &pp->cfg); - pp->cfg0_size = resource_size(&pp->cfg) / 2; - pp->cfg1_size = resource_size(&pp->cfg) / 2; + pp->cfg0_size = resource_size(&pp->cfg) >> 1; + pp->cfg1_size = resource_size(&pp->cfg) >> 1; pp->cfg0_base = pp->cfg.start; pp->cfg1_base = pp->cfg.start + pp->cfg0_size; -- 2.19.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox