]> err.no Git - linux-2.6/commitdiff
[Cardman 40x0] Fix udev device creation
authorHarald Welte <laforge@gnumonks.org>
Wed, 10 May 2006 11:28:52 +0000 (13:28 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 10 May 2006 20:46:02 +0000 (13:46 -0700)
This patch corrects the order of the calls to register_chrdev() and
pcmcia_register_driver().  Now udev correctly creates userspace device
files /dev/cmmN and /dev/cmxN respectively.

Based on an earlier patch by Jan Niehusmann <jan@gondor.com>.

Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/pcmcia/cm4000_cs.c
drivers/char/pcmcia/cm4040_cs.c

index 02114a0bd0d9d4aadc5a7df96fb93801c6acbfbc..128b2632512d07f693d5925ce97791943cf9e3dd 100644 (file)
@@ -1981,10 +1981,6 @@ static int __init cmm_init(void)
        if (!cmm_class)
                return -1;
 
-       rc = pcmcia_register_driver(&cm4000_driver);
-       if (rc < 0)
-               return rc;
-
        major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
        if (major < 0) {
                printk(KERN_WARNING MODULE_NAME
@@ -1992,6 +1988,12 @@ static int __init cmm_init(void)
                return -1;
        }
 
+       rc = pcmcia_register_driver(&cm4000_driver);
+       if (rc < 0) {
+               unregister_chrdev(major, DEVICE_NAME);
+               return rc;
+       }
+
        return 0;
 }
 
index 29efa64580a89bf11d8d88050ac471575884cc9e..47a8465bf95beed694105640b1847f5589b8e2a3 100644 (file)
@@ -724,16 +724,19 @@ static int __init cm4040_init(void)
        if (!cmx_class)
                return -1;
 
-       rc = pcmcia_register_driver(&reader_driver);
-       if (rc < 0)
-               return rc;
-
        major = register_chrdev(0, DEVICE_NAME, &reader_fops);
        if (major < 0) {
                printk(KERN_WARNING MODULE_NAME
                        ": could not get major number\n");
                return -1;
        }
+
+       rc = pcmcia_register_driver(&reader_driver);
+       if (rc < 0) {
+               unregister_chrdev(major, DEVICE_NAME);
+               return rc;
+       }
+
        return 0;
 }