Re: [PATCH v2 04/16] PCI: Simplify resource setup code in setup_device()

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

 



Hi Andrey.

> ---
>  drivers/pci/pci.c | 99 ++++++++++++++++++++---------------------------
>  1 file changed, 42 insertions(+), 57 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index b8089207a4..666b457257 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -169,8 +169,11 @@ static void setup_device(struct pci_dev *dev, int max_bar)
>  			      cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
>  
>  	for (bar = 0; bar < max_bar; bar++) {
> -		resource_size_t last_addr;
> +		resource_size_t *last;
>  		u32 orig, mask, size;
> +		unsigned long flags;
> +		const char *kind;
> +		int r;
A more descriptine name than "r" would maybe improve readability.

> @@ -183,67 +186,49 @@ static void setup_device(struct pci_dev *dev, int max_bar)
>  		if (mask & PCI_BASE_ADDRESS_SPACE_IO) { /* IO */
> -			last_io = ALIGN(last_io, size);
> -			last_addr = last_io;
>  		} else if ((mask & PCI_BASE_ADDRESS_MEM_PREFETCH) &&
>  		           last_mem_pref) /* prefetchable MEM */ {
> -			last_mem_pref = ALIGN(last_mem_pref, size);
> -			                           IORESOURCE_PREFETCH;
> -			last_addr = last_mem_pref;
>  		} else { /* non-prefetch MEM */
> -			last_mem = ALIGN(last_mem, size);
> -			last_addr = last_mem;
>  		}
>  
> -		dev->resource[bar].end = last_addr + size - 1;
> +		dev->resource[bar].start = *last;
> +		dev->resource[bar].end = dev->resource[bar].start + size - 1;
> +
> +		pr_debug("pbar%d: allocated at %pa\n", bar, last);
> +
> +		*last += size;

I could not see that dev->resource[bar].end was assigned the
same value with the new code.
Maybe I just missed it because I did not follow *last?

I think it is worth to double check it.

	Sam

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux