aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 5701b93b2ddb..3ac7a443f668 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -260,6 +260,41 @@ void cs_error(client_handle_t handle, int func, int ret)
260} 260}
261EXPORT_SYMBOL(cs_error); 261EXPORT_SYMBOL(cs_error);
262 262
263#ifdef CONFIG_PCMCIA_DEBUG
264
265
266static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
267{
268 struct pcmcia_device_id *did = p_drv->id_table;
269 unsigned int i;
270 u32 hash;
271
272 while (did && did->match_flags) {
273 for (i=0; i<4; i++) {
274 if (!did->prod_id[i])
275 continue;
276
277 hash = crc32(0, did->prod_id[i], strlen(did->prod_id[i]));
278 if (hash == did->prod_id_hash[i])
279 continue;
280
281 printk(KERN_DEBUG "pcmcia: %s: invalid hash for "
282 "product string \"%s\": is 0x%x, should "
283 "be 0x%x\n", p_drv->drv.name, did->prod_id[i],
284 did->prod_id_hash[i], hash);
285 }
286 did++;
287 }
288
289 return;
290}
291
292#else
293static inline void pcmcia_check_driver(struct pcmcia_driver *p_drv) {
294 return;
295}
296#endif
297
263/*======================================================================*/ 298/*======================================================================*/
264 299
265static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info); 300static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info);
@@ -296,6 +331,8 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
296 if (!driver) 331 if (!driver)
297 return -EINVAL; 332 return -EINVAL;
298 333
334 pcmcia_check_driver(driver);
335
299 /* initialize common fields */ 336 /* initialize common fields */
300 driver->drv.bus = &pcmcia_bus_type; 337 driver->drv.bus = &pcmcia_bus_type;
301 driver->drv.owner = driver->owner; 338 driver->drv.owner = driver->owner;