Hi! Please apply this fix to the cm4000/4040 drivers, thanks! [CM4000,CM4040] Add device class bits to enable udev device creation Using this patch, Omnikey CardMan 4000 and 4040 devices automatically get their device nodes created by udev. Signed-off-by: Harald Welte <[email protected]> --- commit 904a871a628c42031c3093c2b90bde526f0f35f0 tree fd05d26498ff86bf857331f270b7db13f4e077c0 parent 5b130c9da429fe28af1e59ce6589890f326cc182 author Harald Welte <[email protected]> Tue, 31 Jan 2006 11:08:33 +0100 committer Harald Welte <[email protected]> Tue, 31 Jan 2006 11:08:33 +0100 drivers/char/pcmcia/cm4000_cs.c | 14 +++++++++++++- drivers/char/pcmcia/cm4040_cs.c | 13 ++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 649677b..d5cc5f3 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -56,7 +56,7 @@ module_param(pc_debug, int, 0600); #else #define DEBUGP(n, rdr, x, args...) #endif -static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte"; +static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; #define T_1SEC (HZ) #define T_10MSEC msecs_to_jiffies(10) @@ -156,6 +156,7 @@ struct cm4000_dev { /*queue*/ 4*sizeof(wait_queue_head_t)) static dev_link_t *dev_table[CM4000_MAX_DEV]; +static struct class *cmm_class; /* This table doesn't use spaces after the comma between fields and thus * violates CodingStyle. However, I don't really think wrapping it around will @@ -1937,6 +1938,9 @@ static int cm4000_attach(struct pcmcia_d link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; cm4000_config(link, i); + class_device_create(cmm_class, NULL, MKDEV(major, i), NULL, + "cmm%d", i); + return 0; } @@ -1962,6 +1966,8 @@ static void cm4000_detach(struct pcmcia_ dev_table[devno] = NULL; kfree(dev); + class_device_destroy(cmm_class, MKDEV(major, devno)); + return; } @@ -1996,6 +2002,11 @@ static struct pcmcia_driver cm4000_drive static int __init cmm_init(void) { printk(KERN_INFO "%s\n", version); + + cmm_class = class_create(THIS_MODULE, "cmm"); + if (!cmm_class) + return -1; + pcmcia_register_driver(&cm4000_driver); major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); if (major < 0) { @@ -2012,6 +2023,7 @@ static void __exit cmm_exit(void) printk(KERN_INFO MODULE_NAME ": unloading\n"); pcmcia_unregister_driver(&cm4000_driver); unregister_chrdev(major, DEVICE_NAME); + class_destroy(cmm_class); }; module_init(cmm_init); diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 46eb371..e907a7c 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -53,7 +53,7 @@ module_param(pc_debug, int, 0600); #endif static char *version = -"OMNIKEY CardMan 4040 v1.1.0gm4 - All bugs added by Harald Welte"; +"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; #define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ) #define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ) @@ -67,6 +67,7 @@ static char *version = static void reader_release(dev_link_t *link); static int major; +static struct class *cmx_class; #define BS_READABLE 0x01 #define BS_WRITABLE 0x02 @@ -696,6 +697,9 @@ static int reader_attach(struct pcmcia_d link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; reader_config(link, i); + class_device_create(cmx_class, NULL, MKDEV(major, i), NULL, + "cmx%d", i); + return 0; } @@ -721,6 +725,8 @@ static void reader_detach(struct pcmcia_ dev_table[devno] = NULL; kfree(dev); + class_device_destroy(cmx_class, MKDEV(major, devno)); + return; } @@ -756,6 +762,10 @@ static struct pcmcia_driver reader_drive static int __init cm4040_init(void) { printk(KERN_INFO "%s\n", version); + cmx_class = class_create(THIS_MODULE, "cmx"); + if (!cmx_class) + return -1; + pcmcia_register_driver(&reader_driver); major = register_chrdev(0, DEVICE_NAME, &reader_fops); if (major < 0) { @@ -771,6 +781,7 @@ static void __exit cm4040_exit(void) printk(KERN_INFO MODULE_NAME ": unloading\n"); pcmcia_unregister_driver(&reader_driver); unregister_chrdev(major, DEVICE_NAME); + class_destroy(cmx_class); } module_init(cm4040_init); -- - Harald Welte <[email protected]> http://gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)
Attachment:
pgp8wt47ALQHp.pgp
Description: PGP signature
- Follow-Ups:
- Prev by Date: Re: ip_conntrack related slab error (Re: Fw: Re: 2.6.16-rc1-mm3)
- Next by Date: MAURILY LOTTERIES!!!
- Previous by thread: ip_conntrack related slab error (Re: Fw: Re: 2.6.16-rc1-mm3)
- Next by thread: Re: [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation
- Index(es):