diff options
Diffstat (limited to 'drivers/char/pcmcia/cm4000_cs.c')
-rw-r--r-- | drivers/char/pcmcia/cm4000_cs.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 649677b5dc36..5fdf18515433 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -13,11 +13,12 @@ | |||
13 | * | 13 | * |
14 | * (C) 2000,2001,2002,2003,2004 Omnikey AG | 14 | * (C) 2000,2001,2002,2003,2004 Omnikey AG |
15 | * | 15 | * |
16 | * (C) 2005 Harald Welte <laforge@gnumonks.org> | 16 | * (C) 2005-2006 Harald Welte <laforge@gnumonks.org> |
17 | * - Adhere to Kernel CodingStyle | 17 | * - Adhere to Kernel CodingStyle |
18 | * - Port to 2.6.13 "new" style PCMCIA | 18 | * - Port to 2.6.13 "new" style PCMCIA |
19 | * - Check for copy_{from,to}_user return values | 19 | * - Check for copy_{from,to}_user return values |
20 | * - Use nonseekable_open() | 20 | * - Use nonseekable_open() |
21 | * - add class interface for udev device creation | ||
21 | * | 22 | * |
22 | * All rights reserved. Licensed under dual BSD/GPL license. | 23 | * All rights reserved. Licensed under dual BSD/GPL license. |
23 | */ | 24 | */ |
@@ -56,7 +57,7 @@ module_param(pc_debug, int, 0600); | |||
56 | #else | 57 | #else |
57 | #define DEBUGP(n, rdr, x, args...) | 58 | #define DEBUGP(n, rdr, x, args...) |
58 | #endif | 59 | #endif |
59 | static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte"; | 60 | static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; |
60 | 61 | ||
61 | #define T_1SEC (HZ) | 62 | #define T_1SEC (HZ) |
62 | #define T_10MSEC msecs_to_jiffies(10) | 63 | #define T_10MSEC msecs_to_jiffies(10) |
@@ -156,6 +157,7 @@ struct cm4000_dev { | |||
156 | /*queue*/ 4*sizeof(wait_queue_head_t)) | 157 | /*queue*/ 4*sizeof(wait_queue_head_t)) |
157 | 158 | ||
158 | static dev_link_t *dev_table[CM4000_MAX_DEV]; | 159 | static dev_link_t *dev_table[CM4000_MAX_DEV]; |
160 | static struct class *cmm_class; | ||
159 | 161 | ||
160 | /* This table doesn't use spaces after the comma between fields and thus | 162 | /* This table doesn't use spaces after the comma between fields and thus |
161 | * violates CodingStyle. However, I don't really think wrapping it around will | 163 | * violates CodingStyle. However, I don't really think wrapping it around will |
@@ -1937,6 +1939,9 @@ static int cm4000_attach(struct pcmcia_device *p_dev) | |||
1937 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1939 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1938 | cm4000_config(link, i); | 1940 | cm4000_config(link, i); |
1939 | 1941 | ||
1942 | class_device_create(cmm_class, NULL, MKDEV(major, i), NULL, | ||
1943 | "cmm%d", i); | ||
1944 | |||
1940 | return 0; | 1945 | return 0; |
1941 | } | 1946 | } |
1942 | 1947 | ||
@@ -1962,6 +1967,8 @@ static void cm4000_detach(struct pcmcia_device *p_dev) | |||
1962 | dev_table[devno] = NULL; | 1967 | dev_table[devno] = NULL; |
1963 | kfree(dev); | 1968 | kfree(dev); |
1964 | 1969 | ||
1970 | class_device_destroy(cmm_class, MKDEV(major, devno)); | ||
1971 | |||
1965 | return; | 1972 | return; |
1966 | } | 1973 | } |
1967 | 1974 | ||
@@ -1995,8 +2002,18 @@ static struct pcmcia_driver cm4000_driver = { | |||
1995 | 2002 | ||
1996 | static int __init cmm_init(void) | 2003 | static int __init cmm_init(void) |
1997 | { | 2004 | { |
2005 | int rc; | ||
2006 | |||
1998 | printk(KERN_INFO "%s\n", version); | 2007 | printk(KERN_INFO "%s\n", version); |
1999 | pcmcia_register_driver(&cm4000_driver); | 2008 | |
2009 | cmm_class = class_create(THIS_MODULE, "cardman_4000"); | ||
2010 | if (!cmm_class) | ||
2011 | return -1; | ||
2012 | |||
2013 | rc = pcmcia_register_driver(&cm4000_driver); | ||
2014 | if (rc < 0) | ||
2015 | return rc; | ||
2016 | |||
2000 | major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); | 2017 | major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); |
2001 | if (major < 0) { | 2018 | if (major < 0) { |
2002 | printk(KERN_WARNING MODULE_NAME | 2019 | printk(KERN_WARNING MODULE_NAME |
@@ -2012,6 +2029,7 @@ static void __exit cmm_exit(void) | |||
2012 | printk(KERN_INFO MODULE_NAME ": unloading\n"); | 2029 | printk(KERN_INFO MODULE_NAME ": unloading\n"); |
2013 | pcmcia_unregister_driver(&cm4000_driver); | 2030 | pcmcia_unregister_driver(&cm4000_driver); |
2014 | unregister_chrdev(major, DEVICE_NAME); | 2031 | unregister_chrdev(major, DEVICE_NAME); |
2032 | class_destroy(cmm_class); | ||
2015 | }; | 2033 | }; |
2016 | 2034 | ||
2017 | module_init(cmm_init); | 2035 | module_init(cmm_init); |