patch-2.3.46 linux/drivers/block/paride/pg.c

Next file: linux/drivers/block/paride/pt.c
Previous file: linux/drivers/block/paride/pf.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.45/linux/drivers/block/paride/pg.c linux/drivers/block/paride/pg.c
@@ -164,6 +164,7 @@
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
+#include <linux/devfs_fs_kernel.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/malloc.h>
@@ -286,6 +287,8 @@
 	}
 } 
 
+static devfs_handle_t devfs_handle = NULL;
+
 int pg_init (void)      /* preliminary initialisation */
 
 {       int unit;
@@ -296,14 +299,17 @@
 
 	if (pg_detect()) return -1;
 
-	if (register_chrdev(major,name,&pg_fops)) {
+	if (devfs_register_chrdev(major,name,&pg_fops)) {
 		printk("pg_init: unable to get major number %d\n",
 			major);
 		for (unit=0;unit<PG_UNITS;unit++)
 		  if (PG.present) pi_release(PI);
 		return -1;
 	}
-
+	devfs_handle = devfs_mk_dir (NULL, "pg", 2, NULL);
+	devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT,
+			       major, 0, S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
+			       &pg_fops, NULL);
 	return 0;
 }
 
@@ -332,7 +338,8 @@
 
 {       int unit;
 
-	unregister_chrdev(major,name);
+	devfs_unregister (devfs_handle);
+	devfs_unregister_chrdev(major,name);
 
 	for (unit=0;unit<PG_UNITS;unit++)
 	  if (PG.present) pi_release(PI);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)