diff mbox series

[20/35] dc395x: drop internal SCSI message definitions

Message ID 20201207124819.95822-21-hare@suse.de
State New
Headers show
Series SCSI result handling cleanup, part 1 | expand

Commit Message

Hannes Reinecke Dec. 7, 2020, 12:48 p.m. UTC
Drop the internel SCSI message definitions and use the functions
provided by the SPI transport class.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/dc395x.c | 25 ++++++++++---------------
 drivers/scsi/dc395x.h | 22 ----------------------
 2 files changed, 10 insertions(+), 37 deletions(-)

Comments

kernel test robot Dec. 18, 2020, 8:58 a.m. UTC | #1
Hi Hannes,

I love your patch! Yet something to improve:

[auto build test ERROR on s390/features]
[also build test ERROR on hch-configfs/for-next linus/master v5.10 next-20201217]
[cannot apply to mkp-scsi/for-next scsi/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-result-handling-cleanup-part-1/20201207-205241
base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: i386-randconfig-s002-20201217 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://github.com/0day-ci/linux/commit/eb68d2edc0c626f5aff039520daf1b3cb4f4052d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/SCSI-result-handling-cleanup-part-1/20201207-205241
        git checkout eb68d2edc0c626f5aff039520daf1b3cb4f4052d
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   ld: drivers/scsi/dc395x.o: in function `build_sdtr':
>> drivers/scsi/dc395x.c:1285: undefined reference to `spi_populate_sync_msg'

   ld: drivers/scsi/dc395x.o: in function `build_wdtr':
>> drivers/scsi/dc395x.c:1305: undefined reference to `spi_populate_width_msg'



vim +1285 drivers/scsi/dc395x.c

  1265	
  1266	
  1267	/* SDTR */
  1268	static void build_sdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
  1269			struct ScsiReqBlk *srb)
  1270	{
  1271		u8 *ptr = srb->msgout_buf + srb->msg_count;
  1272		if (srb->msg_count > 1) {
  1273			dprintkl(KERN_INFO,
  1274				"build_sdtr: msgout_buf BUSY (%i: %02x %02x)\n",
  1275				srb->msg_count, srb->msgout_buf[0],
  1276				srb->msgout_buf[1]);
  1277			return;
  1278		}
  1279		if (!(dcb->dev_mode & NTC_DO_SYNC_NEGO)) {
  1280			dcb->sync_offset = 0;
  1281			dcb->min_nego_period = 200 >> 2;
  1282		} else if (dcb->sync_offset == 0)
  1283			dcb->sync_offset = SYNC_NEGO_OFFSET;
  1284	
> 1285		spi_populate_sync_msg(ptr, dcb->min_nego_period, dcb->sync_offset);

  1286		srb->msg_count += 5;
  1287		srb->state |= SRB_DO_SYNC_NEGO;
  1288	}
  1289	
  1290	
  1291	/* WDTR */
  1292	static void build_wdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
  1293			struct ScsiReqBlk *srb)
  1294	{
  1295		u8 wide = ((dcb->dev_mode & NTC_DO_WIDE_NEGO) &
  1296			   (acb->config & HCC_WIDE_CARD)) ? 1 : 0;
  1297		u8 *ptr = srb->msgout_buf + srb->msg_count;
  1298		if (srb->msg_count > 1) {
  1299			dprintkl(KERN_INFO,
  1300				"build_wdtr: msgout_buf BUSY (%i: %02x %02x)\n",
  1301				srb->msg_count, srb->msgout_buf[0],
  1302				srb->msgout_buf[1]);
  1303			return;
  1304		}
> 1305		spi_populate_width_msg(ptr, wide);

  1306		srb->msg_count += 4;
  1307		srb->state |= SRB_DO_WIDE_NEGO;
  1308	}
  1309	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 7b522ff345d5..b1125012bee0 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -64,6 +64,7 @@ 
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_transport_spi.h>
 
 #include "dc395x.h"
 
@@ -1281,11 +1282,7 @@  static void build_sdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
 	} else if (dcb->sync_offset == 0)
 		dcb->sync_offset = SYNC_NEGO_OFFSET;
 
-	*ptr++ = MSG_EXTENDED;	/* (01h) */
-	*ptr++ = 3;		/* length */
-	*ptr++ = EXTENDED_SDTR;	/* (01h) */
-	*ptr++ = dcb->min_nego_period;	/* Transfer period (in 4ns) */
-	*ptr++ = dcb->sync_offset;	/* Transfer period (max. REQ/ACK dist) */
+	spi_populate_sync_msg(ptr, dcb->min_nego_period, dcb->sync_offset);
 	srb->msg_count += 5;
 	srb->state |= SRB_DO_SYNC_NEGO;
 }
@@ -1305,10 +1302,7 @@  static void build_wdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
 			srb->msgout_buf[1]);
 		return;
 	}
