[PATCH] Implement retry on linux sysfs pnp id file.

Kay Sievers kay.sievers at vrfy.org
Tue Sep 23 11:09:03 PDT 2008


On Tue, 2008-09-23 at 09:12 -0700, Drew Moseley wrote:
> Kay Sievers wrote:
> >> This is a really dirty hack. 
> >>
> >> @Kay: Is this behavior normal? Is there a way to fix sysfs instead of sending 
> >> HAL into a loop?
> > 
> > Yep, "fix the kernel" is usually the right answer. There is almost
> > never a valid "the way it has to be" in sysfs. We fixed almost all know
> > issues so far, so this should be fixed too.
> > 
> > In:
> >   drivers/pnp/core.c
> > we have:
> >         ret = device_register(&dev->dev);
> >         if (ret)
> >                 return ret;
> > 
> >         pnp_interface_attach_device(dev);
> > 
> > Which is broken, the attributes must not be created after the device
> > registration, they should be converted to "default bus attributes" and
> > all will work fine.
> > 
> 
> I certainly don't dispute the fact that this patch is less than ideal.
> I have at lease one more issue that appears to be similar.  I'll take a
> look at the default bus attributes and see what I find.  Thanks for the
> pointer.

I expect pnp can do the same as PCI, and attach the attributes to the
bus_type struct, which will let the driver core create the attributes
before the event, not by the pnp code after the event:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/pci/pci-sysfs.c;h=9c718583a237f4f6082e7dcc5e84e23e85ee651c;hb=HEAD#l211

Kay



More information about the hal mailing list