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

scsi: core: Drop message byte helper

The message byte is now unused, so we can drop the helper to set the
message byte and the check for message bytes during error recovery.

Link: https://lore.kernel.org/r/20210427083046.31620-38-hare@suse.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Hannes Reinecke and committed by
Martin K. Petersen
54cf31d0 0ee44f90

+6 -26
+1 -1
block/scsi_ioctl.c
··· 254 254 */ 255 255 hdr->status = req->result & 0xff; 256 256 hdr->masked_status = status_byte(req->result); 257 - hdr->msg_status = msg_byte(req->result); 257 + hdr->msg_status = COMMAND_COMPLETE; 258 258 hdr->host_status = host_byte(req->result); 259 259 hdr->driver_status = 0; 260 260 if (scsi_status_is_check_condition(hdr->status))
+2 -16
drivers/scsi/scsi_error.c
··· 742 742 return FAILED; 743 743 744 744 /* 745 - * next, check the message byte. 746 - */ 747 - if (msg_byte(scmd->result) != COMMAND_COMPLETE) 748 - return FAILED; 749 - 750 - /* 751 745 * now, check the status byte to see if this indicates 752 746 * anything special. 753 747 */ ··· 1760 1766 case DID_PARITY: 1761 1767 return (scmd->request->cmd_flags & REQ_FAILFAST_DEV); 1762 1768 case DID_ERROR: 1763 - if (msg_byte(scmd->result) == COMMAND_COMPLETE && 1764 - status_byte(scmd->result) == RESERVATION_CONFLICT) 1769 + if (status_byte(scmd->result) == RESERVATION_CONFLICT) 1765 1770 return 0; 1766 1771 fallthrough; 1767 1772 case DID_SOFT_ERROR: ··· 1876 1883 */ 1877 1884 return SUCCESS; 1878 1885 case DID_ERROR: 1879 - if (msg_byte(scmd->result) == COMMAND_COMPLETE && 1880 - status_byte(scmd->result) == RESERVATION_CONFLICT) 1886 + if (status_byte(scmd->result) == RESERVATION_CONFLICT) 1881 1887 /* 1882 1888 * execute reservation conflict processing code 1883 1889 * lower down ··· 1903 1911 default: 1904 1912 return FAILED; 1905 1913 } 1906 - 1907 - /* 1908 - * next, check the message byte. 1909 - */ 1910 - if (msg_byte(scmd->result) != COMMAND_COMPLETE) 1911 - return FAILED; 1912 1914 1913 1915 /* 1914 1916 * check the status byte to see if this indicates anything special.
+1 -1
drivers/scsi/sg.c
··· 1376 1376 1377 1377 srp->header.status = 0xff & result; 1378 1378 srp->header.masked_status = status_byte(result); 1379 - srp->header.msg_status = msg_byte(result); 1379 + srp->header.msg_status = COMMAND_COMPLETE; 1380 1380 srp->header.host_status = host_byte(result); 1381 1381 srp->header.driver_status = driver_byte(result); 1382 1382 if ((sdp->sgdebug > 0) &&
+1 -1
drivers/xen/xen-scsiback.c
··· 224 224 225 225 pr_err("[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x\n", 226 226 tpg->tport->tport_name, pending_req->v2p->lun, 227 - pending_req->cmnd[0], status_byte(errors), msg_byte(errors), 227 + pending_req->cmnd[0], status_byte(errors), COMMAND_COMPLETE, 228 228 host_byte(errors)); 229 229 } 230 230
+1 -2
include/scsi/scsi.h
··· 181 181 * These are set by: 182 182 * 183 183 * status byte = set from target device 184 - * msg_byte = return status from host adapter itself. 184 + * msg_byte (unused) 185 185 * host_byte = set by low-level driver to indicate status. 186 186 */ 187 187 #define status_byte(result) (((result) >> 1) & 0x7f) 188 - #define msg_byte(result) (((result) >> 8) & 0xff) 189 188 #define host_byte(result) (((result) >> 16) & 0xff) 190 189 191 190 #define sense_class(sense) (((sense) >> 4) & 0x7)
-5
include/scsi/scsi_cmnd.h
··· 320 320 return cmd->result & 0xff; 321 321 } 322 322 323 - static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) 324 - { 325 - cmd->result = (cmd->result & 0xffff00ff) | (status << 8); 326 - } 327 - 328 323 static inline void set_host_byte(struct scsi_cmnd *cmd, char status) 329 324 { 330 325 cmd->result = (cmd->result & 0xff00ffff) | (status << 16);