Re: [patch 22/53] PNP: factor pnp_init_resource_table() and pnp_clean_resource_table()

Bjorn Helgaas
2008-04-23T23:08:55Z

On Tuesday 22 April 2008 03:01:58 pm Rene Herman wrote:
> It seems you designed the list to be basically in any order, judging by
> things such as pnp_new_resource which'll happily reuse resources of the
> correct type at any position in the list. Yet, pnp_assign_foo() and friends
> retrieve resources (through pnp_get_resource) by position in the list and
> not by the index. I'm not overly sure of failure scenarios but isn't this
> mixing up position and index in a bad way?

Yes, I think you're right.

My idea is that the list should end up in the same order as the
resource list from the BIOS, e.g., the _CRS and _PRS lists for
ACPI. In the case of ISAPNP, it'll be in the order that we read
things from the hardware registers.

I think I should probably make pnp_new_resource() always allocate
a new resource and get rid of the idea of reusing something already
in the list.

> >> (do note that pnp_assign_foo are the only callers of pnp_check_foo and they
> >> could be either merged together or at least not communicate via "idx" but
> >> simply by passing the res/pnp_res).
> >
> > Yes, I'd like to do that. But I think I'd better wait or I'll never
> > get anything finished :-)
>
> Well, the idea here was that getting rid of one "idx" here so that things
> communicate directly removes at least one possible ordering artifact...

Yup. I ended up doing this after all.

I updated the patches and my ACPI box with the inactive devices now
boots (it failed with the v3 patches). I'll work on the
pnp_new_resource() thing tomorrow, but I'll send you the current
patches now in case you have a chance to try them on your ISA box.

Bjorn