Dereferencing semaphores and atomic_t's

From: Russell King (rmk@arm.linux.org.uk)
Date: Wed Oct 02 2002 - 05:16:26 EST


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/



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:33 EST