summaryrefslogtreecommitdiff
path: root/drivers/scsi/NCR5380.h
diff options
context:
space:
mode:
authorAhmed S. Darwish <a.darwish@linutronix.de>2020-12-06 08:51:57 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2020-12-07 20:24:09 -0500
commite7734ef14ead1fd78dc28be3de7ab13128b5c315 (patch)
tree5305a67530de32c5783da2528311c909c1c7bb90 /drivers/scsi/NCR5380.h
parent8ca1a40b9f9defe7981ed9558b856a012e51b842 (diff)
scsi: NCR5380: Remove context check
NCR5380_poll_politely2() uses in_interrupt() and irqs_disabled() to check if it is safe to sleep. Such usage in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated, or the context be explicitly conveyed in an argument passed by the caller. Below is a context analysis of NCR5380_poll_politely2() uppermost callers: - NCR5380_maybe_reset_bus(), task, invoked during device probe. -> NCR5380_poll_politely() -> do_abort() - NCR5380_select(), task, but can only sleep in the "release, then re-acquire" regions of the spinlock held by its caller. Sleeping invocations (lock released): -> NCR5380_poll_politely2() Atomic invocations (lock acquired): -> NCR5380_reselect() -> NCR5380_poll_politely() -> do_abort() -> NCR5380_transfer_pio() - NCR5380_intr(), interrupt handler -> NCR5380_dma_complete() -> NCR5380_transfer_pio() -> NCR5380_poll_politely() -> NCR5380_reselect() (see above) - NCR5380_information_transfer(), task, but can only sleep in the "release, then re-acquire" regions of the caller-held spinlock. Sleeping invocations (lock released): - NCR5380_transfer_pio() -> NCR5380_poll_politely() - NCR5380_poll_politely() Atomic invocations (lock acquired): - NCR5380_transfer_dma() -> NCR5380_dma_recv_setup() => generic_NCR5380_precv() -> NCR5380_poll_politely() => macscsi_pread() -> NCR5380_poll_politely() -> NCR5380_dma_send_setup() => generic_NCR5380_psend -> NCR5380_poll_politely2() => macscsi_pwrite() -> NCR5380_poll_politely() -> NCR5380_poll_politely2() -> NCR5380_dma_complete() -> NCR5380_transfer_pio() -> NCR5380_poll_politely() - NCR5380_transfer_pio() -> NCR5380_poll_politely - NCR5380_reselect(), atomic, always called with hostdata spinlock held. Since NCR5380_poll_politely2() already takes a "wait" argument in jiffies, use it to determine if the function can sleep. Modify atomic callers, which passed an unused wait value in terms of HZ, to pass zero. Link: https://lore.kernel.org/r/20201206075157.19067-1-a.darwish@linutronix.de Cc: Michael Schmitz <schmitzmic@gmail.com> Cc: <linux-m68k@lists.linux-m68k.org> Suggested-by: Finn Thain <fthain@telegraphics.com.au> Co-developed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/NCR5380.h')
-rw-r--r--drivers/scsi/NCR5380.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 5935fd6d1a05..8a3b41932288 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -277,7 +277,8 @@ static const char *NCR5380_info(struct Scsi_Host *instance);
static void NCR5380_reselect(struct Scsi_Host *instance);
static bool NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *);
static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
-static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
+static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data,
+ unsigned int can_sleep);
static int NCR5380_poll_politely2(struct NCR5380_hostdata *,
unsigned int, u8, u8,
unsigned int, u8, u8, unsigned long);