[patch 14/38] pcmcia: id_table for wavelan_cs

Jean Tourrilhes jt at hpl.hp.com
Mon Mar 7 18:07:14 EST 2005


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.

> 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.

	Jean



More information about the linux-pcmcia mailing list