[parisc-linux-cvs] Fix SCSI_LOG

Matthew Wilcox willy@ldl.fc.hp.com
Thu, 05 Apr 2001 11:01:36 -0600


Some drivers assume they know the contents of a semaphore.  Clearly, this
is untrue.  So I've added a `sem_getcount()' function which returns the
information they need.

Index: drivers/md/md.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/md/md.c,v
retrieving revision 1.4
diff -u -p -r1.4 md.c
--- md.c	2001/02/02 03:36:39	1.4
+++ md.c	2001/04/05 16:29:29
@@ -740,9 +740,9 @@ static void free_mddev (mddev_t *mddev)
 	 * Make sure nobody else is using this mddev
 	 * (careful, we rely on the global kernel lock here)
 	 */
-	while (md_atomic_read(&mddev->resync_sem.count) != 1)
+	while (sem_getcount(&mddev->resync_sem) != 1)
 		schedule();
-	while (md_atomic_read(&mddev->recovery_sem.count) != 1)
+	while (sem_getcount(&mddev->recovery_sem) != 1)
 		schedule();
 
 	del_mddev_mapping(mddev, MKDEV(MD_MAJOR, mdidx(mddev)));
@@ -3166,7 +3166,7 @@ static int md_status_read_proc(char *pag
 		if (mddev->curr_resync) {
 			sz += status_resync (page+sz, mddev);
 		} else {
-			if (md_atomic_read(&mddev->resync_sem.count) != 1)
+			if (sem_getcount(&mddev->resync_sem) != 1)
 				sz += sprintf(page + sz, "	resync=DELAYED");
 		}
 		sz += sprintf(page + sz, "\n");
Index: drivers/scsi/scsi_error.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/scsi/scsi_error.c,v
retrieving revision 1.6
diff -u -p -r1.6 scsi_error.c
--- scsi_error.c	2001/01/25 00:01:45	1.6
+++ scsi_error.c	2001/04/05 16:29:30
@@ -1877,7 +1877,7 @@ void scsi_error_handler(void *data)
 	/*
 	 * Wake up the thread that created us.
 	 */
-	SCSI_LOG_ERROR_RECOVERY(3, printk("Wake up parent %d\n", host->eh_notify->count.counter));
+	SCSI_LOG_ERROR_RECOVERY(3, printk("Wake up parent %d\n", sem_getcount(host->eh_notify)));
 
 	up(host->eh_notify);
 
Index: include/asm-parisc/semaphore.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/semaphore.h,v
retrieving revision 1.8
diff -u -p -r1.8 semaphore.h
--- semaphore.h	2001/03/18 20:43:33	1.8
+++ semaphore.h	2001/04/05 16:29:31
@@ -64,6 +64,11 @@ static inline void init_MUTEX_LOCKED (st
 	sema_init(sem, 0);
 }
 
+static inline int sem_getcount(struct semaphore *sem)
+{
+	return sem->count;
+}
+
 asmlinkage void __down(struct semaphore * sem);
 asmlinkage int  __down_interruptible(struct semaphore * sem);
 asmlinkage void __up(struct semaphore * sem);