Re: #2 (Re: More modaliases + patchtool)

Rusty Russell
2010-09-13T03:03:30Z

On Sat, 11 Sep 2010 01:06:19 pm Jeremy Fitzhardinge wrote:
> On 09/11/2010 12:14 PM, Rusty Russell wrote:
> > On Thu, 19 Aug 2010 10:12:36 pm Dzianis Kahanovich wrote:
> >> diff -pruN a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> >> --- a/drivers/block/xen-blkfront.c 2010-08-19 15:20:56.344764984 +0300
> >> +++ b/drivers/block/xen-blkfront.c 2010-08-19 15:23:41.104764997 +0300
> >> @@ -1306,6 +1306,9 @@ static int __init xlblk_init(void)
> >>
> >> return xenbus_register_frontend(&blkfront);
> >> }
> >> +
> >> +MODULE_DEVICE_TABLE(xenbus, blkfront_ids);
> >> +
> >> module_init(xlblk_init);
> > This seems very logical. Jeremy?
>
> Looks OK. What will the effect be? Will it allow better module
> auto-loading or something?

Normally yes. Here's how it's supposed to work:
1) The bus provides a "modalias" field for devices, to say what driver module
to probe for. You already do this.
2) The driver marks the device table so scripts/mod/file2alias.c can find it.
This is what this patch does.
3) scripts/mod/file2alias.c creates the wildcard aliases for the module, based
on the device table. You'd need to do this.

Instead you have manual MODULE_ALIAS lines for your drivers. Your bus
matching is so simple and you have so few device types, that this works.
But the Right Way is to use the infrastructure to generate them as above.

Hope that clarifies!
Rusty.