Add device class bits to enable udev device creation
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Add device class bits to enable udev device creation
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.
---
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(-)
drivers/char/pcmcia/cm4000_cs.c +13 -1
@@ -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_drivestatic 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);
drivers/char/pcmcia/cm4040_cs.c +12 -1
@@ -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_drivestatic 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);
Signature · 4 lines
- Harald Welte <[email protected]> http://gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)
Quoted 7 lines · Harald Welte
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.
Dominik has made quite widespread changes to these drivers - enough that I'm not confident to fix the rejects, make it compile and hope that it still works.
So can you please sort things out with Dominik? I guess a tested patch against -mm4 would be ideal.
I note that these drivers forget to check for pcmcia_register_driver() failure. That's a fairly good way of getting an oops in rmmod.
Quoted 4 lines · Andrew Morton
Quoted 3 lines · Harald Welte
Please apply this fix to the cm4000/4040 drivers, thanks!
Quoted 8 lines
Quoted 4 lines
[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.
Dominik has made quite widespread changes to these drivers - enough that I'm not confident to fix the rejects, make it compile and hope that it still works.
sorry for that. I honestly don't have the time to track two trees, and I do all my development work against Linus' main tree, therefore my patches are against that tree, too.
Quoted 2 lines
So can you please sort things out with Dominik? I guess a tested patch against -mm4 would be ideal.
The question is: Why wouldn't my patch directly go mainline but rather via -mm? It is a very special-purpose device, the number of users are small, it clearly fixes the bug that no device nodes are created, and the fix came from the original maintainer.
Quoted 2 lines
I note that these drivers forget to check for
pcmcia_register_driver()failure. That's a fairly good way of getting an oops in rmmod.
Thanks, I'll cook up a fix.
Signature · 4 lines
- Harald Welte <[email protected]> http://gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)
Quoted 11 lines · Harald Welte
Quoted 9 lines · Andrew Morton
Quoted 7 lines · Harald Welte
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.
Quoted 7 lines
Quoted 3 lines
Dominik has made quite widespread changes to these drivers - enough that I'm not confident to fix the rejects, make it compile and hope that it still works.
sorry for that. I honestly don't have the time to track two trees, and I do all my development work against Linus' main tree, therefore my patches are against that tree, too.
Dominik maintains the pcmcia development tree, and these are pcmcia drivers...
Quoted 7 lines
Quoted 2 lines
So can you please sort things out with Dominik? I guess a tested patch against -mm4 would be ideal.
The question is: Why wouldn't my patch directly go mainline but rather via -mm? It is a very special-purpose device, the number of users are small, it clearly fixes the bug that no device nodes are created, and the fix came from the original maintainer.
pcmcia patches should preferably go via the pcmcia development tree, and get integrated and reviewed by the maintainer and all that good stuff.
So it wouldn't go via -mm at all - pcmcia only goes into -mm for testing.
The more specific point is that your patch conflicted with Dominik's
current development tree in a big way. That needs to get sorted out.
Thanks for helping me out, Andrew.
Quoted 2 lines
Dominik maintains the pcmcia development tree, and these are pcmcia drivers...
ok, thanks for clarification. I'll locate his tree and prepare patches against that tree.
Signature · 4 lines
- Harald Welte <[email protected]> http://gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 14 lines · Dmitry Torokhov
drivers/char/pcmcia/cm4040_cs.c static struct pcmcia_driver reader_drive · line 769
Quoted 9 lines · Harald Welte
drivers/char/pcmcia/cm4040_cs.c +4
-0@@ -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; +Hi,
Quoted 2 lines
What is "cmx" exactly? Can we have more descriptive name for a class, please?
'cmx' is the prefix of the device names, how the original vendor drivers named their devices. 'cmm' in the cm4000 case is 'card man mobile'. 'cmx' is its successor, cm4040.
I'll rename the classes, thanks for your suggestion.
Signature · 4 lines
- Harald Welte <[email protected]> http://gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)