[patch 14/38] pcmcia: id_table for wavelan_cs
Dominik Brodowski
linux at dominikbrodowski.net
Mon Mar 7 18:01:02 EST 2005
Hi,
> > +static struct pcmcia_device_id wavelan_ids[] = {
> > + PCMCIA_DEVICE_PROD_ID1("AT", 0x8564eba9),
>
> This one seems bogus and won't match anything useful.
>
> On the other hand, this one seems missing :
> + PCMCIA_DEVICE_PROD_ID12("AT&T", "WaveLAN/PCMCIA", 0x??????, 0x??????),
Thanks, will fix it up.
> 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 guess they are a hash based on the
> strings. Like this, it seems quite prone to mistyping and other stupid
> cut'n'paste problems,
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);
> and not very author friendly...
This is true, unfortunately, but I did and do not see a better and easier
way.
Dominik
More information about the linux-pcmcia
mailing list