Re: [PATCH 11/21] PCI: designware: Make use of BIT() in constant definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 02/01/2019 18:28, Andrey Smirnov wrote:
> On Wed, Dec 26, 2018 at 7:19 AM Gustavo Pimentel
> <gustavo.pimentel@xxxxxxxxxxxx> wrote:
>>
>> Hi,
>>
>> On 21/12/2018 07:27, Andrey Smirnov wrote:
>>> Avoid using explicit left shifts and convert various definitions to
>>> use BIT() instead. No functional change intended.
>>>
>>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>
>>> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
>>> Cc: Fabio Estevam <fabio.estevam@xxxxxxx>
>>> Cc: Chris Healy <cphealy@xxxxxxxxx>
>>> Cc: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
>>> Cc: Leonard Crestez <leonard.crestez@xxxxxxx>
>>> Cc: "A.s. Dong" <aisheng.dong@xxxxxxx>
>>> Cc: Richard Zhu <hongxing.zhu@xxxxxxx>
>>> Cc: linux-imx@xxxxxxx
>>> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
>>> Cc: linux-kernel@xxxxxxxxxxxxxxx
>>> Cc: linux-pci@xxxxxxxxxxxxxxx
>>> Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
>>> ---
>>>  drivers/pci/controller/dwc/pcie-designware.c |  2 +-
>>>  drivers/pci/controller/dwc/pcie-designware.h | 18 +++++++++---------
>>>  2 files changed, 10 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
>>> index d123ac290b9e..086e87a40316 100644
>>> --- a/drivers/pci/controller/dwc/pcie-designware.c
>>> +++ b/drivers/pci/controller/dwc/pcie-designware.c
>>> @@ -300,7 +300,7 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, int index,
>>>       }
>>>
>>>       dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, region | index);
>>> -     dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, ~PCIE_ATU_ENABLE);
>>> +     dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, (u32)~PCIE_ATU_ENABLE);
>>
>> This is unrelated with the patch description purpose.
>>
> 
> This is a direct result of converting PCIE_ATU_ENABLE to BIT(31).
> BIT(31) expands to (1UL << 31) so, without that cast I get
> 
> drivers/pci/controller/dwc/pcie-designware.c: In function
> ‘dw_pcie_disable_atu’:
> drivers/pci/controller/dwc/pcie-designware.c:303:40: warning: large
> integer implicitly truncated to unsigned type [-Woverflow]
>   dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, ~PCIE_ATU_ENABLE);
> 
> on AArch64. I am guessing that original definition of (1 << 31) avoids
> this problem by being an "int" instead of "unsigned long".

Ok, understood.

Acked-by: Gustavo Pimentel <gustavo.pimentel@xxxxxxxxxxxx>

> 
> Thanks,
> Andrey Smirnov
> 




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux