Re: [PATCH 07/14] pci: don't shrink bridge resources

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

 



On Tue, 22 Dec 2009 15:02:27 -0800
Yinghai Lu <yinghai@xxxxxxxxxx> wrote:

> when we are clearing leaf bridge resource and try to get big one, we
> could shrink the bridge if there is no resource under it.
> 
> let check with old resource size and make sure we are trying to get
> big one.
> 
> -v2: keep disable window print out, still could happen on non pci
> hotplug system
> 
> Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
> ---
>  drivers/pci/setup-bus.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 9bb4435..d53b42e 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -387,7 +387,7 @@ static void pbus_size_io(struct pci_bus *bus,
> resource_size_t min_size) {
>  	struct pci_dev *dev;
>  	struct resource *b_res = find_free_bus_resource(bus,
> IORESOURCE_IO);
> -	unsigned long size = 0, size1 = 0;
> +	unsigned long size = 0, size1 = 0, old_size;
>  
>  	if (!b_res)
>   		return;
> @@ -412,12 +412,17 @@ static void pbus_size_io(struct pci_bus *bus,
> resource_size_t min_size) }
>  	if (size < min_size)
>  		size = min_size;
> +	old_size = resource_size(b_res);
> +	if (old_size == 1)
> +		old_size = 0;

Do we even need these == 1 checks?  If old_size really was 1, it means
we had a very small decode range.  Might make more sense to do...

>  /* To be fixed in 2.5: we should have sort of HAVE_ISA
>     flag in the struct pci_bus. */
>  #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
>  	size = (size & 0xff) + ((size & ~0xffUL) << 2);
>  #endif
>  	size = ALIGN(size + size1, 4096);
> +	if (size < old_size)
> +		size = old_size;

if (size && size < old_size)

here instead?  Just a nit because the if (old_size == 1) seemed a bit
magical at first.  Same thing applies later on.

-- 
Jesse Barnes, Intel Open Source Technology Center
--
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