]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] paride cleanup
authorAlexander Viro <viro@math.psu.edu>
Wed, 4 Dec 2002 04:38:39 +0000 (20:38 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 4 Dec 2002 04:38:39 +0000 (20:38 -0800)
switched to explicit devfs_register()/devfs_remove(), killed gratitious
devfs_handle_t variables.

drivers/block/paride/pg.c
drivers/block/paride/pt.c

index da1b4954c927f17e642f2a86107a96248d873e98..a2e328d663f0f98f2cf8e53ebaa8fc0c7cc3f786 100644 (file)
@@ -281,8 +281,6 @@ void pg_init_units( void )
        }
 } 
 
-static devfs_handle_t devfs_handle;
-
 #define        WR(c,r,v)       pi_write_regr(PI,c,r,v)
 #define        RR(c,r)         (pi_read_regr(PI,c,r))
 
@@ -644,10 +642,15 @@ static int __init pg_init(void)
                  if (PG.present) pi_release(PI);
                return -1;
        }
-       devfs_handle = devfs_mk_dir (NULL, "pg", NULL);
-       devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,
-                              major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
+       devfs_mk_dir (NULL, "pg", NULL);
+       for (unit=0; unit<PG_UNITS; unit++)
+               if (PG.present) {
+                       char name[16];
+                       sprintf(name, "pg/%u", unit);
+                       devfs_register(NULL, name, DEVFS_FL_DEFAULT,
+                              major, unit, S_IFCHR | S_IRUSR | S_IWUSR,
                               &pg_fops, NULL);
+               }
        return 0;
 }
 
@@ -655,7 +658,11 @@ static void __exit pg_exit(void)
 {
        int unit;
 
-       devfs_unregister (devfs_handle);
+       for (unit=0; unit<PG_UNITS; unit++)
+               if (PG.present)
+                       devfs_remove("pg/%u", unit);
+
+       devfs_remove ("pg");
        unregister_chrdev(major,name);
 
        for (unit=0;unit<PG_UNITS;unit++)
index 6c3a03075a59bf01a9b6b896b8094daa1bddcfa8..fd8cb9299dd1ede300fe27fbde008e6dba8a8737 100644 (file)
@@ -285,8 +285,6 @@ void pt_init_units( void )
         }
 }
 
-static devfs_handle_t devfs_handle;
-
 #define        WR(c,r,v)       pi_write_regr(PI,c,r,v)
 #define        RR(c,r)         (pi_read_regr(PI,c,r))
 
@@ -915,20 +913,31 @@ static int __init pt_init(void)
                return -1;
        }
 
-       devfs_handle = devfs_mk_dir (NULL, "pt", NULL);
-       devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,
-                              major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
+       devfs_mk_dir (NULL, "pt", NULL);
+       for (unit=0;unit<PT_UNITS;unit++)
+               if (PT.present) {
+                       char name[16];
+                       sprintf(name, "pt/%d", unit);
+                       devfs_register(NULL, name, DEVFS_FL_DEFAULT,
+                              major, unit, S_IFCHR | S_IRUSR | S_IWUSR,
                               &pt_fops, NULL);
-       devfs_register_series (devfs_handle, "%un", 4, DEVFS_FL_DEFAULT,
-                              major, 128, S_IFCHR | S_IRUSR | S_IWUSR,
+                       sprintf(name, "pt/%dn", unit);
+                       devfs_register(NULL, name, DEVFS_FL_DEFAULT,
+                              major, 128 + unit, S_IFCHR | S_IRUSR | S_IWUSR,
                               &pt_fops, NULL);
+               }
        return 0;
 }
 
 static void __exit pt_exit(void)
 {
        int unit;
-       devfs_unregister (devfs_handle);
+       for (unit=0;unit<PT_UNITS;unit++)
+               if (PT.present) {
+                       devfs_remove("pt/%d", unit);
+                       devfs_remove("pt/%dn", unit);
+               }
+       devfs_remove("pt");
        unregister_chrdev(major,name);
        for (unit=0;unit<PT_UNITS;unit++)
                if (PT.present)