Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: spi: Convert to scsi_execute_cmd()

scsi_execute() is going to be removed. Convert to the SPI class to
scsi_execute_cmd().

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
c9ee828a 7dfe0b5e

+15 -16
+15 -16
drivers/scsi/scsi_transport_spi.c
··· 105 105 } 106 106 107 107 static int spi_execute(struct scsi_device *sdev, const void *cmd, 108 - enum dma_data_direction dir, 109 - void *buffer, unsigned bufflen, 108 + enum req_op op, void *buffer, unsigned int bufflen, 110 109 struct scsi_sense_hdr *sshdr) 111 110 { 112 111 int i, result; 113 - unsigned char sense[SCSI_SENSE_BUFFERSIZE]; 114 112 struct scsi_sense_hdr sshdr_tmp; 113 + blk_opf_t opf = op | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | 114 + REQ_FAILFAST_DRIVER; 115 + const struct scsi_exec_args exec_args = { 116 + .req_flags = BLK_MQ_REQ_PM, 117 + .sshdr = sshdr ? : &sshdr_tmp, 118 + }; 115 119 116 - if (!sshdr) 117 - sshdr = &sshdr_tmp; 120 + sshdr = exec_args.sshdr; 118 121 119 122 for(i = 0; i < DV_RETRIES; i++) { 120 123 /* 121 124 * The purpose of the RQF_PM flag below is to bypass the 122 125 * SDEV_QUIESCE state. 123 126 */ 124 - result = scsi_execute(sdev, cmd, dir, buffer, bufflen, sense, 125 - sshdr, DV_TIMEOUT, /* retries */ 1, 126 - REQ_FAILFAST_DEV | 127 - REQ_FAILFAST_TRANSPORT | 128 - REQ_FAILFAST_DRIVER, 129 - RQF_PM, NULL); 127 + result = scsi_execute_cmd(sdev, cmd, opf, buffer, bufflen, 128 + DV_TIMEOUT, 1, &exec_args); 130 129 if (result < 0 || !scsi_sense_valid(sshdr) || 131 130 sshdr->sense_key != UNIT_ATTENTION) 132 131 break; ··· 674 675 } 675 676 676 677 for (r = 0; r < retries; r++) { 677 - result = spi_execute(sdev, spi_write_buffer, DMA_TO_DEVICE, 678 + result = spi_execute(sdev, spi_write_buffer, REQ_OP_DRV_OUT, 678 679 buffer, len, &sshdr); 679 680 if(result || !scsi_device_online(sdev)) { 680 681 ··· 696 697 } 697 698 698 699 memset(ptr, 0, len); 699 - spi_execute(sdev, spi_read_buffer, DMA_FROM_DEVICE, 700 + spi_execute(sdev, spi_read_buffer, REQ_OP_DRV_IN, 700 701 ptr, len, NULL); 701 702 scsi_device_set_state(sdev, SDEV_QUIESCE); 702 703 ··· 721 722 for (r = 0; r < retries; r++) { 722 723 memset(ptr, 0, len); 723 724 724 - result = spi_execute(sdev, spi_inquiry, DMA_FROM_DEVICE, 725 + result = spi_execute(sdev, spi_inquiry, REQ_OP_DRV_IN, 725 726 ptr, len, NULL); 726 727 727 728 if(result || !scsi_device_online(sdev)) { ··· 827 828 * (reservation conflict, device not ready, etc) just 828 829 * skip the write tests */ 829 830 for (l = 0; ; l++) { 830 - result = spi_execute(sdev, spi_test_unit_ready, DMA_NONE, 831 + result = spi_execute(sdev, spi_test_unit_ready, REQ_OP_DRV_IN, 831 832 NULL, 0, NULL); 832 833 833 834 if(result) { ··· 840 841 } 841 842 842 843 result = spi_execute(sdev, spi_read_buffer_descriptor, 843 - DMA_FROM_DEVICE, buffer, 4, NULL); 844 + REQ_OP_DRV_IN, buffer, 4, NULL); 844 845 845 846 if (result) 846 847 /* Device has no echo buffer */