Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp85110imu; Wed, 2 Jan 2019 02:51:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/XV6k/RIoRZqFLk9M9IMZ34MMmKvIBIZiWoD7cCppT18TCpBt32sFWEV42Bet4aiyHLg/yZ X-Received: by 2002:a62:7e93:: with SMTP id z141mr43304140pfc.239.1546426282007; Wed, 02 Jan 2019 02:51:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546426281; cv=none; d=google.com; s=arc-20160816; b=uAlfHWL0KE/CKzG4vKUjFx+BBe/QUYSJD3TItyu/XmkEDgLuWEw55FsZjPjRICR2xF /8wvFP74hwiGwuPwslQhcrEKZphz+riIkJJUIaHrWRJFH9RX1lsNs/sqwIwTFepA5e/n 6006R0O/26E/hkpd0EoF5y29xlb8xKpaK1rt+ELrr6m+Kl4lQlCsRHVmKYlZv4zGnrOx nxbXuB3Gr7xNsWp7V6SP4BCnYaZWrUVk3tTXbk5HdcRQug+oqv8MZ+vTyeg8cKdt81O6 Pzc5kRTI+nEZntnVlMzoKTgxymoAge016+AxeRoVcLmptU2pIkdOwyJEXd7B8z7nDLzU PiSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Emz6qjJiEvziEwqjDBS9l3HkahgE7laImS3rC+92WeU=; b=EMynoTAam8wUJXhPW7ctHOCCcLNAGiZPJFeTRAOR8LPsRhtInpGufZQacoEGCngLE9 IqnNnJMSPLXanxO+obnkhlrVyM2jzsdQRjQVvl/Gj9v/e/DPI7rRGYYRoO0gIcarpXH2 wQAxe1Dp6NRKPn+Pb0TgWUCpKQ5l1bVfkA5RWZLrkPuXim6qtpOrPZJ0zghWsY4CQKwy yk7WvVh+B2CVZuWv/hiSoMK3nTLxyEOCxyuchJRbaJVtwoOzuTtWC/hTlMk4ZOotyPC4 ILhJWR0ocLcwQ7va+EGtCgdEVP0MfXXq2n5qkBFxn15EsUd4GEXx+cpmYoXh9gcToaGv 9CLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=LCc2Untk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si919580pgh.505.2019.01.02.02.51.06; Wed, 02 Jan 2019 02:51:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=LCc2Untk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728051AbfABJhu (ORCPT + 99 others); Wed, 2 Jan 2019 04:37:50 -0500 Received: from smtprelay2.synopsys.com ([198.182.60.111]:48640 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726499AbfABJht (ORCPT ); Wed, 2 Jan 2019 04:37:49 -0500 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id AD18710C1189; Wed, 2 Jan 2019 01:37:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1546421869; bh=2qNiGqzha50XcWrAprcnnSRTovjLYD7B/givc4nhFQ0=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=LCc2UntkIjecTdVEhB3sxa7jrWCvQr+7aDZDMTQSxLKko0zV/W9nTpjeynJupC2pn tw1GOY18Yph3wPgJyebA68D9LKlsLweNMFZmS+GVjFs2NX4HBvYSlUAWXkMtbWJ8Tv dmdPv6JT+1UJ5cFAfdTDZu8tVexoPh5AoXjPIR8kptke/cc7xEgPZVGR9unUGs6IlH DI+9bW6yr5+LdefO02ymXPCCuSPFwqveOsdqdWc5KLNiRsnMUexNSkwkLioAvjyyHR ttA1X9l779ZyFMr9dlGAizRbWfpu8qtSVj9Ob24P6mXISiyiA6Ejf9tyTt0Uqqf1I+ B3JPuAvjFn4dA== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id 1300637AC; Wed, 2 Jan 2019 01:37:47 -0800 (PST) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 2 Jan 2019 01:37:46 -0800 Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by DE02WEHTCB.internal.synopsys.com (10.225.19.94) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 2 Jan 2019 10:37:44 +0100 Received: from [10.107.25.131] (10.107.25.131) by DE02WEHTCA.internal.synopsys.com (10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 2 Jan 2019 10:37:44 +0100 Subject: Re: [PATCH 07/21] PCI: designware: Make use of IS_ALIGNED() To: Andrey Smirnov , "linux-pci@vger.kernel.org" CC: Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , "linux-imx@nxp.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" References: <20181221072716.29017-1-andrew.smirnov@gmail.com> <20181221072716.29017-8-andrew.smirnov@gmail.com> From: Gustavo Pimentel Message-ID: <9b275993-c511-50d3-e18e-b421010c1bba@synopsys.com> Date: Wed, 2 Jan 2019 09:33:01 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <20181221072716.29017-8-andrew.smirnov@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.107.25.131] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 21/12/2018 07:27, Andrey Smirnov wrote: > Make the intent a bit more clear as well as get rid of explicit > arithmetic by using IS_ALIGNED() to determine if "addr" is aligned to > "size". No functional change intended. > > Cc: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: Fabio Estevam > Cc: Chris Healy > Cc: Lucas Stach > Cc: Leonard Crestez > Cc: "A.s. Dong" > Cc: Richard Zhu > Cc: linux-imx@nxp.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Cc: linux-pci@vger.kernel.org > Signed-off-by: Andrey Smirnov > --- > drivers/pci/controller/dwc/pcie-designware.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index 93ef8c31fb39..67236379c61a 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -22,7 +22,7 @@ > > int dw_pcie_read(void __iomem *addr, int size, u32 *val) > { > - if ((uintptr_t)addr & (size - 1)) { > + if (!IS_ALIGNED((uintptr_t)addr, size)) { > *val = 0; > return PCIBIOS_BAD_REGISTER_NUMBER; > } > @@ -43,7 +43,7 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val) > > int dw_pcie_write(void __iomem *addr, int size, u32 val) > { > - if ((uintptr_t)addr & (size - 1)) > + if (!IS_ALIGNED((uintptr_t)addr, size)) > return PCIBIOS_BAD_REGISTER_NUMBER; > > if (size == 4) > Sounds good. Acked-by: Gustavo Pimentel