Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936325AbcJFXme (ORCPT ); Thu, 6 Oct 2016 19:42:34 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:46014 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756107AbcJFXlL (ORCPT ); Thu, 6 Oct 2016 19:41:11 -0400 To: "James E.J. Bottomley" , "Martin K. Petersen" , Russell King , linux-arm-kernel@lists.infradead.org Cc: Michael Schmitz , Ondrej Zary , , Message-Id: <8f6ca7428ba0c8a35aad7080a1a913b1aaa66725.1475791899.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH v2 10/12] scsi/ncr5380: Expedite register polling Date: Thu, 6 Oct 2016 19:41:07 -0400 (EDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2399 Lines: 68 Avoid the call to NCR5380_poll_politely2() when possible. The call is easily short-circuited on the PIO fast path, using the inline wrapper. This requires that the NCR5380_read macro be made available before any #include "NCR5380.h" so a few declarations have to be moved too. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke --- drivers/scsi/NCR5380.h | 3 +++ drivers/scsi/arm/cumana_1.c | 4 ++++ drivers/scsi/atari_scsi.c | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h index 4682baa..b2c560c 100644 --- a/drivers/scsi/NCR5380.h +++ b/drivers/scsi/NCR5380.h @@ -310,6 +310,9 @@ static inline int NCR5380_poll_politely(struct NCR5380_hostdata *hostdata, unsigned int reg, u8 bit, u8 val, unsigned long wait) { + if ((NCR5380_read(reg) & bit) == val) + return 0; + return NCR5380_poll_politely2(hostdata, reg, bit, val, reg, bit, val, wait); } diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c index ae1d4c6..fb7600d 100644 --- a/drivers/scsi/arm/cumana_1.c +++ b/drivers/scsi/arm/cumana_1.c @@ -29,6 +29,10 @@ #define NCR5380_implementation_fields \ unsigned ctrl +struct NCR5380_hostdata; +static u8 cumanascsi_read(struct NCR5380_hostdata *, unsigned int); +static void cumanascsi_write(struct NCR5380_hostdata *, unsigned int, u8); + #include "../NCR5380.h" #define CTRL 0x16fc diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index aed69ac..f77c311 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c @@ -57,6 +57,9 @@ #define NCR5380_implementation_fields /* none */ +static u8 (*atari_scsi_reg_read)(unsigned int); +static void (*atari_scsi_reg_write)(unsigned int, u8); + #define NCR5380_read(reg) atari_scsi_reg_read(reg) #define NCR5380_write(reg, value) atari_scsi_reg_write(reg, value) @@ -126,9 +129,6 @@ static inline unsigned long SCSI_DMA_GETADR(void) static void atari_scsi_fetch_restbytes(void); -static u8 (*atari_scsi_reg_read)(unsigned int); -static void (*atari_scsi_reg_write)(unsigned int, u8); - static unsigned long atari_dma_residual, atari_dma_startaddr; static short atari_dma_active; /* pointer to the dribble buffer */ -- 2.7.3