patch-2.3.46 linux/drivers/cdrom/sjcd.c

Next file: linux/drivers/cdrom/sonycd535.c
Previous file: linux/drivers/cdrom/sbpcd.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.45/linux/drivers/cdrom/sjcd.c linux/drivers/cdrom/sjcd.c
@@ -73,6 +73,7 @@
 #include <linux/string.h>
 #include <linux/major.h>
 #include <linux/init.h>
+#include <linux/devfs_fs_kernel.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -938,7 +939,7 @@
  */
 
 #define CURRENT_IS_VALID                                      \
-    ( CURRENT != NULL && MAJOR( CURRENT->rq_dev ) == MAJOR_NR && \
+    ( !QUEUE_EMPTY && MAJOR( CURRENT->rq_dev ) == MAJOR_NR && \
       CURRENT->cmd == READ && CURRENT->sector != -1 )
 
 static void sjcd_transfer( void ){
@@ -1471,7 +1472,7 @@
 	hardsect_size[MAJOR_NR] = &secsize;
 	blksize_size[MAJOR_NR] = &blksize;
 
-  if( register_blkdev( MAJOR_NR, "sjcd", &sjcd_fops ) != 0 ){
+  if( devfs_register_blkdev( MAJOR_NR, "sjcd", &sjcd_fops ) != 0 ){
     printk( "SJCD: Unable to get major %d for Sanyo CD-ROM\n", MAJOR_NR );
     return( -EIO );
   }
@@ -1563,6 +1564,8 @@
   }
 
   printk(KERN_INFO "SJCD: Status: port=0x%x.\n", sjcd_base);
+  devfs_register (NULL, "sjcd", 0, DEVFS_FL_DEFAULT, MAJOR_NR, 0,
+		  S_IFBLK | S_IRUGO | S_IWUGO, 0, 0, &sjcd_fops, NULL);
 
   sjcd_present++;
   return( 0 );
@@ -1571,7 +1574,7 @@
 static int
 sjcd_cleanup(void)
 {
-  if( (unregister_blkdev(MAJOR_NR, "sjcd") == -EINVAL) )
+  if( (devfs_unregister_blkdev(MAJOR_NR, "sjcd") == -EINVAL) )
     printk( "SJCD: cannot unregister device.\n" );
   else
     release_region( sjcd_base, 4 );
@@ -1582,6 +1585,8 @@
 
 void __exit sjcd_exit(void)
 {
+  devfs_unregister(devfs_find_handle(NULL, "sjcd", 0, 0, 0, DEVFS_SPECIAL_BLK,
+				     0));
   if ( sjcd_cleanup() )
     printk( "SJCD: module: cannot be removed.\n" );
   else

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