lkml.org 
[lkml]   [2019]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH 07/21] PCI: designware: Make use of IS_ALIGNED()
From
Date
On Wed, 2019-01-02 at 09:33 +0000, Gustavo Pimentel wrote:
> 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.
[]
> > diff --git 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)) {

The (uintptr_t) cast could probably be removed as well.

> > @@ -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;

here too

\
 
 \ /
  Last update: 2019-01-04 19:38    [W:0.081 / U:8.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site