Re: 53052feb6 (PNP: remove pnp_mem_flags() as an lvalue) breaks myALSA intel8x0 sound card regression

From: Andrew Morton
Date: Mon Jun 02 2008 - 19:50:41 EST


On Mon, 2 Jun 2008 16:42:49 -0600
Bjorn Helgaas <bjorn.helgaas@xxxxxx> wrote:

> PNP: mark resources that conflict with PCI devices "disabled"
>
> Both the PNP/PCI conflict detection quirk and the PNP system
> driver must use the same mechanism to mark resources as disabled.
>
> I think it's best to keep the resource and to keep the type bit
> (IORESOURCE_MEM, etc), so that we match the list from firmware
> as closely as possible.
>
> Fixes this regression from 2.6.25: http://lkml.org/lkml/2008/6/1/82
>
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
> Tested-by: Avuton Olrich <avuton@xxxxxxxxx>
>
> Index: work11/drivers/pnp/quirks.c
> ===================================================================
> --- work11.orig/drivers/pnp/quirks.c 2008-06-02 14:59:03.000000000 -0600
> +++ work11/drivers/pnp/quirks.c 2008-06-02 15:42:35.000000000 -0600
> @@ -286,7 +286,7 @@ static void quirk_system_pci_resources(s
> pci_name(pdev), i,
> (unsigned long long) pci_start,
> (unsigned long long) pci_end);
> - res->flags = 0;
> + res->flags |= IORESOURCE_DISABLED;
> }
> }
> }
> Index: work11/drivers/pnp/system.c
> ===================================================================
> --- work11.orig/drivers/pnp/system.c 2008-06-02 14:58:56.000000000 -0600
> +++ work11/drivers/pnp/system.c 2008-06-02 15:44:36.000000000 -0600
> @@ -81,7 +81,7 @@ static void reserve_resources_of_dev(str
> }
>
> for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
> - if (res->flags & IORESOURCE_UNSET)
> + if (res->flags & IORESOURCE_DISABLED)
> continue;
>
> reserve_range(dev, res->start, res->end, 0);

This broke
pnp-replace-pnp_resource_table-with-dynamically-allocated-resources.patch:

***************
*** 80,91 ****
reserve_range(dev, res->start, res->end, 1);
}

- for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
- if (res->flags & IORESOURCE_UNSET)
- continue;
-
reserve_range(dev, res->start, res->end, 0);
- }
}

static int system_pnp_probe(struct pnp_dev *dev,
--- 78,85 ----
reserve_range(dev, res->start, res->end, 1);
}

+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++)
reserve_range(dev, res->start, res->end, 0);
}

static int system_pnp_probe(struct pnp_dev *dev,

Which I fixed thusly:

static void reserve_resources_of_dev(struct pnp_dev *dev)
{
struct resource *res;
int i;

for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IO, i)); i++) {
if (res->start == 0)
continue; /* disabled */
if (res->start < 0x100)
/*
* Below 0x100 is only standard PC hardware
* (pics, kbd, timer, dma, ...)
* We should not get resource conflicts there,
* and the kernel reserves these anyway
* (see arch/i386/kernel/setup.c).
* So, do nothing
*/
continue;
if (res->end < res->start)
continue; /* invalid */

reserve_range(dev, res->start, res->end, 1);
}

for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++)
reserve_range(dev, res->start, res->end, 0);
}


Is it still correct?

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/