Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bb3d7c7ff1cc18b4cb83820327905f7e1f8dc414
Commit:     bb3d7c7ff1cc18b4cb83820327905f7e1f8dc414
Parent:     27a3bbaf4b1e23a3afbae4d9f72b51a36859f74a
Author:     Ralf Baechle <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 7 15:36:56 2007 +0000
Committer:  Ralf Baechle <[EMAIL PROTECTED]>
CommitDate: Sat Feb 10 22:38:43 2007 +0000

    [MIPS] RTLX: Sprinkle device model code into code to make udev happier.
    
    Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]>
---
 arch/mips/kernel/rtlx.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 8610f4a..f29e93c 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -17,6 +17,7 @@
  *
  */
 
+#include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/fs.h>
@@ -34,6 +35,7 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 #include <asm/mipsmtregs.h>
+#include <asm/mips_mt.h>
 #include <asm/cacheflush.h>
 #include <asm/atomic.h>
 #include <asm/cpu.h>
@@ -498,7 +500,8 @@ static char register_chrdev_failed[] __initdata =
 
 static int rtlx_module_init(void)
 {
-       int i;
+       struct device *dev;
+       int i, err;
 
        major = register_chrdev(0, module_name, &rtlx_fops);
        if (major < 0) {
@@ -511,6 +514,13 @@ static int rtlx_module_init(void)
                init_waitqueue_head(&channel_wqs[i].rt_queue);
                init_waitqueue_head(&channel_wqs[i].lx_queue);
                channel_wqs[i].in_open = 0;
+
+               dev = device_create(mt_class, NULL, MKDEV(major, i),
+                                   "%s%d", module_name, i);
+               if (IS_ERR(dev)) {
+                       err = PTR_ERR(dev);
+                       goto out_chrdev;
+               }
        }
 
        /* set up notifiers */
@@ -525,10 +535,21 @@ static int rtlx_module_init(void)
        setup_irq(rtlx_irq_num, &rtlx_irq);
 
        return 0;
+
+out_chrdev:
+       for (i = 0; i < RTLX_CHANNELS; i++)
+               device_destroy(mt_class, MKDEV(major, i));
+
+       return err;
 }
 
 static void __exit rtlx_module_exit(void)
 {
+       int i;
+
+       for (i = 0; i < RTLX_CHANNELS; i++)
+               device_destroy(mt_class, MKDEV(major, i));
+
        unregister_chrdev(major, module_name);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to