Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.13 /drivers/char/nwflash.c

Filename:/drivers/char/nwflash.c
Lines Added:5
Lines Deleted:6
Also changed in: (Previous) 2.4.13-pre6  2.4.13-pre5  2.4.13-pre4  2.4.13-pre3  2.4.13-pre2  2.4.12-ac6 
(Following) 2.4.13-ac1  2.4.13-ac2  2.4.13-ac3  2.4.13-ac4  2.4.13-ac5  2.4.13-ac6 

Location
[  2.4.13
  [  drivers
    [  char
       o  nwflash.c

Patch

diff -u --recursive --new-file v2.4.12/linux/drivers/char/nwflash.c linux/drivers/char/nwflash.c
--- v2.4.12/linux/drivers/char/nwflash.c   Sun Sep 23 11:40:57 2001
+++ linux/drivers/char/nwflash.c   Fri Oct 12 13:48:42 2001
@@ -59,6 +59,7 @@
 static int gbWriteBase64Enable;
 static volatile unsigned char *FLASH_BASE;
 static int gbFlashSize = KFLASH_SIZE;
+static DECLARE_MUTEX(nwflash_sem);
 
 extern spinlock_t gpio_lock;
 
@@ -132,7 +133,6 @@
 
 static ssize_t flash_read(struct file *file, char *buf, size_t size, loff_t * ppos)
 {
-   struct inode *inode = file->f_dentry->d_inode;
    unsigned long p = *ppos;
    unsigned int count = size;
    int ret = 0;
@@ -151,7 +151,7 @@
       /*
        * We now lock against reads and writes. --rmk
        */
-      if (down_interruptible(&inode->i_sem))
+      if (down_interruptible(&nwflash_sem))
          return -ERESTARTSYS;
 
       ret = copy_to_user(buf, (void *)(FLASH_BASE + p), count);
@@ -159,14 +159,13 @@
          ret = count;
          *ppos += count;
       }
-      up(&inode->i_sem);
+      up(&nwflash_sem);
    }
    return ret;
 }
 
 static ssize_t flash_write(struct file *file, const char *buf, size_t size, loff_t * ppos)
 {
-   struct inode *inode = file->f_dentry->d_inode;
    unsigned long p = *ppos;
    unsigned int count = size;
    int written;
@@ -198,7 +197,7 @@
    /*
     * We now lock against reads and writes. --rmk
     */
-   if (down_interruptible(&inode->i_sem))
+   if (down_interruptible(&nwflash_sem))
       return -ERESTARTSYS;
 
    written = 0;
@@ -286,7 +285,7 @@
     */
    leds_event(led_release);
 
-   up(&inode->i_sem);
+   up(&nwflash_sem);
 
    return written;
 }


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.