On Thu, Dec 11, 2014 at 07:48:20PM -0000, Thomas Gleixner wrote:
> setup_res() blindly clear all resource->flags except IO and MEM. So if
> a resource is marked disabled by the acpi code, setup_res() will use
> it nevertheless.
> 
> Preserve the flags and add proper checks to setup_res() and
> __release_pci_root_info(). The latter is simplified while at it.
> 
> Signed-off-by: Thomas Gleixner <t...@linutronix.de>
> ---
>  arch/x86/pci/acpi.c |   35 ++++++++++++++++-------------------
>  1 file changed, 16 insertions(+), 19 deletions(-)
> 
> Index: tip/arch/x86/pci/acpi.c
> ===================================================================
> --- tip.orig/arch/x86/pci/acpi.c
> +++ tip/arch/x86/pci/acpi.c
> @@ -218,6 +218,12 @@ static void teardown_mcfg_map(struct pci
>  }
>  #endif
>  
> +static bool is_valid_resource(struct resource *res)
> +{
> +     return (res->flags & (IORESOURCE_MEM | IORESOURCE_IO)) &&
> +             !(res->flags & IORESOURCE_DISABLED);
> +}
> +
>  static acpi_status count_resource(struct acpi_resource *acpi_res, void *data)
>  {
>       struct pci_root_info *info = data;
> @@ -228,7 +234,7 @@ static acpi_status count_resource(struct
>           !acpi_dev_resource_address_space(acpi_res, &r))
>               return AE_OK;
>  
> -     if ((r.flags & (IORESOURCE_IO | IORESOURCE_MEM)) && resource_size(&r))
> +     if (is_valid_resource(&r))
>               info->res_num++;
>  
>       return AE_OK;

Ok, this makes definitely more sense in getting rid of the
*clearing* of the flags which is intuitively backwards to what it should
do.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to