Dereferencing semaphores and atomic_t's

Russell King (rmk@arm.linux.org.uk)
Wed, 2 Oct 2002 11:16:26 +0100


drivers/scsi/scsi_error.c:

SCSI_LOG_ERROR_RECOVERY(3, printk("Wake up parent %d\n",
shost->eh_notify->count.counter));

up(shost->eh_notify);

drivers/scsi/hosts.c:

up(shost->eh_wait);
SCSI_LOG_ERROR_RECOVERY(5, printk("Waking error handler"
"thread (%d)\n",
atomic_read(&shost->eh_wait->count)));

up(shost->eh_wait);
SCSI_LOG_ERROR_RECOVERY(5, printk("Waking error handler"
"thread (%d)\n",
atomic_read(&shost->eh_wait->count)));

Do we really allow this type of layering violation?

(There appear to be some circumstances when obtaining the semaphore count is
useful, but shouldn't we provide an architecture helper function to do that
since a semaphore structure _is_ an architecture-defined opaque structure.)

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

- 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/