-	*ptr++ = MSG_EXTENDED;	/* (01h) */
-	*ptr++ = 2;		/* length */
-	*ptr++ = EXTENDED_WDTR;	/* (03h) */
-	*ptr++ = wide;
+	spi_populate_width_msg(ptr, wide);
 	srb->msg_count += 4;
 	srb->state |= SRB_DO_WIDE_NEGO;
 }
@@ -1476,7 +1470,7 @@  static u8 start_scsi(struct AdapterCtlBlk* acb, struct DeviceCtlBlk* dcb,
 			return 1;
 		}
 		/* Send Tag id */
-		DC395x_write8(acb, TRM_S1040_SCSI_FIFO, MSG_SIMPLE_QTAG);
+		DC395x_write8(acb, TRM_S1040_SCSI_FIFO, SIMPLE_QUEUE_TAG);
 		DC395x_write8(acb, TRM_S1040_SCSI_FIFO, tag_number);
 		dcb->tag_mask |= tag_mask;
 		srb->tag_number = tag_number;
@@ -1732,8 +1726,9 @@  static void msgout_phase1(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
 	if (!srb->msg_count) {
 		dprintkdbg(DBG_0, "msgout_phase1: (0x%p) NOP msg\n",
 			srb->cmd);
-		DC395x_write8(acb, TRM_S1040_SCSI_FIFO, MSG_NOP);
-		DC395x_write16(acb, TRM_S1040_SCSI_CONTROL, DO_DATALATCH);	/* it's important for atn stop */
+		DC395x_write8(acb, TRM_S1040_SCSI_FIFO, NOP);
+		DC395x_write16(acb, TRM_S1040_SCSI_CONTROL, DO_DATALATCH);
+		/* it's important for atn stop */
 		DC395x_write8(acb, TRM_S1040_SCSI_COMMAND, SCMD_FIFO_OUT);
 		return;
 	}
@@ -1741,7 +1736,7 @@  static void msgout_phase1(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
 	for (i = 0; i < srb->msg_count; i++)
 		DC395x_write8(acb, TRM_S1040_SCSI_FIFO, *ptr++);
 	srb->msg_count = 0;
-	if (srb->msgout_buf[0] == MSG_ABORT)
+	if (srb->msgout_buf[0] == ABORT_TASK_SET)
 		srb->state = SRB_ABORT_SENT;
 
 	DC395x_write8(acb, TRM_S1040_SCSI_COMMAND, SCMD_FIFO_OUT);
@@ -2538,7 +2533,7 @@  static struct ScsiReqBlk *msgin_qtag(struct AdapterCtlBlk *acb,
 	srb = acb->tmp_srb;
 	srb->state = SRB_UNEXPECT_RESEL;
 	dcb->active_srb = srb;
-	srb->msgout_buf[0] = MSG_ABORT_TAG;
+	srb->msgout_buf[0] = ABORT_TASK;
 	srb->msg_count = 1;
 	DC395x_ENABLE_MSGOUT;
 	dprintkl(KERN_DEBUG, "msgin_qtag: Unknown tag %i - abort\n", tag);
@@ -2780,7 +2775,7 @@  static void msgin_phase0(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
 			msgin_reject(acb, srb);
 			break;
 
-		case MSG_IGNOREWIDE:
+		case IGNORE_WIDE_RESIDUE:
 			/* Discard  wide residual */
 			dprintkdbg(DBG_0, "msgin_phase0: Ignore Wide Residual!\n");
 			break;
diff --git a/drivers/scsi/dc395x.h b/drivers/scsi/dc395x.h
index a7786a6d462e..24a36c046d07 100644
--- a/drivers/scsi/dc395x.h
+++ b/drivers/scsi/dc395x.h
@@ -172,28 +172,6 @@ 
 
 #define SYNC_NEGO_OFFSET		15
 
-/* SCSI MSG BYTE */
-#define MSG_COMPLETE			0x00
-#define MSG_EXTENDED			0x01
-#define MSG_SAVE_PTR			0x02
-#define MSG_RESTORE_PTR			0x03
-#define MSG_DISCONNECT			0x04
-#define MSG_INITIATOR_ERROR		0x05
-#define MSG_ABORT			0x06
-#define MSG_REJECT_			0x07
-#define MSG_NOP				0x08
-#define MSG_PARITY_ERROR		0x09
-#define MSG_LINK_CMD_COMPL		0x0A
-#define MSG_LINK_CMD_COMPL_FLG		0x0B
-#define MSG_BUS_RESET			0x0C
-#define MSG_ABORT_TAG			0x0D
-#define MSG_SIMPLE_QTAG			0x20
-#define MSG_HEAD_QTAG			0x21
-#define MSG_ORDER_QTAG			0x22
-#define MSG_IGNOREWIDE			0x23
-#define MSG_IDENTIFY			0x80
-#define MSG_HOST_ID			0xC0
-
 /* cmd->result */
 #define STATUS_MASK_			0xFF
 #define MSG_MASK			0xFF00