Woo hoo, I found some time for kernel hacking :)

This driver was merged from 2.2.x and needs some more cleanups.  Horst
von Brand posted a patch on lkml against this driver, too, but his
cleanups had a bug in it, and weren't as terse with procfs as the
following patch is...

Against 2.4.0-test9-pre7, and tested on my laptop..

        Jeff



Index: drivers/char/toshiba.c
===================================================================
RCS file: /usr/jgarzik/cvslan/linux_2_3/drivers/char/toshiba.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 toshiba.c
--- drivers/char/toshiba.c      2000/09/18 23:13:37     1.1.1.1
+++ drivers/char/toshiba.c      2000/09/26 15:57:42
@@ -72,17 +72,13 @@
 static int tosh_date = 0x0000;
 static int tosh_sci = 0x0000;
 static int tosh_fan = 0;
-static int tosh_start = 0;
-static int tosh_extent = 0;
 
 static int tosh_fn = 0;
 
 MODULE_PARM(tosh_fn, "i");
 
 
-static int tosh_get_info(char *, char **, off_t, int, int);
-static int tosh_open(struct inode *ip, struct file *);
-static int tosh_release(struct inode *, struct file *);
+static int tosh_get_info(char *, char **, off_t, int);
 static int tosh_ioctl(struct inode *, struct file *, unsigned int,
        unsigned long);
 
@@ -90,8 +86,6 @@
 static struct file_operations tosh_fops = {
        owner:          THIS_MODULE,
        ioctl:          tosh_ioctl,
-       open:           tosh_open,
-       release:        tosh_release,
 };
 
 static struct miscdevice tosh_device = {
@@ -100,10 +94,6 @@
        &tosh_fops
 };
 
-static struct proc_dir_entry tosh_proc_entry = {
-       0, 7, "toshiba", S_IFREG|S_IRUGO, 1, 0, 0, 33, NULL, tosh_get_info, NULL
-};
-
 /*
  * Read the Fn key status
  */
@@ -278,22 +268,6 @@
 }
 
 
-static int tosh_open(struct inode *ip, struct file *fp)
-{
-       MOD_INC_USE_COUNT;
-
-       return 0;
-}
-
-
-static int tosh_release(struct inode *ip, struct file *fp)
-{
-       MOD_DEC_USE_COUNT;
-
-       return 0;
-}
-
-
 static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
        unsigned long arg)
 {
@@ -338,7 +312,7 @@
 /*
  * Print the information for /proc/toshiba
  */
-int tosh_get_info(char *buffer, char **start, off_t fpos, int length, int dummy)
+int tosh_get_info(char *buffer, char **start, off_t fpos, int length)
 {
        char *temp;
        int key;
@@ -400,7 +374,7 @@
        unsigned short bx,cx;
        unsigned long address;
 
-       id = (0x100*(int) readb(0xffffe))+((int) readb(0xffffa));
+       id = (0x100*(int) isa_readb(0xffffe))+((int) isa_readb(0xffffa));
        
        /* do we have a SCTTable machine identication number on our hands */
 
@@ -427,11 +401,11 @@
                /* now twiddle with our pointer a bit */
 
                address = 0x000f0000+bx;
-               cx = readw(address);
+               cx = isa_readw(address);
                address = 0x000f0009+bx+cx;
-               cx = readw(address);
+               cx = isa_readw(address);
                address = 0x000f000a+cx;
-               cx = readw(address);
+               cx = isa_readw(address);
 
                /* now construct our machine identification number */
 
@@ -478,15 +452,15 @@
 
        /* get the BIOS version */
 
-       major = readb(0xfe009)-'0';
-       minor = ((readb(0xfe00b)-'0')*10)+(readb(0xfe00c)-'0');
+       major = isa_readb(0xfe009)-'0';
+       minor = ((isa_readb(0xfe00b)-'0')*10)+(isa_readb(0xfe00c)-'0');
        tosh_bios = (major*0x100)+minor;
 
        /* get the BIOS date */
 
-       day = ((readb(0xffff5)-'0')*10)+(readb(0xffff6)-'0');
-       month = ((readb(0xffff8)-'0')*10)+(readb(0xffff9)-'0');
-       year = ((readb(0xffffb)-'0')*10)+(readb(0xffffc)-'0');
+       day = ((isa_readb(0xffff5)-'0')*10)+(isa_readb(0xffff6)-'0');
+       month = ((isa_readb(0xffff8)-'0')*10)+(isa_readb(0xffff9)-'0');
+       year = ((isa_readb(0xffffb)-'0')*10)+(isa_readb(0xffffc)-'0');
        tosh_date = (((year-90) & 0x1f)<<10) | ((month & 0xf)<<6)
                | ((day & 0x1f)<<1);
 
@@ -527,7 +501,7 @@
        misc_register(&tosh_device);
 
        /* register the proc entry */
-       proc_register(&proc_root, &tosh_proc_entry);
+       create_proc_info_entry("toshiba", 0, NULL, tosh_get_info);
        return 0;
 }
 
@@ -540,14 +514,9 @@
 void cleanup_module(void)
 {
        /* remove the proc entry */
-       proc_unregister(&proc_root, tosh_proc_entry.low_ino);
+       remove_proc_entry("toshiba", NULL);
 
        /* unregister the device file */
        misc_deregister(&tosh_device);
-
-       /* release ports */
-       release_region(tosh_start, tosh_extent);
-
-       return;
 }
 #endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to