patch-2.4.27 linux-2.4.27/arch/cris/drivers/eeprom.c

Next file: linux-2.4.27/arch/i386/defconfig
Previous file: linux-2.4.27/arch/alpha/kernel/sys_takara.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.26/arch/cris/drivers/eeprom.c linux-2.4.27/arch/cris/drivers/eeprom.c
@@ -506,7 +506,7 @@
 static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t *off)
 {
   int read=0;
-  unsigned long p = file->f_pos;
+  unsigned long p = *off;
 
   unsigned char page;
 
@@ -540,7 +540,7 @@
     return -EFAULT;
   }
 
-  if( (p + count) > eeprom.size)
+  if(count > eeprom.size - p)
   {
     /* truncate count */
     count = eeprom.size - p;
@@ -560,7 +560,7 @@
   
   if(read > 0)
   {
-    file->f_pos += read;
+    *off = p + read;
   }
 
   eeprom.busy--;
@@ -605,7 +605,7 @@
   {
     restart = 0;
     written = 0;
-    p = file->f_pos;
+    p = *off;
    
     
     while( (written < count) && (p < eeprom.size))
@@ -733,10 +733,10 @@
 
   eeprom.busy--;
   wake_up_interruptible(&eeprom.wait_q);
-  if (written == 0 && file->f_pos >= eeprom.size){
+  if (written == 0 && p >= eeprom.size){
     return -ENOSPC;
   }
-  file->f_pos += written;
+  *off = p;
   return written;
 }
 

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