patch-2.3.46 linux/drivers/block/acsi_slm.c

Next file: linux/drivers/block/amiflop.c
Previous file: linux/drivers/block/acsi.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.45/linux/drivers/block/acsi_slm.c linux/drivers/block/acsi_slm.c
@@ -65,6 +65,7 @@
 #include <linux/time.h>
 #include <linux/mm.h>
 #include <linux/malloc.h>
+#include <linux/devfs_fs_kernel.h>
 
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -987,23 +988,28 @@
 	return( 1 );
 }
 
+static devfs_handle_t devfs_handle = NULL;
 
 int slm_init( void )
 
 {
-	if (register_chrdev( MAJOR_NR, "slm", &slm_fops )) {
+	if (devfs_register_chrdev( MAJOR_NR, "slm", &slm_fops )) {
 		printk( KERN_ERR "Unable to get major %d for ACSI SLM\n", MAJOR_NR );
 		return -EBUSY;
 	}
 	
 	if (!(SLMBuffer = atari_stram_alloc( SLM_BUFFER_SIZE, NULL, "SLM" ))) {
 		printk( KERN_ERR "Unable to get SLM ST-Ram buffer.\n" );
-		unregister_chrdev( MAJOR_NR, "slm" );
+		devfs_unregister_chrdev( MAJOR_NR, "slm" );
 		return -ENOMEM;
 	}
 	BufferP = SLMBuffer;
 	SLMState = IDLE;
 	
+	devfs_handle = devfs_mk_dir (NULL, "slm", 3, NULL);
+	devfs_register_series (devfs_handle, "%u", MAX_SLM, DEVFS_FL_DEFAULT,
+			       MAJOR_NR, 0, S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
+			       &slm_fops, NULL);
 	return 0;
 }
 
@@ -1026,7 +1032,8 @@
 
 void cleanup_module(void)
 {
-	if (unregister_chrdev( MAJOR_NR, "slm" ) != 0)
+	devfs_unregister (devfs_handle);
+	if (devfs_unregister_chrdev( MAJOR_NR, "slm" ) != 0)
 		printk( KERN_ERR "acsi_slm: cleanup_module failed\n");
 	atari_stram_free( SLMBuffer );
 }

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