Re: [PATCH 1/2] resource: align functions now return start of resource

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

 



On Fri, Jan 1, 2010 at 8:40 AM, Dominik Brodowski
<linux@xxxxxxxxxxxxxxxxxxxx> wrote:
> As suggested by Linus, align functions should return the start
> of a resource, not void. An update of "res->start" is no longer
> necessary.
>
> Cc: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
> Cc: Yinghai Lu <yhlu.kernel@xxxxxxxxx>
> Cc: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
> Signed-off-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
> ---
>  arch/alpha/kernel/pci.c                 |    4 ++--
>  arch/arm/kernel/bios32.c                |    8 +++++---
>  arch/cris/arch-v32/drivers/pci/bios.c   |   14 ++++++--------
>  arch/frv/mb93090-mb00/pci-frv.c         |   14 ++++++--------
>  arch/ia64/pci/pci.c                     |    3 ++-
>  arch/mips/pci/pci.c                     |    4 ++--
>  arch/mips/pmc-sierra/yosemite/ht.c      |   10 +++++-----
>  arch/mn10300/unit-asb2305/pci-asb2305.c |   16 +++++++---------
>  arch/parisc/kernel/pci.c                |   10 +++++-----
>  arch/powerpc/kernel/pci-common.c        |   13 ++++++-------
>  arch/sh/drivers/pci/pci.c               |    6 +++---
>  arch/sparc/kernel/pci.c                 |    5 +++--
>  arch/sparc/kernel/pcic.c                |    5 +++--
>  arch/x86/pci/i386.c                     |   12 +++++-------
>  arch/xtensa/kernel/pci.c                |   11 +++++------
>  drivers/pci/bus.c                       |    6 ++++--
>  drivers/pcmcia/rsrc_mgr.c               |   12 ++++++------
>  drivers/pcmcia/rsrc_nonstatic.c         |   16 +++++++++-------
>  include/linux/ioport.h                  |    6 ++++--
>  include/linux/pci.h                     |    8 +++++---
>  kernel/resource.c                       |   14 +++++++++-----
>  21 files changed, 102 insertions(+), 95 deletions(-)
>
> diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
> index a91ba28..5cf111e 100644
> --- a/arch/alpha/kernel/pci.c
> +++ b/arch/alpha/kernel/pci.c
> @@ -126,7 +126,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_final);
>  #define MB                     (1024*KB)
>  #define GB                     (1024*MB)
>
> -void
> +resource_size_t
>  pcibios_align_resource(void *data, struct resource *res,
>                       resource_size_t size, resource_size_t align)
>  {
> @@ -184,7 +184,7 @@ pcibios_align_resource(void *data, struct resource *res,
>                }
>        }
>
> -       res->start = start;
> +       return start;
>  }
>  #undef KB
>  #undef MB
> diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
> index 8096819..a7c85f8 100644
> --- a/arch/arm/kernel/bios32.c
> +++ b/arch/arm/kernel/bios32.c
> @@ -616,15 +616,17 @@ char * __init pcibios_setup(char *str)
>  * but we want to try to avoid allocating at 0x2900-0x2bff
>  * which might be mirrored at 0x0100-0x03ff..
>  */
> -void pcibios_align_resource(void *data, struct resource *res,
> -                           resource_size_t size, resource_size_t align)
> +resource_size_t pcibios_align_resource(void *data, struct resource *res,
> +                               resource_size_t size, resource_size_t align)
>  {
>        resource_size_t start = res->start;
>
>        if (res->flags & IORESOURCE_IO && start & 0x300)
>                start = (start + 0x3ff) & ~0x3ff;
>
> -       res->start = (start + align - 1) & ~(align - 1);
> +       start = (start + align - 1) & ~(align - 1);
> +
> +       return start;
>  }
>
>  /**
> diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
> index 77ee319..5811e2f 100644
> --- a/arch/cris/arch-v32/drivers/pci/bios.c
> +++ b/arch/cris/arch-v32/drivers/pci/bios.c
> @@ -41,18 +41,16 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
>        return 0;
>  }
>
> -void
> +resource_size_t
>  pcibios_align_resource(void *data, struct resource *res,
>                       resource_size_t size, resource_size_t align)
>  {
> -       if (res->flags & IORESOURCE_IO) {
> -               resource_size_t start = res->start;
> +       resource_size_t start = res->start;
>
> -               if (start & 0x300) {
> -                       start = (start + 0x3ff) & ~0x3ff;
> -                       res->start = start;
> -               }
> -       }
> +       if ((res->flags & IORESOURCE_IO) && (start & 0x300))
> +               start = (start + 0x3ff) & ~0x3ff;
> +
> +       return start

missed ; here?

YH
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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