[patch 14/38] pcmcia: id_table for wavelan_cs

Dominik Brodowski linux at dominikbrodowski.net
Mon Mar 7 18:09:42 EST 2005


On Mon, Mar 07, 2005 at 03:07:14PM -0800, Jean Tourrilhes wrote:
> On Tue, Mar 08, 2005 at 12:01:02AM +0100, Dominik Brodowski wrote:
> > Hi,
> > 
> > > 	Also, what's up with the magic numbers ?
> > 
> > They're crc32 hashes of the strings. they're needed to export useful values
> > to userspace for driver <-> device matching, as the strings themselves
> > cannot be passed to userspace in an HOTPLUG call.
> > 
> > > Couldn't they be autogenerated by the macro ?
> > 
> > Unfortunately no, unless you can show me how to calculate a crc32 hash using
> > gcc preprocessor magic :)
> 
> 	I'm sure some cpp wizard on LKML will fix that. There are some
> many cpp tricks in the Linux kernel that I believe everything is
> possible.

I'll go shopping^W asking.

> > Therefore, I've added a
> > static void pcmcia_check_driver(struct pcmcia_driver *p_drv) {}
> > function (dependand on CONFIG_PCMCIA_DEBUG) which verifies the hashes are
> > correct upon module initialization. 
> > 
> > +                       printk(KERN_DEBUG "pcmcia: %s: invalid hash for "
> > +                              "product string \"%s\": is 0x%x, should "
> > +                              "be 0x%x\n", p_drv->drv.name,
> > did->prod_id[i],
> > +                              did->prod_id_hash[i], hash);
> 
> 	Actually, great idea. Works for me.

In addition, "pcmcia-modalias" from pcmciautils can be used to determine the
hashes. needs a really recent -mm kernel to work, though :)

Thanks,
	Dominik



More information about the linux-pcmcia mailing list