PATCH: add new settings locks to ide-proc

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Tue Feb 18 2003 - 13:09:47 EST


diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.61/drivers/ide/ide-proc.c linux-2.5.61-ac2/drivers/ide/ide-proc.c
--- linux-2.5.61/drivers/ide/ide-proc.c 2003-02-10 18:38:42.000000000 +0000
+++ linux-2.5.61-ac2/drivers/ide/ide-proc.c 2003-02-18 18:06:17.000000000 +0000
@@ -434,6 +454,7 @@
         char *out = page;
         int len, rc, mul_factor, div_factor;
 
+ down(&ide_setting_sem);
         out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
         out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n");
         while(setting) {
@@ -453,6 +474,7 @@
                 setting = setting->next;
         }
         len = out - page;
+ up(&ide_setting_sem);
         PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
@@ -521,12 +543,17 @@
                                 --n;
                                 ++p;
                         }
+
+ down(&ide_setting_sem);
                         setting = ide_find_setting_by_name(drive, name);
                         if (!setting)
+ {
+ up(&ide_setting_sem);
                                 goto parse_error;
-
+ }
                         if (for_real)
                                 ide_write_setting(drive, setting, val * setting->div_factor / setting->mul_factor);
+ up(&ide_setting_sem);
                 }
         } while (!for_real++);
         return count;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:22 EST