patch-2.2.18 linux/drivers/block/hd.c

Next file: linux/drivers/block/ida_ioctl.h
Previous file: linux/drivers/block/genhd.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/drivers/block/hd.c linux/drivers/block/hd.c
@@ -21,6 +21,8 @@
  *  Removed 99% of above. Use Mark's ide driver for those options.
  *  This is now a lightweight ST-506 driver. (Paul Gortmaker)
  *
+ *  17-OCT-2000 rjohnson@analogic.com Added spin-lock for reading
+ *  CMOS chip.
  */
   
 /* Uncomment the following if you want verbose error reports. */
@@ -48,7 +50,7 @@
 
 #define MAJOR_NR HD_MAJOR
 #include <linux/blk.h>
-
+extern spinlock_t rtc_lock;
 static int revalidate_hddisk(kdev_t, int);
 
 #define	HD_DELAY	0
@@ -701,6 +703,7 @@
 static void hd_geninit(struct gendisk *ignored)
 {
 	int drive;
+	unsigned long flags;
 
 #ifdef __i386__
 	if (!NR_HD) {
@@ -743,13 +746,14 @@
 
 		
 	*/
-
+                spin_lock_irqsave(&rtc_lock, flags);
 		if ((cmos_disks = CMOS_READ(0x12)) & 0xf0) {
 			if (cmos_disks & 0x0f)
 				NR_HD = 2;
 			else
 				NR_HD = 1;
 		}
+		spin_unlock_irqrestore(&rtc_lock, flags);
 	}
 #endif /* __i386__ */
 	for (drive=0 ; drive < NR_HD ; drive++) {

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