patch-2.3.46 linux/drivers/char/tpqic02.c

Next file: linux/drivers/char/tty_io.c
Previous file: linux/drivers/char/stallion.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.45/linux/drivers/char/tpqic02.c linux/drivers/char/tpqic02.c
@@ -89,7 +89,8 @@
 #include <linux/mm.h>
 #include <linux/malloc.h>
 #include <linux/init.h>
- 
+#include <linux/devfs_fs_kernel.h> 
+
 #include <asm/dma.h>
 #include <asm/system.h>
 #include <asm/io.h>
@@ -2774,23 +2775,6 @@
 };
 
 
-/* Why is this not is one place? */
-/* Pure 2^n version of get_order */
-static inline int __get_order(unsigned long size)
-{
-    int order;
-
-    size = (size-1) >> (PAGE_SHIFT-1);
-    order = -1;
-    do
-    {
-	size >>= 1;
-	order++;
-    } while (size);
-    return order;
-}
-
-
 static void qic02_release_resources(void)
 {
     free_irq(QIC02_TAPE_IRQ, NULL);
@@ -2798,7 +2782,7 @@
     release_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
     if (buffaddr)
     {
-	free_pages(buffaddr, __get_order(TPQBUF_SIZE));
+	free_pages(buffaddr, get_order(TPQBUF_SIZE));
     }
     buffaddr = 0; /* Better to cause a panic than overwite someone else */
     status_zombie = YES;
@@ -2850,7 +2834,7 @@
     /* Setup the page-address for the dma transfer. */
 
     /*** TODO: does _get_dma_pages() really return the physical address?? ****/
-    buffaddr = __get_dma_pages(GFP_KERNEL,__get_order(TPQBUF_SIZE));
+    buffaddr = __get_dma_pages(GFP_KERNEL,get_order(TPQBUF_SIZE));
     
     if (!buffaddr)
     {
@@ -2919,7 +2903,7 @@
 #endif
     printk(TPQIC02_NAME ": DMA buffers: %u blocks\n", NR_BLK_BUF);
     /* If we got this far, install driver functions */
-    if (register_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME, &qic02_tape_fops))
+    if (devfs_register_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME, &qic02_tape_fops))
     {
 	printk(TPQIC02_NAME ": Unable to get chrdev major %d\n", QIC02_TAPE_MAJOR);
 #ifndef CONFIG_QIC02_DYNCONF
@@ -2927,7 +2911,38 @@
 #endif
 	return -ENODEV;
     }
-
+    devfs_register (NULL, "ntpqic11", 0, DEVFS_FL_NONE,
+		    QIC02_TAPE_MAJOR, 2,
+		    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, 0, 0,
+		    &qic02_tape_fops, NULL);
+    devfs_register (NULL, "tpqic11", 0, DEVFS_FL_NONE,
+		    QIC02_TAPE_MAJOR, 3,
+		    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, 0, 0,
+		    &qic02_tape_fops, NULL);
+    devfs_register (NULL, "ntpqic24", 0, DEVFS_FL_NONE,
+		    QIC02_TAPE_MAJOR, 4,
+		    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, 0, 0,
+		    &qic02_tape_fops, NULL);
+    devfs_register (NULL, "tpqic24", 0, DEVFS_FL_NONE,
+		    QIC02_TAPE_MAJOR, 5,
+		    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, 0, 0,
+		    &qic02_tape_fops, NULL);
+    devfs_register (NULL, "ntpqic120", 0, DEVFS_FL_NONE,
+		    QIC02_TAPE_MAJOR, 6,
+		    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, 0, 0,
+		    &qic02_tape_fops, NULL);
+    devfs_register (NULL, "tpqic120", 0, DEVFS_FL_NONE,
+		    QIC02_TAPE_MAJOR, 7,
+		    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, 0, 0,
+		    &qic02_tape_fops, NULL);
+    devfs_register (NULL, "ntpqic150", 0, DEVFS_FL_NONE,
+		    QIC02_TAPE_MAJOR, 8,
+		    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, 0, 0,
+		    &qic02_tape_fops, NULL);
+    devfs_register (NULL, "tpqic150", 0, DEVFS_FL_NONE,
+		    QIC02_TAPE_MAJOR, 9,
+		    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, 0, 0,
+		    &qic02_tape_fops, NULL);
     init_waitqueue_head(&qic02_tape_transfer);
     /* prepare timer */
     TIMEROFF;
@@ -2974,7 +2989,15 @@
     {
 	qic02_release_resources();
     }
-    unregister_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME);
+    devfs_unregister_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME);
+    devfs_unregister(devfs_find_handle(NULL, "ntpqic11", 0, QIC02_TAPE_MAJOR, 2, DEVFS_SPECIAL_CHR, 0));
+    devfs_unregister(devfs_find_handle(NULL, "tpqic11", 0, QIC02_TAPE_MAJOR, 3, DEVFS_SPECIAL_CHR, 0));
+    devfs_unregister(devfs_find_handle(NULL, "ntpqic24", 0, QIC02_TAPE_MAJOR, 4, DEVFS_SPECIAL_CHR, 0));
+    devfs_unregister(devfs_find_handle(NULL, "tpqic24", 0, QIC02_TAPE_MAJOR, 5, DEVFS_SPECIAL_CHR, 0));
+    devfs_unregister(devfs_find_handle(NULL, "ntpqic120", 0, QIC02_TAPE_MAJOR, 6, DEVFS_SPECIAL_CHR, 0));
+    devfs_unregister(devfs_find_handle(NULL, "tpqic120", 0, QIC02_TAPE_MAJOR, 7, DEVFS_SPECIAL_CHR, 0));
+    devfs_unregister(devfs_find_handle(NULL, "ntpqic150", 0, QIC02_TAPE_MAJOR, 8, DEVFS_SPECIAL_CHR, 0));
+    devfs_unregister(devfs_find_handle(NULL, "tpqic150", 0, QIC02_TAPE_MAJOR, 9, DEVFS_SPECIAL_CHR, 0));
 }
 
 int init_module(void)

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