From patchwork Tue Apr 20 00:06:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D04CC433ED for ; Tue, 20 Apr 2021 00:09:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0153C613AA for ; Tue, 20 Apr 2021 00:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232527AbhDTAJ3 (ORCPT ); Mon, 19 Apr 2021 20:09:29 -0400 Received: from mail-pj1-f42.google.com ([209.85.216.42]:33737 "EHLO mail-pj1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbhDTAJY (ORCPT ); Mon, 19 Apr 2021 20:09:24 -0400 Received: by mail-pj1-f42.google.com with SMTP id kb13-20020a17090ae7cdb02901503d67f0beso396850pjb.0 for ; Mon, 19 Apr 2021 17:08:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=whJsAS9htkGRzQXBS/tSKYd43Iy7ue3su31g2t7WCcM=; b=If06DCUSg3b6VLbwulAPXauRdUdTnWpT4P0H5Tzw1oSuNnmzu+8LhXkTDa3ArbxVoN aBvVZHQJSLah9hOnknmPZnstNltRab8SrHTsGrOGqLjlsLEkfAax+x7OV+vbZamDFhZI FAD1ZzI/EEvSVTCa5Bl9XLO91hrbwvADEReJZAXqlyo0DIwM0ahpIdNsuNwKYEOqdbNt WStFvbzoZyIFmzpCcTNAefS3Thk3ICJPxmrPZLT4/Qju6c8BwA7pTe1mFqx7WVToQVyt Qw8CC9llEp91ukWD6/KemE86P0+0PHYy9f4bAjqhiKn/qQMJzluHds64l8k5ep9uXq7U uaVw== X-Gm-Message-State: AOAM530kpO/9SL5249ShPlJoikyCczSVL2Vtz6jUDkhxXdGptX1ZuPIU JYvD+v1WH7rgehMEx83pGtU= X-Google-Smtp-Source: ABdhPJzanq7mSp7HT8BKhhi7jClvvXNc3HMzOQcavPJKVcWDbREt/KUhpdrA2vsISUOZrinDI7cEKw== X-Received: by 2002:a17:90b:34b:: with SMTP id fh11mr1843337pjb.105.1618877334121; Mon, 19 Apr 2021 17:08:54 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:08:53 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Hannes Reinecke , John Garry Subject: [PATCH 002/117] Introduce enums for the SAM, message, host and driver status codes Date: Mon, 19 Apr 2021 17:06:50 -0700 Message-Id: <20210420000845.25873-3-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Allow the compiler to verify whether SAM, message, host and driver status codes are used correctly. Add the attribute "__packed" to these enum definitions such that instances of the new enum types only occupy a single byte. Cc: Hannes Reinecke Cc: John Garry Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_error.c | 2 + include/scsi/scsi.h | 84 ++--------------------------------- include/scsi/scsi_cmnd.h | 11 +++-- include/scsi/scsi_proto.h | 53 ++++++++++++---------- include/scsi/scsi_status.h | 91 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+), 108 deletions(-) create mode 100644 include/scsi/scsi_status.h diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 9afd65eb2c8b..54213c37806b 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1775,6 +1775,8 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd) fallthrough; case DID_SOFT_ERROR: return (scmd->request->cmd_flags & REQ_FAILFAST_DRIVER); + default: + break; } if (status_byte(scmd->result) != CHECK_CONDITION) diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 246ced401683..c9ccb6b45b76 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -11,6 +11,7 @@ #include #include #include +#include struct scsi_cmnd; @@ -90,92 +91,14 @@ static inline int scsi_is_wlun(u64 lun) /* - * MESSAGE CODES + * Extended message codes. See also chapter 16 in SPI-5. */ - -#define COMMAND_COMPLETE 0x00 -#define EXTENDED_MESSAGE 0x01 #define EXTENDED_MODIFY_DATA_POINTER 0x00 #define EXTENDED_SDTR 0x01 #define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */ #define EXTENDED_WDTR 0x03 #define EXTENDED_PPR 0x04 #define EXTENDED_MODIFY_BIDI_DATA_PTR 0x05 -#define SAVE_POINTERS 0x02 -#define RESTORE_POINTERS 0x03 -#define DISCONNECT 0x04 -#define INITIATOR_ERROR 0x05 -#define ABORT_TASK_SET 0x06 -#define MESSAGE_REJECT 0x07 -#define NOP 0x08 -#define MSG_PARITY_ERROR 0x09 -#define LINKED_CMD_COMPLETE 0x0a -#define LINKED_FLG_CMD_COMPLETE 0x0b -#define TARGET_RESET 0x0c -#define ABORT_TASK 0x0d -#define CLEAR_TASK_SET 0x0e -#define INITIATE_RECOVERY 0x0f /* SCSI-II only */ -#define RELEASE_RECOVERY 0x10 /* SCSI-II only */ -#define TERMINATE_IO_PROC 0x11 /* SCSI-II only */ -#define CLEAR_ACA 0x16 -#define LOGICAL_UNIT_RESET 0x17 -#define SIMPLE_QUEUE_TAG 0x20 -#define HEAD_OF_QUEUE_TAG 0x21 -#define ORDERED_QUEUE_TAG 0x22 -#define IGNORE_WIDE_RESIDUE 0x23 -#define ACA 0x24 -#define QAS_REQUEST 0x55 - -/* Old SCSI2 names, don't use in new code */ -#define BUS_DEVICE_RESET TARGET_RESET -#define ABORT ABORT_TASK_SET - -/* - * Host byte codes - */ - -#define DID_OK 0x00 /* NO error */ -#define DID_NO_CONNECT 0x01 /* Couldn't connect before timeout period */ -#define DID_BUS_BUSY 0x02 /* BUS stayed busy through time out period */ -#define DID_TIME_OUT 0x03 /* TIMED OUT for other reason */ -#define DID_BAD_TARGET 0x04 /* BAD target. */ -#define DID_ABORT 0x05 /* Told to abort for some other reason */ -#define DID_PARITY 0x06 /* Parity error */ -#define DID_ERROR 0x07 /* Internal error */ -#define DID_RESET 0x08 /* Reset by somebody. */ -#define DID_BAD_INTR 0x09 /* Got an interrupt we weren't expecting. */ -#define DID_PASSTHROUGH 0x0a /* Force command past mid-layer */ -#define DID_SOFT_ERROR 0x0b /* The low level driver just wish a retry */ -#define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */ -#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also - * without decrementing the retry count */ -#define DID_TRANSPORT_DISRUPTED 0x0e /* Transport error disrupted execution - * and the driver blocked the port to - * recover the link. Transport class will - * retry or fail IO */ -#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */ -#define DID_TARGET_FAILURE 0x10 /* Permanent target failure, do not retry on - * other paths */ -#define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other - * paths might yield different results */ -#define DID_ALLOC_FAILURE 0x12 /* Space allocation on the device failed */ -#define DID_MEDIUM_ERROR 0x13 /* Medium error */ -#define DID_TRANSPORT_MARGINAL 0x14 /* Transport marginal errors */ -#define DRIVER_OK 0x00 /* Driver status */ - -/* - * These indicate the error that occurred, and what is available. - */ - -#define DRIVER_BUSY 0x01 -#define DRIVER_SOFT 0x02 -#define DRIVER_MEDIA 0x03 -#define DRIVER_ERROR 0x04 - -#define DRIVER_INVALID 0x05 -#define DRIVER_TIMEOUT 0x06 -#define DRIVER_HARD 0x07 -#define DRIVER_SENSE 0x08 /* * Internal return values. @@ -210,7 +133,8 @@ enum scsi_disposition { * host_byte = set by low-level driver to indicate status. * driver_byte = set by mid-level. */ -#define status_byte(result) (((result) >> 1) & 0x7f) +#define status_byte(result) ((enum sam_status_divided_by_two) \ + (((result) >> 1) & 0x7f)) #define msg_byte(result) (((result) >> 8) & 0xff) #define host_byte(result) (((result) >> 16) & 0xff) #define driver_byte(result) (((result) >> 24) & 0xff) diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index adb8df40b942..202106e7c814 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -12,6 +12,7 @@ #include #include #include +#include struct Scsi_Host; struct scsi_driver; @@ -313,22 +314,24 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd) #define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \ for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i) -static inline void set_status_byte(struct scsi_cmnd *cmd, char status) +static inline void set_status_byte(struct scsi_cmnd *cmd, + enum sam_status status) { cmd->result = (cmd->result & 0xffffff00) | status; } -static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) +static inline void set_msg_byte(struct scsi_cmnd *cmd, enum msg_byte status) { cmd->result = (cmd->result & 0xffff00ff) | (status << 8); } -static inline void set_host_byte(struct scsi_cmnd *cmd, char status) +static inline void set_host_byte(struct scsi_cmnd *cmd, enum host_status status) { cmd->result = (cmd->result & 0xff00ffff) | (status << 16); } -static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) +static inline void set_driver_byte(struct scsi_cmnd *cmd, + enum driver_status status) { cmd->result = (cmd->result & 0x00ffffff) | (status << 24); } diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h index c36860111932..e970fecfeaa1 100644 --- a/include/scsi/scsi_proto.h +++ b/include/scsi/scsi_proto.h @@ -11,6 +11,7 @@ #define _SCSI_PROTO_H_ #include +#include /* * SCSI opcodes @@ -187,20 +188,22 @@ struct scsi_varlen_cdb_hdr { }; /* - * SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft - * T10/1561-D Revision 4 Draft dated 7th November 2002. + * SCSI Architecture Model (SAM) status codes. Taken from SAM-6 draft + * revision 7 dated 17 February 2021. */ -#define SAM_STAT_GOOD 0x00 -#define SAM_STAT_CHECK_CONDITION 0x02 -#define SAM_STAT_CONDITION_MET 0x04 -#define SAM_STAT_BUSY 0x08 -#define SAM_STAT_INTERMEDIATE 0x10 -#define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14 -#define SAM_STAT_RESERVATION_CONFLICT 0x18 -#define SAM_STAT_COMMAND_TERMINATED 0x22 /* obsolete in SAM-3 */ -#define SAM_STAT_TASK_SET_FULL 0x28 -#define SAM_STAT_ACA_ACTIVE 0x30 -#define SAM_STAT_TASK_ABORTED 0x40 +enum sam_status { + SAM_STAT_GOOD = 0x00, + SAM_STAT_CHECK_CONDITION = 0x02, + SAM_STAT_CONDITION_MET = 0x04, + SAM_STAT_BUSY = 0x08, + SAM_STAT_INTERMEDIATE = 0x10, /* obsolete in SAM-4 */ + SAM_STAT_INTERMEDIATE_CONDITION_MET = 0x14, /* obsolete in SAM-4 */ + SAM_STAT_RESERVATION_CONFLICT = 0x18, + SAM_STAT_COMMAND_TERMINATED = 0x22, /* obsolete in SAM-3 */ + SAM_STAT_TASK_SET_FULL = 0x28, + SAM_STAT_ACA_ACTIVE = 0x30, + SAM_STAT_TASK_ABORTED = 0x40, +} __packed; /* * Status codes. These are deprecated as they are shifted 1 bit right @@ -209,17 +212,19 @@ struct scsi_varlen_cdb_hdr { * above. */ -#define GOOD 0x00 -#define CHECK_CONDITION 0x01 -#define CONDITION_GOOD 0x02 -#define BUSY 0x04 -#define INTERMEDIATE_GOOD 0x08 -#define INTERMEDIATE_C_GOOD 0x0a -#define RESERVATION_CONFLICT 0x0c -#define COMMAND_TERMINATED 0x11 -#define QUEUE_FULL 0x14 -#define ACA_ACTIVE 0x18 -#define TASK_ABORTED 0x20 +enum sam_status_divided_by_two { + GOOD = 0x00, + CHECK_CONDITION = 0x01, + CONDITION_GOOD = 0x02, + BUSY = 0x04, + INTERMEDIATE_GOOD = 0x08, + INTERMEDIATE_C_GOOD = 0x0a, + RESERVATION_CONFLICT = 0x0c, + COMMAND_TERMINATED = 0x11, + QUEUE_FULL = 0x14, + ACA_ACTIVE = 0x18, + TASK_ABORTED = 0x20, +} __packed; #define STATUS_MASK 0xfe diff --git a/include/scsi/scsi_status.h b/include/scsi/scsi_status.h new file mode 100644 index 000000000000..da2ba825f981 --- /dev/null +++ b/include/scsi/scsi_status.h @@ -0,0 +1,91 @@ +#ifndef _SCSI_SCSI_STATUS_H +#define _SCSI_SCSI_STATUS_H + +#include +#include +#include + +/* + * Message codes. See also table 60 "Link control message codes" in SPI-5. + * See also table 47 "Link control message codes" in SPI-2. + */ +enum msg_byte { + COMMAND_COMPLETE = 0x00, + EXTENDED_MESSAGE = 0x01, + SAVE_POINTERS = 0x02, + RESTORE_POINTERS = 0x03, + DISCONNECT = 0x04, + INITIATOR_ERROR = 0x05, + ABORT_TASK_SET = 0x06, + MESSAGE_REJECT = 0x07, + NOP = 0x08, + MSG_PARITY_ERROR = 0x09, + LINKED_CMD_COMPLETE = 0x0a, + LINKED_FLG_CMD_COMPLETE = 0x0b, + TARGET_RESET = 0x0c, + ABORT_TASK = 0x0d, + CLEAR_TASK_SET = 0x0e, + INITIATE_RECOVERY = 0x0f, /* SCSI-II only */ + RELEASE_RECOVERY = 0x10, /* SCSI-II only */ + TERMINATE_IO_PROC = 0x11, /* SCSI-II only */ + CLEAR_ACA = 0x16, + LOGICAL_UNIT_RESET = 0x17, + SIMPLE_QUEUE_TAG = 0x20, + HEAD_OF_QUEUE_TAG = 0x21, + ORDERED_QUEUE_TAG = 0x22, + IGNORE_WIDE_RESIDUE = 0x23, + ACA = 0x24, + QAS_REQUEST = 0x55, + + /* Old SCSI2 names, don't use in new code */ + BUS_DEVICE_RESET = TARGET_RESET, + ABORT = ABORT_TASK_SET, +} __packed; + +/* Host byte codes. */ +enum host_status { + DID_OK = 0x00, /* NO error */ + DID_NO_CONNECT = 0x01, /* Couldn't connect before timeout period */ + DID_BUS_BUSY = 0x02, /* BUS stayed busy through time out period */ + DID_TIME_OUT = 0x03, /* TIMED OUT for other reason */ + DID_BAD_TARGET = 0x04, /* BAD target. */ + DID_ABORT = 0x05, /* Told to abort for some other reason */ + DID_PARITY = 0x06, /* Parity error */ + DID_ERROR = 0x07, /* Internal error */ + DID_RESET = 0x08, /* Reset by somebody. */ + DID_BAD_INTR = 0x09, /* Got an interrupt we weren't expecting. */ + DID_PASSTHROUGH = 0x0a, /* Force command past mid-layer */ + DID_SOFT_ERROR = 0x0b, /* The low level driver just wish a retry */ + DID_IMM_RETRY = 0x0c, /* Retry without decrementing retry count */ + DID_REQUEUE = 0x0d, /* Requeue command (no immediate retry) also + * without decrementing the retry count */ + DID_TRANSPORT_DISRUPTED = 0x0e, /* Transport error disrupted execution + * and the driver blocked the port to + * recover the link. Transport class will + * retry or fail IO */ + DID_TRANSPORT_FAILFAST = 0x0f, /* Transport class fastfailed the io */ + DID_TARGET_FAILURE = 0x10, /* Permanent target failure, do not retry on + * other paths */ + DID_NEXUS_FAILURE = 0x11, /* Permanent nexus failure, retry on other + * paths might yield different results */ + DID_ALLOC_FAILURE = 0x12, /* Space allocation on the device failed */ + DID_MEDIUM_ERROR = 0x13, /* Medium error */ + DID_TRANSPORT_MARGINAL = 0x14, /* Transport marginal errors */ +} __packed; + +/* Driver byte codes. */ +enum driver_status { + DRIVER_OK = 0x00, + + DRIVER_BUSY = 0x01, + DRIVER_SOFT = 0x02, + DRIVER_MEDIA = 0x03, + DRIVER_ERROR = 0x04, + + DRIVER_INVALID = 0x05, + DRIVER_TIMEOUT = 0x06, + DRIVER_HARD = 0x07, + DRIVER_SENSE = 0x08, +} __packed; + +#endif /* _SCSI_SCSI_STATUS_H */ From patchwork Tue Apr 20 00:06:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67431C43460 for ; Tue, 20 Apr 2021 00:09:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F4A46109E for ; Tue, 20 Apr 2021 00:09:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232598AbhDTAJa (ORCPT ); Mon, 19 Apr 2021 20:09:30 -0400 Received: from mail-pj1-f49.google.com ([209.85.216.49]:53850 "EHLO mail-pj1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbhDTAJ1 (ORCPT ); Mon, 19 Apr 2021 20:09:27 -0400 Received: by mail-pj1-f49.google.com with SMTP id nk8so5702572pjb.3 for ; Mon, 19 Apr 2021 17:08:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3Xbpf04bJk7wYcO2r0IDvrdD0PIhH0YfN+4ZJKhyqbU=; b=kuPsbzJ2GjM5FqF4RLCFdHaRqJAD/FMBqf2zGx6sMHA+YOkExs3zFSdwXhUrFC/kWt ygB5K2mUZ5tzGBjmbLBwkZ6jWEOhB6N27iovvRWp+ffxyvD0OVa6G2bvF3pRfhvpNqmI M/5HSX/9j8b3841hHkhNkamA+AvLH4XU/p6VECrdvqqkoMxFlWvITaKdwC6LU0z8gxY8 NuJ6fsBVHIGE6Tk8gQC6TWU4FalLbiDUau4mVCOyt6Uu765/yzExuFTf+x52ed5K05kN FedlICU49B/TfM9LuntLhKjXeuAddF2H6hIqdnY4YFoDT5YKfcpG9J6mEwShZTZ/tfgq +cLg== X-Gm-Message-State: AOAM531QjWaUfUAMuC4TiGgd+MmsmSNsEshG01VWH0i53WV/bsjY7rb3 lcGukkt4EM0Zufswndq89rYHufAXEK4= X-Google-Smtp-Source: ABdhPJzDrDvFF9rKMDZdoDd/NeuaZ1F2Cr8eGP7JtlFaYrZAaic4OG6NiH5wGnbAuiFhI8Ht34TilA== X-Received: by 2002:a17:902:c14d:b029:ec:acd9:d5a0 with SMTP id 13-20020a170902c14db02900ecacd9d5a0mr5205316plj.60.1618877336424; Mon, 19 Apr 2021 17:08:56 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:08:55 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Lee Duncan Subject: [PATCH 004/117] libiscsi: Use the host_status enum Date: Mon, 19 Apr 2021 17:06:52 -0700 Message-Id: <20210420000845.25873-5-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Allow the compiler to verify the type of the last argument passed to fail_scsi_task() and fail_scsi_tasks(). Cc: Lee Duncan Signed-off-by: Bart Van Assche Reviewed-by: Lee Duncan --- drivers/scsi/libiscsi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 7ad11e42306d..4b8c9b9cf927 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -590,7 +590,7 @@ static bool cleanup_queued_task(struct iscsi_task *task) * session frwd lock must be held and if not called for a task that is still * pending or from the xmit thread, then xmit thread must be suspended */ -static void fail_scsi_task(struct iscsi_task *task, int err) +static void fail_scsi_task(struct iscsi_task *task, enum host_status err) { struct iscsi_conn *conn = task->conn; struct scsi_cmnd *sc; @@ -1885,7 +1885,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, /* * Fail commands. session frwd lock held and xmit thread flushed. */ -static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) +static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, + enum host_status error) { struct iscsi_session *session = conn->session; struct iscsi_task *task; From patchwork Tue Apr 20 00:06:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAF5CC43470 for ; Tue, 20 Apr 2021 00:09:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8839D6109E for ; Tue, 20 Apr 2021 00:09:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232720AbhDTAJc (ORCPT ); Mon, 19 Apr 2021 20:09:32 -0400 Received: from mail-pl1-f171.google.com ([209.85.214.171]:40872 "EHLO mail-pl1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232468AbhDTAJ3 (ORCPT ); Mon, 19 Apr 2021 20:09:29 -0400 Received: by mail-pl1-f171.google.com with SMTP id 20so14722925pll.7 for ; Mon, 19 Apr 2021 17:08:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q9iK91yNau6O94ZCbM5uG/Ghx1tOYDNnoEZlBq1nB6c=; b=b8MGXfAegW0PHXindIjE1LeiknPv6mTg5r4pDENxVwSGDF3wDym8tNnMfiunFAbBSU SXyzuJPXVUKn852puyTEHXCUSI8HriapCTqdcaJCCg1D2PZZEQuy0bjSsKCsv+rx/iHy lgDxX0oifgjoUwB3QaXLqcL9WGVjO1idiVP0BnUtogZFtjuqylOCArfGb0UM5czmv6PI YPkasYDCvbzOm7Vi2qJkpXTfY883rAzRi4T2LrWUfDttUwTuu/Ey2faZMTCQrFAq1QoC JkTmh+BeSPiDzccgPanAKGwnQ6zBIgWGTsyFBQdF+K8NTYHhbbs743Hpi7PWfWNYVuiy CLsA== X-Gm-Message-State: AOAM5332Ol6Hi2cRcwpm4ro7nZruVFG5iBp/7bnxsTnKTmB4q4B6oomG KodIHvi/Wb6iNgMF97IXgTA= X-Google-Smtp-Source: ABdhPJzfy9+tbq3blpUfrQjkW9/ZZprwiAAjqytH/Zlw0Bje0ASGq17Mu3BGSSBIi/rbuWf3RzAKjw== X-Received: by 2002:a17:902:f2d1:b029:eb:2e32:8804 with SMTP id h17-20020a170902f2d1b02900eb2e328804mr26027319plc.40.1618877338688; Mon, 19 Apr 2021 17:08:58 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:08:58 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Mike Christie Subject: [PATCH 006/117] target: Use enum sam_status instead of u8 Date: Mon, 19 Apr 2021 17:06:54 -0700 Message-Id: <20210420000845.25873-7-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Allow the compiler to verify whether a SAM status code has been specified where such a code is expected. This patch does not change any functionality since SAM_STAT_GOOD and GOOD are both symbolic names for the numerical value 0. Cc: Mike Christie Signed-off-by: Bart Van Assche --- drivers/target/loopback/tcm_loop.c | 2 +- drivers/target/target_core_alua.c | 6 +++--- drivers/target/target_core_iblock.c | 2 +- drivers/target/target_core_pr.c | 8 ++++---- drivers/target/target_core_pscsi.c | 4 ++-- drivers/target/target_core_sbc.c | 10 +++++----- drivers/target/target_core_spc.c | 14 +++++++------- drivers/target/target_core_transport.c | 5 +++-- drivers/target/target_core_xcopy.c | 2 +- include/target/target_core_backend.h | 4 ++-- include/target/target_core_base.h | 3 ++- 11 files changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 2687fd7d45db..66ea91c52175 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -550,7 +550,7 @@ static int tcm_loop_write_pending(struct se_cmd *se_cmd) } static int tcm_loop_queue_data_or_status(const char *func, - struct se_cmd *se_cmd, u8 scsi_status) + struct se_cmd *se_cmd, enum sam_status scsi_status) { struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, struct tcm_loop_cmd, tl_se_cmd); diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 5517c7dd5144..3bb921345bce 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c @@ -123,7 +123,7 @@ target_emulate_report_referrals(struct se_cmd *cmd) transport_kunmap_data_sg(cmd); - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } @@ -255,7 +255,7 @@ target_emulate_report_target_port_groups(struct se_cmd *cmd) } transport_kunmap_data_sg(cmd); - target_complete_cmd_with_length(cmd, GOOD, rd_len + 4); + target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, rd_len + 4); return 0; } @@ -424,7 +424,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd) out: transport_kunmap_data_sg(cmd); if (!rc) - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return rc; } diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index d6fdd1c61f90..deb2b8b64d20 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -474,7 +474,7 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd) if (ret) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 6fd5fec95539..4b94b085625b 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -234,7 +234,7 @@ target_scsi2_reservation_release(struct se_cmd *cmd) out_unlock: spin_unlock(&dev->dev_reservation_lock); out: - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } @@ -297,7 +297,7 @@ target_scsi2_reservation_reserve(struct se_cmd *cmd) spin_unlock(&dev->dev_reservation_lock); out: if (!ret) - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return ret; } @@ -3676,7 +3676,7 @@ target_scsi3_emulate_pr_out(struct se_cmd *cmd) } if (!ret) - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return ret; } @@ -4073,7 +4073,7 @@ target_scsi3_emulate_pr_in(struct se_cmd *cmd) } if (!ret) - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return ret; } diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index dac44caf77a3..fd617bc4113e 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -588,7 +588,7 @@ static void pscsi_destroy_device(struct se_device *dev) } } -static void pscsi_complete_cmd(struct se_cmd *cmd, u8 scsi_status, +static void pscsi_complete_cmd(struct se_cmd *cmd, enum sam_status scsi_status, unsigned char *req_sense) { struct pscsi_dev_virt *pdv = PSCSI_DEV(cmd->se_dev); @@ -1044,7 +1044,7 @@ static void pscsi_req_done(struct request *req, blk_status_t status) struct se_cmd *cmd = req->end_io_data; struct pscsi_plugin_task *pt = cmd->priv; int result = scsi_req(req)->result; - u8 scsi_status = status_byte(result) << 1; + enum sam_status scsi_status = status_byte(result) << 1; if (scsi_status != SAM_STAT_GOOD) { pr_debug("PSCSI Status Byte exception at cmd: %p CDB:" diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 7b07e557dc8d..b32f4ee88e79 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -67,7 +67,7 @@ sbc_emulate_readcapacity(struct se_cmd *cmd) transport_kunmap_data_sg(cmd); } - target_complete_cmd_with_length(cmd, GOOD, 8); + target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, 8); return 0; } @@ -130,7 +130,7 @@ sbc_emulate_readcapacity_16(struct se_cmd *cmd) transport_kunmap_data_sg(cmd); } - target_complete_cmd_with_length(cmd, GOOD, 32); + target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, 32); return 0; } @@ -202,14 +202,14 @@ sbc_execute_write_same_unmap(struct se_cmd *cmd) return ret; } - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } static sense_reason_t sbc_emulate_noop(struct se_cmd *cmd) { - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } @@ -1245,7 +1245,7 @@ sbc_execute_unmap(struct se_cmd *cmd) err: transport_kunmap_data_sg(cmd); if (!ret) - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return ret; } diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 70a661801cb9..0756a690ea84 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c @@ -750,7 +750,7 @@ spc_emulate_inquiry(struct se_cmd *cmd) kfree(buf); if (!ret) - target_complete_cmd_with_length(cmd, GOOD, len); + target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, len); return ret; } @@ -1104,7 +1104,7 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) transport_kunmap_data_sg(cmd); } - target_complete_cmd_with_length(cmd, GOOD, length); + target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, length); return 0; } @@ -1122,7 +1122,7 @@ static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd) int i; if (!cmd->data_length) { - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } @@ -1165,7 +1165,7 @@ static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd) transport_kunmap_data_sg(cmd); if (!ret) - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return ret; } @@ -1198,7 +1198,7 @@ static sense_reason_t spc_emulate_request_sense(struct se_cmd *cmd) memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); transport_kunmap_data_sg(cmd); - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } @@ -1265,7 +1265,7 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) transport_kunmap_data_sg(cmd); } - target_complete_cmd_with_length(cmd, GOOD, 8 + lun_count * 8); + target_complete_cmd_with_length(cmd, SAM_STAT_GOOD, 8 + lun_count * 8); return 0; } EXPORT_SYMBOL(spc_emulate_report_luns); @@ -1273,7 +1273,7 @@ EXPORT_SYMBOL(spc_emulate_report_luns); static sense_reason_t spc_emulate_testunitready(struct se_cmd *cmd) { - target_complete_cmd(cmd, GOOD); + target_complete_cmd(cmd, SAM_STAT_GOOD); return 0; } diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 8fbfe75c5744..b55db3a1f94b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -855,7 +855,7 @@ static bool target_cmd_interrupted(struct se_cmd *cmd) } /* May be called from interrupt context so must not sleep. */ -void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) +void target_complete_cmd(struct se_cmd *cmd, enum sam_status scsi_status) { struct se_wwn *wwn = cmd->se_sess->se_tpg->se_tpg_wwn; int success, cpu; @@ -910,7 +910,8 @@ void target_set_cmd_data_length(struct se_cmd *cmd, int length) } EXPORT_SYMBOL(target_set_cmd_data_length); -void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int length) +void target_complete_cmd_with_length(struct se_cmd *cmd, + enum sam_status scsi_status, int length) { if (scsi_status == SAM_STAT_GOOD || cmd->se_cmd_flags & SCF_TREAT_READ_AS_NORMAL) { diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index d31ed071cb08..44d76c304701 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -1011,7 +1011,7 @@ static sense_reason_t target_rcr_operating_parameters(struct se_cmd *se_cmd) put_unaligned_be32(42, &p[0]); transport_kunmap_data_sg(se_cmd); - target_complete_cmd(se_cmd, GOOD); + target_complete_cmd(se_cmd, SAM_STAT_GOOD); return TCM_NO_SENSE; } diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 1f78b09bba55..15e1db779bce 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h @@ -73,9 +73,9 @@ struct sbc_ops { int transport_backend_register(const struct target_backend_ops *); void target_backend_unregister(const struct target_backend_ops *); -void target_complete_cmd(struct se_cmd *, u8); +void target_complete_cmd(struct se_cmd *, enum sam_status); void target_set_cmd_data_length(struct se_cmd *, int); -void target_complete_cmd_with_length(struct se_cmd *, u8, int); +void target_complete_cmd_with_length(struct se_cmd *, enum sam_status, int); void transport_copy_sense_to_cmd(struct se_cmd *, unsigned char *); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index d1f7d2a45354..68accab36b3e 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -8,6 +8,7 @@ #include #include /* struct semaphore */ #include +#include #define TARGET_CORE_VERSION "v5.0" @@ -453,7 +454,7 @@ enum target_core_dif_check { struct se_cmd { /* SAM response code being sent to initiator */ - u8 scsi_status; + enum sam_status scsi_status; u8 scsi_asc; u8 scsi_ascq; u16 scsi_sense_length; From patchwork Tue Apr 20 00:06:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424255 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81FA1C43461 for ; Tue, 20 Apr 2021 00:09:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DAAC6109E for ; Tue, 20 Apr 2021 00:09:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232662AbhDTAJd (ORCPT ); Mon, 19 Apr 2021 20:09:33 -0400 Received: from mail-pl1-f174.google.com ([209.85.214.174]:33748 "EHLO mail-pl1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbhDTAJa (ORCPT ); Mon, 19 Apr 2021 20:09:30 -0400 Received: by mail-pl1-f174.google.com with SMTP id n10so7530548plc.0 for ; Mon, 19 Apr 2021 17:09:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yMDwXZ84hsapV539Fos3bJY203yOZ61XgSgGRpSxeTw=; b=KpaY9UNIYT7/0e+0rkXJr8vVeHQN1tFd3sbJMX5YW4uM/cF6NoJWkNC6ch4gQ7ZVwR 8USEch9v32IZCb/58vKEw081Q4+ayIz3kARnavPB+Dk45KAT+JcR4sTrPqWRboxPBGp1 RGRf0xCKGV1pRF7OCBkVsWHBGps5Jglg89APTSlfC2Vb9N9VjL8S5rAWm0nNxU/Cv7pM JHhakQStDRusUSt2WBECbT5er2y8ooAjgwdf9ykEp2Prifx9KreRcnW5S7Uuo4wy+BTC ZqWR+mSBr/274OS76WGT5WpWe99vuRnxhSqXdgtznFnXQI/1JI6uiUIFyGGL/aG7MUVL TdDQ== X-Gm-Message-State: AOAM530CI4cUEFJZFnhiPYNV5Hm348rBcE7puIvwQN4EvSjd4SZvYU/O hOMkJPQStuEiNp48pjFR26M= X-Google-Smtp-Source: ABdhPJx+ts7gt9WjcEnOR7+BbDOHoM0jNe5GQpnfpaaI0iU4GYmv2ONy/XKDGaIBny2pLA9guUakFQ== X-Received: by 2002:a17:902:d3ca:b029:eb:4ae2:6d6 with SMTP id w10-20020a170902d3cab02900eb4ae206d6mr26187787plb.69.1618877339854; Mon, 19 Apr 2021 17:08:59 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:08:59 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , James Smart Subject: [PATCH 007/117] lpfc: Reformat four comparisons Date: Mon, 19 Apr 2021 17:06:55 -0700 Message-Id: <20210420000845.25873-8-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Reformat four comparisons because otherwise Coccinelle would make the formatting of these comparisons look weird. Cc: James Smart Signed-off-by: Bart Van Assche Reviewed-by: James Smart --- drivers/scsi/lpfc/lpfc_scsi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index eefbb9b22798..81455b53ef3e 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -4227,11 +4227,9 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, if (lpfc_cmd->result & IOERR_DRVR_MASK) lpfc_cmd->status = IOSTAT_DRIVER_REJECT; if (lpfc_cmd->result == IOERR_ELXSEC_KEY_UNWRAP_ERROR || - lpfc_cmd->result == - IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR || + lpfc_cmd->result == IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR || lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_ERROR || - lpfc_cmd->result == - IOERR_ELXSEC_CRYPTO_COMPARE_ERROR) { + lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_COMPARE_ERROR) { cmd->result = DID_NO_CONNECT << 16; break; } @@ -4502,11 +4500,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, case IOSTAT_LOCAL_REJECT: case IOSTAT_REMOTE_STOP: if (lpfc_cmd->result == IOERR_ELXSEC_KEY_UNWRAP_ERROR || - lpfc_cmd->result == - IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR || + lpfc_cmd->result == IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR || lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_ERROR || - lpfc_cmd->result == - IOERR_ELXSEC_CRYPTO_COMPARE_ERROR) { + lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_COMPARE_ERROR) { cmd->result = DID_NO_CONNECT << 16; break; } From patchwork Tue Apr 20 00:06:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424254 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3103C43462 for ; Tue, 20 Apr 2021 00:09:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8882A61363 for ; Tue, 20 Apr 2021 00:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232838AbhDTAJf (ORCPT ); Mon, 19 Apr 2021 20:09:35 -0400 Received: from mail-pj1-f44.google.com ([209.85.216.44]:44743 "EHLO mail-pj1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbhDTAJe (ORCPT ); Mon, 19 Apr 2021 20:09:34 -0400 Received: by mail-pj1-f44.google.com with SMTP id m6-20020a17090a8586b02901507e1acf0fso3976123pjn.3 for ; Mon, 19 Apr 2021 17:09:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=un+9zpjDZL4UdMPAScb+oLv9NoebEKwBopaM4XRVTFk=; b=EEPdrH1+hQW4qvsBqMiginkj1YllDqVTqy/W7wMEDblJpGoy6vnSirqqwGxcms3O4q 5e89tZbFScmRtUWyVuB3Eu1oHfwGPGWYIY7voFMb7wvBU5AHxEKKui6ICjYU9urEfR31 FQyF9w5MSRJLhDrHhAOJx22NPIsXYltkJ7060bf7nEzxBiraVGPVffeQc0CQq4HNfkd2 Tci6oRPDMhhODLfFKijQNr7Zjf+EH4FIoe+SQf1CrXQ5ACVeZ48yjt71iB1r01fU3pyu jWsOklisOcYcMUJtrVAqneTJmkb489+xsSp7JO4KNTi8vrjSHwNGQ14cx8ryLeBQqTjM bl7A== X-Gm-Message-State: AOAM533HhwzhgT/Jm4kppKDEX8un9iftoXkARExaXpz/G5v6xI/gDCpY traNH8nMeJOkMFjuLcE5mLU= X-Google-Smtp-Source: ABdhPJxmJcztXPjmjahy/nOqsVTyn+VivjLnHa5k2ej2OV01mSwyfKcL4toPffDk5IU970AM3yHeQQ== X-Received: by 2002:a17:90a:df10:: with SMTP id gp16mr1735217pjb.209.1618877343575; Mon, 19 Apr 2021 17:09:03 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:02 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Can Guo Subject: [PATCH 010/117] ufs: Add a compile-time structure size check Date: Mon, 19 Apr 2021 17:06:58 -0700 Message-Id: <20210420000845.25873-11-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Before modifying the definition of struct ufs_bsg_reply, add a compile-time structure size check. Cc: Can Guo Signed-off-by: Bart Van Assche Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 0625da7a42ee..fa596cf66c23 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9455,6 +9455,8 @@ EXPORT_SYMBOL_GPL(ufshcd_init); static int __init ufshcd_core_init(void) { + BUILD_BUG_ON(offsetof(struct ufs_bsg_reply, upiu_rsp) != 8); + ufs_debugfs_init(); return 0; } From patchwork Tue Apr 20 00:07:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E825BC43460 for ; Tue, 20 Apr 2021 00:09:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B34BE6109E for ; Tue, 20 Apr 2021 00:09:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232929AbhDTAJk (ORCPT ); Mon, 19 Apr 2021 20:09:40 -0400 Received: from mail-pl1-f177.google.com ([209.85.214.177]:44822 "EHLO mail-pl1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232885AbhDTAJh (ORCPT ); Mon, 19 Apr 2021 20:09:37 -0400 Received: by mail-pl1-f177.google.com with SMTP id y1so3024414plg.11 for ; Mon, 19 Apr 2021 17:09:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wkpKiiQ7QErhpRfwfIqYg+u3+hV/n0/tj7DxsSL3k/A=; b=q8pzrqwQnAOmwx5NDMOhpd7KyXyhGiveIidyw7kEqOo4V0RdcliitkolGotJqj6ibH TCEGlloF0fzj3X2XfgBWz+Fuynoe4s0ugDwYiIrac1UAOOCHLA8dyNJSJjiXgDVfvMsu kiNFRU1aZGTeTN3pH1kX+Soxry4pshbNaWMHolYJ9vryFZmCg/OonvOYSBXlnKj5T33I OrPxdsPFE+O0CNGd8+o1TjKGx4J6KUwNUJLHPu4ZKh84Z4BEDh1LUIpl2iu0esMnHTGC jA0agECyEPSxRnDClZbs4nt99Mlb0ik1VUemHP/7HTWEblQ92sceRWUKIEKxds8CPOs4 jnOA== X-Gm-Message-State: AOAM533KVAWW40lZZleVKGnGTmpZV9mgpdeo0tXl4gYMNEluXcjPht8d V4qKwiwCBK1Jp757K3snH8U= X-Google-Smtp-Source: ABdhPJxFhS7djgoLNJuWRXBS3/1yjqYU1r+8hKNyJbNGcIIBcgvY8issobWn2Hb6hvVe8cjWm2CSAQ== X-Received: by 2002:a17:90a:c984:: with SMTP id w4mr1777768pjt.110.1618877346160; Mon, 19 Apr 2021 17:09:06 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:05 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Jens Axboe Subject: [PATCH 012/117] block: Convert SCSI and bsg code to the scsi_status union Date: Mon, 19 Apr 2021 17:07:00 -0700 Message-Id: <20210420000845.25873-13-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Jens Axboe Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- block/bsg-lib.c | 16 ++++++++-------- block/bsg.c | 6 +++--- block/scsi_ioctl.c | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index 330fede77271..35a01a264816 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -82,18 +82,18 @@ static int bsg_transport_complete_rq(struct request *rq, struct sg_io_v4 *hdr) * The assignments below don't make much sense, but are kept for * bug by bug backwards compatibility: */ - hdr->device_status = job->result & 0xff; - hdr->transport_status = host_byte(job->result); - hdr->driver_status = driver_byte(job->result); + hdr->device_status = job->status.b.status; + hdr->transport_status = host_byte(job->status); + hdr->driver_status = driver_byte(job->status); hdr->info = 0; if (hdr->device_status || hdr->transport_status || hdr->driver_status) hdr->info |= SG_INFO_CHECK; hdr->response_len = 0; - if (job->result < 0) { + if (job->status.combined < 0) { /* we're only returning the result field in the reply */ job->reply_len = sizeof(u32); - ret = job->result; + ret = job->status.combined; } if (job->reply_len && hdr->response) { @@ -183,7 +183,7 @@ void bsg_job_done(struct bsg_job *job, int result, { struct request *rq = blk_mq_rq_from_pdu(job); - job->result = result; + job->status.combined = result; job->reply_payload_rcv_len = reply_payload_rcv_len; if (likely(!blk_should_fake_timeout(rq->q))) blk_mq_complete_request(rq); @@ -247,7 +247,7 @@ static bool bsg_prepare_job(struct device *dev, struct request *req) failjob_rls_rqst_payload: kfree(job->request_payload.sg_list); failjob_rls_job: - job->result = -ENOMEM; + job->status.combined = -ENOMEM; return false; } @@ -257,7 +257,7 @@ static bool bsg_prepare_job(struct device *dev, struct request *req) * @bd: queue data * * On error the create_bsg_job function should return a -Exyz error value - * that will be set to ->result. + * that will be set to ->status. * * Drivers/subsys should pass this to the queue init function. */ diff --git a/block/bsg.c b/block/bsg.c index bd10922d5cbb..a03d43ed2bcc 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -94,9 +94,9 @@ static int bsg_scsi_complete_rq(struct request *rq, struct sg_io_v4 *hdr) /* * fill in all the output members */ - hdr->device_status = sreq->result & 0xff; - hdr->transport_status = host_byte(sreq->result); - hdr->driver_status = driver_byte(sreq->result); + hdr->device_status = sreq->status.b.status; + hdr->transport_status = host_byte(sreq->status); + hdr->driver_status = driver_byte(sreq->status); hdr->info = 0; if (hdr->device_status || hdr->transport_status || hdr->driver_status) hdr->info |= SG_INFO_CHECK; diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 6599bac0a78c..3a56dc979df2 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -252,11 +252,11 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, /* * fill in all the output members */ - hdr->status = req->result & 0xff; - hdr->masked_status = status_byte(req->result); - hdr->msg_status = msg_byte(req->result); - hdr->host_status = host_byte(req->result); - hdr->driver_status = driver_byte(req->result); + hdr->status = req->status.b.status; + hdr->masked_status = status_byte(req->status); + hdr->msg_status = msg_byte(req->status); + hdr->host_status = host_byte(req->status); + hdr->driver_status = driver_byte(req->status); hdr->info = 0; if (hdr->masked_status || hdr->host_status || hdr->driver_status) hdr->info |= SG_INFO_CHECK; @@ -495,7 +495,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, blk_execute_rq(disk, rq, 0); - err = req->result & 0xff; /* only 8 bit SCSI status */ + err = req->status.b.status; /* only 8 bit SCSI status */ if (err) { if (req->sense_len && req->sense) { bytes = (OMAX_SB_LEN > req->sense_len) ? @@ -533,7 +533,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk, scsi_req(rq)->cmd[4] = data; scsi_req(rq)->cmd_len = 6; blk_execute_rq(bd_disk, rq, 0); - err = scsi_req(rq)->result ? -EIO : 0; + err = scsi_req(rq)->status.combined ? -EIO : 0; blk_put_request(rq); return err; From patchwork Tue Apr 20 00:07:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B392AC433ED for ; Tue, 20 Apr 2021 00:09:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F894613AA for ; Tue, 20 Apr 2021 00:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232957AbhDTAJl (ORCPT ); Mon, 19 Apr 2021 20:09:41 -0400 Received: from mail-pj1-f51.google.com ([209.85.216.51]:33756 "EHLO mail-pj1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232903AbhDTAJi (ORCPT ); Mon, 19 Apr 2021 20:09:38 -0400 Received: by mail-pj1-f51.google.com with SMTP id kb13-20020a17090ae7cdb02901503d67f0beso397125pjb.0 for ; Mon, 19 Apr 2021 17:09:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dqYxgSnUpuqY7WGaxyiFYNqWkCJkcjfy38j5CcD3yCY=; b=igPtEgprj7cvRVv/MF8lRcK4wTTsr3lFamtd7bmS4xTWHWrryB3uAPTbzBMaYmeQUk mPn9CPTrcQYnJAOFND8YMli8Lsk+q+3H5C4HYX3KAwEdWt8eBfSAqfs1i553EE4A2CQP rLn6EHnkvf4oZRc6bLEjnG7L2bIWHll4HZIM/qo5JckGN4T+ES/SdMfI/D3bVTi17K89 gtwm8OPZvAbQmD1WvqpeTzJjeiZ3XNsyvg/ZuNXjCW4fmIMachhmQpm3eOymcoShSLJG Jr67QiBwJedc1A7TltmDgkPK96O1PkS7tKqfSGRSqTP+9s/fnhUv49M+ajmywoP9KtgS QVUg== X-Gm-Message-State: AOAM531UYzBWJBakstFYPgrPWS9gE/E0vAn+dyl80FIJhZW8RbxtNiuy +PEdZ/ybZnQoTMLSkcC2Jyc= X-Google-Smtp-Source: ABdhPJzgRu6Dxq6wX80u7hnB2QqJRsKB0IqNqEbD/yuWzCIAk8W0hP1Ab/6hWwnkjtUc8EO4Bm9CDg== X-Received: by 2002:a17:90a:94c4:: with SMTP id j4mr1743152pjw.14.1618877347428; Mon, 19 Apr 2021 17:09:07 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:06 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Hannes Reinecke Subject: [PATCH 013/117] core: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:01 -0700 Message-Id: <20210420000845.25873-14-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/scsi/device_handler/scsi_dh_alua.c | 20 ++++---- drivers/scsi/hosts.c | 2 +- drivers/scsi/scsi.c | 8 +-- drivers/scsi/scsi_debugfs.c | 2 +- drivers/scsi/scsi_error.c | 44 ++++++++-------- drivers/scsi/scsi_ioctl.c | 12 ++--- drivers/scsi/scsi_lib.c | 59 ++++++++++++---------- drivers/scsi/scsi_logging.c | 8 +-- drivers/scsi/scsi_scan.c | 15 +++--- drivers/scsi/scsi_transport_spi.c | 8 +-- include/trace/events/scsi.h | 2 +- 11 files changed, 96 insertions(+), 84 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index efa8c0381476..d8269cdec399 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -517,7 +517,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) int len, k, off, bufflen = ALUA_RTPG_SIZE; int group_id_old, state_old, pref_old, valid_states_old; unsigned char *desc, *buff; - unsigned err, retval; + unsigned err; + union scsi_status retval; unsigned int tpg_desc_tbl_off; unsigned char orig_transition_tmo; unsigned long flags; @@ -543,9 +544,10 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) retry: err = 0; - retval = submit_rtpg(sdev, buff, bufflen, &sense_hdr, pg->flags); + retval.combined = submit_rtpg(sdev, buff, bufflen, &sense_hdr, + pg->flags); - if (retval) { + if (retval.combined) { /* * Some (broken) implementations have a habit of returning * an error during things like firmware update etc. @@ -558,14 +560,14 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) if ((pg->valid_states & ~TPGS_SUPPORT_OPTIMIZED) == 0) { sdev_printk(KERN_INFO, sdev, "%s: ignoring rtpg result %d\n", - ALUA_DH_NAME, retval); + ALUA_DH_NAME, retval.combined); kfree(buff); return SCSI_DH_OK; } if (!scsi_sense_valid(&sense_hdr)) { sdev_printk(KERN_INFO, sdev, "%s: rtpg failed, result %d\n", - ALUA_DH_NAME, retval); + ALUA_DH_NAME, retval.combined); kfree(buff); if (driver_byte(retval) == DRIVER_ERROR) return SCSI_DH_DEV_TEMP_BUSY; @@ -759,7 +761,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) */ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_port_group *pg) { - int retval; + union scsi_status retval; struct scsi_sense_hdr sense_hdr; if (!(pg->tpgs & TPGS_MODE_EXPLICIT)) { @@ -788,13 +790,13 @@ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_port_group *pg) ALUA_DH_NAME, pg->state); return SCSI_DH_NOSYS; } - retval = submit_stpg(sdev, pg->group_id, &sense_hdr); + retval.combined = submit_stpg(sdev, pg->group_id, &sense_hdr); - if (retval) { + if (retval.combined) { if (!scsi_sense_valid(&sense_hdr)) { sdev_printk(KERN_INFO, sdev, "%s: stpg failed, result %d", - ALUA_DH_NAME, retval); + ALUA_DH_NAME, retval.combined); if (driver_byte(retval) == DRIVER_ERROR) return SCSI_DH_DEV_TEMP_BUSY; } else { diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index b551e0ee2271..4c1e80a4a7c3 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -660,7 +660,7 @@ static bool complete_all_cmds_iter(struct request *rq, void *data, bool rsvd) enum host_status status = *(enum host_status *)data; scsi_dma_unmap(scmd); - scmd->result = 0; + scmd->status.combined = 0; set_host_byte(scmd, status); scmd->scsi_done(scmd); return true; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 4f71f2005be4..c6f3bbec8982 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -140,11 +140,11 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) if (unlikely(scsi_logging_level)) { level = SCSI_LOG_LEVEL(SCSI_LOG_MLCOMPLETE_SHIFT, SCSI_LOG_MLCOMPLETE_BITS); - if (((level > 0) && (cmd->result || disposition != SUCCESS)) || + if (((level > 0) && (cmd->status.combined || disposition != SUCCESS)) || (level > 1)) { scsi_print_result(cmd, "Done", disposition); scsi_print_command(cmd); - if (status_byte(cmd->result) == CHECK_CONDITION) + if (status_byte(cmd->status) == CHECK_CONDITION) scsi_print_sense(cmd); if (level > 3) scmd_printk(KERN_INFO, cmd, @@ -190,11 +190,11 @@ void scsi_finish_command(struct scsi_cmnd *cmd) * must have taken place. Make a note of this. */ if (SCSI_SENSE_VALID(cmd)) - cmd->result |= (DRIVER_SENSE << 24); + cmd->status.combined |= (DRIVER_SENSE << 24); SCSI_LOG_MLCOMPLETE(4, sdev_printk(KERN_INFO, sdev, "Notifying upper driver of completion " - "(result %x)\n", cmd->result)); + "(result %x)\n", cmd->status.combined)); good_bytes = scsi_bufflen(cmd); if (!blk_rq_is_passthrough(cmd->request)) { diff --git a/drivers/scsi/scsi_debugfs.c b/drivers/scsi/scsi_debugfs.c index c19ea7ab54cb..09679072b070 100644 --- a/drivers/scsi/scsi_debugfs.c +++ b/drivers/scsi/scsi_debugfs.c @@ -42,7 +42,7 @@ void scsi_show_rq(struct seq_file *m, struct request *rq) if (cdb) __scsi_format_command(buf, sizeof(buf), cdb, cmd->cmd_len); seq_printf(m, ", .cmd=%s, .retries=%d, .result = %#x, .flags=", buf, - cmd->retries, cmd->result); + cmd->retries, cmd->status.combined); scsi_flags_show(m, cmd->flags, scsi_cmd_flags, ARRAY_SIZE(scsi_cmd_flags)); seq_printf(m, ", .timeout=%d.%03d, allocated %d.%03d s ago", diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 54213c37806b..e54fbdc9206c 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -732,7 +732,7 @@ static enum scsi_disposition scsi_eh_completed_normally(struct scsi_cmnd *scmd) * first check the host byte, to see if there is anything in there * that would indicate what we need to do. */ - if (host_byte(scmd->result) == DID_RESET) { + if (host_byte(scmd->status) == DID_RESET) { /* * rats. we are already in the error handler, so we now * get to try and figure out what to do next. if the sense @@ -741,20 +741,20 @@ static enum scsi_disposition scsi_eh_completed_normally(struct scsi_cmnd *scmd) */ return scsi_check_sense(scmd); } - if (host_byte(scmd->result) != DID_OK) + if (host_byte(scmd->status) != DID_OK) return FAILED; /* * next, check the message byte. */ - if (msg_byte(scmd->result) != COMMAND_COMPLETE) + if (msg_byte(scmd->status) != COMMAND_COMPLETE) return FAILED; /* * now, check the status byte to see if this indicates * anything special. */ - switch (status_byte(scmd->result)) { + switch (status_byte(scmd->status)) { case GOOD: scsi_handle_queue_ramp_up(scmd->device); fallthrough; @@ -796,7 +796,7 @@ static void scsi_eh_done(struct scsi_cmnd *scmd) struct completion *eh_action; SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, - "%s result: %x\n", __func__, scmd->result)); + "%s result: %x\n", __func__, scmd->status.combined)); eh_action = scmd->device->host->eh_action; if (eh_action) @@ -989,7 +989,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, ses->cmnd = scmd->cmnd; ses->data_direction = scmd->sc_data_direction; ses->sdb = scmd->sdb; - ses->result = scmd->result; + ses->status = scmd->status; ses->resid_len = scmd->req.resid_len; ses->underflow = scmd->underflow; ses->prot_op = scmd->prot_op; @@ -1000,7 +1000,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, scmd->cmnd = ses->eh_cmnd; memset(scmd->cmnd, 0, BLK_MAX_CDB); memset(&scmd->sdb, 0, sizeof(scmd->sdb)); - scmd->result = 0; + scmd->status.combined = 0; scmd->req.resid_len = 0; if (sense_bytes) { @@ -1053,7 +1053,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) scmd->cmnd = ses->cmnd; scmd->sc_data_direction = ses->data_direction; scmd->sdb = ses->sdb; - scmd->result = ses->result; + scmd->status = ses->status; scmd->req.resid_len = ses->resid_len; scmd->underflow = ses->underflow; scmd->prot_op = ses->prot_op; @@ -1261,7 +1261,7 @@ int scsi_eh_get_sense(struct list_head *work_q, current->comm)); break; } - if (status_byte(scmd->result) != CHECK_CONDITION) + if (status_byte(scmd->status) != CHECK_CONDITION) /* * don't request sense if there's no check condition * status because the error we're processing isn't one @@ -1278,7 +1278,7 @@ int scsi_eh_get_sense(struct list_head *work_q, continue; SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, - "sense requested, result %x\n", scmd->result)); + "sense requested, result %x\n", scmd->status.combined)); SCSI_LOG_ERROR_RECOVERY(3, scsi_print_sense(scmd)); rtn = scsi_decide_disposition(scmd); @@ -1759,7 +1759,7 @@ static void scsi_eh_offline_sdevs(struct list_head *work_q, */ int scsi_noretry_cmd(struct scsi_cmnd *scmd) { - switch (host_byte(scmd->result)) { + switch (host_byte(scmd->status)) { case DID_OK: break; case DID_TIME_OUT: @@ -1769,8 +1769,8 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd) case DID_PARITY: return (scmd->request->cmd_flags & REQ_FAILFAST_DEV); case DID_ERROR: - if (msg_byte(scmd->result) == COMMAND_COMPLETE && - status_byte(scmd->result) == RESERVATION_CONFLICT) + if (msg_byte(scmd->status) == COMMAND_COMPLETE && + status_byte(scmd->status) == RESERVATION_CONFLICT) return 0; fallthrough; case DID_SOFT_ERROR: @@ -1779,7 +1779,7 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd) break; } - if (status_byte(scmd->result) != CHECK_CONDITION) + if (status_byte(scmd->status) != CHECK_CONDITION) return 0; check_type: @@ -1826,14 +1826,14 @@ enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) * first check the host byte, to see if there is anything in there * that would indicate what we need to do. */ - switch (host_byte(scmd->result)) { + switch (host_byte(scmd->status)) { case DID_PASSTHROUGH: /* * no matter what, pass this through to the upper layer. * nuke this special code so that it looks like we are saying * did_ok. */ - scmd->result &= 0xff00ffff; + set_host_byte(scmd, DID_OK); return SUCCESS; case DID_OK: /* @@ -1888,8 +1888,8 @@ enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) */ return SUCCESS; case DID_ERROR: - if (msg_byte(scmd->result) == COMMAND_COMPLETE && - status_byte(scmd->result) == RESERVATION_CONFLICT) + if (msg_byte(scmd->status) == COMMAND_COMPLETE && + status_byte(scmd->status) == RESERVATION_CONFLICT) /* * execute reservation conflict processing code * lower down @@ -1920,13 +1920,13 @@ enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) /* * next, check the message byte. */ - if (msg_byte(scmd->result) != COMMAND_COMPLETE) + if (msg_byte(scmd->status) != COMMAND_COMPLETE) return FAILED; /* * check the status byte to see if this indicates anything special. */ - switch (status_byte(scmd->result)) { + switch (status_byte(scmd->status)) { case QUEUE_FULL: scsi_handle_queue_full(scmd->device); /* @@ -2144,8 +2144,8 @@ void scsi_eh_flush_done_q(struct list_head *done_q) * scsi_eh_get_sense), scmd->result is already * set, do not set DRIVER_TIMEOUT. */ - if (!scmd->result) - scmd->result |= (DRIVER_TIMEOUT << 24); + if (!scmd->status.combined) + scmd->status.combined |= (DRIVER_TIMEOUT << 24); SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, "%s: flush finish cmd\n", diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 14872c9dc78c..fee0e72917b3 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -89,17 +89,17 @@ static int ioctl_probe(struct Scsi_Host *host, void __user *buffer) static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, int timeout, int retries) { - int result; + union scsi_status result; struct scsi_sense_hdr sshdr; SCSI_LOG_IOCTL(1, sdev_printk(KERN_INFO, sdev, "Trying ioctl with scsi command %d\n", *cmd)); - result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, + result.combined = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, &sshdr, timeout, retries, NULL); SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev, - "Ioctl returned 0x%x\n", result)); + "Ioctl returned 0x%x\n", result.combined)); if (driver_byte(result) == DRIVER_SENSE && scsi_sense_valid(&sshdr)) { @@ -121,14 +121,14 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, case UNIT_ATTENTION: if (sdev->removable) { sdev->changed = 1; - result = 0; /* This is no longer considered an error */ + result.combined = 0; /* This is no longer considered an error */ break; } fallthrough; /* for non-removable media */ default: sdev_printk(KERN_INFO, sdev, "ioctl_internal_command return code = %x\n", - result); + result.combined); scsi_print_sense_hdr(sdev, NULL, &sshdr); break; } @@ -136,7 +136,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev, "IOCTL Releasing command\n")); - return result; + return result.combined; } int scsi_set_medium_removal(struct scsi_device *sdev, char state) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a979a9457dff..882e04c8be69 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -196,7 +196,7 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, bool unbusy) * lock such that the kblockd_schedule_work() call happens * before blk_cleanup_queue() finishes. */ - cmd->result = 0; + cmd->status.combined = 0; blk_mq_requeue_request(cmd->request, true); } @@ -286,7 +286,7 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, memcpy(sense, rq->sense, SCSI_SENSE_BUFFERSIZE); if (sshdr) scsi_normalize_sense(rq->sense, rq->sense_len, sshdr); - ret = rq->result; + ret = rq->status.combined; out: blk_put_request(req); @@ -616,9 +616,10 @@ static bool scsi_end_request(struct request *req, blk_status_t error, * @result: scsi error code * * Translate a SCSI result code into a blk_status_t value. May reset the host - * byte of @cmd->result. + * byte of @cmd->status. */ -static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result) +static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, + union scsi_status result) { switch (host_byte(result)) { case DID_OK: @@ -627,7 +628,8 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result) * to handle the case when a SCSI LLD sets result to * DRIVER_SENSE << 24 without setting SAM_STAT_CHECK_CONDITION. */ - if (scsi_status_is_good(result) && (result & ~0xff) == 0) + if (scsi_status_is_good(result) && + (result.combined & ~0xff) == 0) return BLK_STS_OK; return BLK_STS_IOERR; case DID_TRANSPORT_FAILFAST: @@ -676,7 +678,8 @@ static bool scsi_cmd_runtime_exceeced(struct scsi_cmnd *cmd) } /* Helper for scsi_io_completion() when special action required. */ -static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result) +static void scsi_io_completion_action(struct scsi_cmnd *cmd, + union scsi_status result) { struct request_queue *q = cmd->device->request_queue; struct request *req = cmd->request; @@ -844,12 +847,12 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result) } /* - * Helper for scsi_io_completion() when cmd->result is non-zero. Returns a + * Helper for scsi_io_completion() when cmd->status is non-zero. Returns a * new result that may suppress further error checking. Also modifies * *blk_statp in some cases. */ -static int scsi_io_completion_nz_result(struct scsi_cmnd *cmd, int result, - blk_status_t *blk_statp) +static union scsi_status scsi_io_completion_nz_result(struct scsi_cmnd *cmd, + union scsi_status result, blk_status_t *blk_statp) { bool sense_valid; bool sense_current = true; /* false implies "deferred sense" */ @@ -882,7 +885,7 @@ static int scsi_io_completion_nz_result(struct scsi_cmnd *cmd, int result, /* * Recovered errors need reporting, but they're always treated as * success, so fiddle the result code here. For passthrough requests - * we already took a copy of the original into sreq->result which + * we already took a copy of the original into sreq->status which * is what gets returned to the user */ if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) { @@ -898,7 +901,7 @@ static int scsi_io_completion_nz_result(struct scsi_cmnd *cmd, int result, do_print = false; if (do_print) scsi_print_sense(cmd); - result = 0; + result.combined = 0; /* for passthrough, *blk_statp may be set */ *blk_statp = BLK_STS_OK; } @@ -910,7 +913,7 @@ static int scsi_io_completion_nz_result(struct scsi_cmnd *cmd, int result, * intermediate statuses (both obsolete in SAM-4) as good. */ if (status_byte(result) && scsi_status_is_good(result)) { - result = 0; + result.combined = 0; *blk_statp = BLK_STS_OK; } return result; @@ -940,19 +943,20 @@ static int scsi_io_completion_nz_result(struct scsi_cmnd *cmd, int result, */ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) { - int result = cmd->result; + union scsi_status result = cmd->status; struct request_queue *q = cmd->device->request_queue; struct request *req = cmd->request; blk_status_t blk_stat = BLK_STS_OK; - if (unlikely(result)) /* a nz result may or may not be an error */ + /* a non-zero result may or may not be an error */ + if (unlikely(result.combined)) result = scsi_io_completion_nz_result(cmd, result, &blk_stat); if (unlikely(blk_rq_is_passthrough(req))) { /* * scsi_result_to_blk_status may have reset the host_byte */ - scsi_req(req)->result = cmd->result; + scsi_req(req)->status = cmd->status; } /* @@ -984,7 +988,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) * If there had been no error, but we have leftover bytes in the * requeues just queue the command up again. */ - if (likely(result == 0)) + if (likely(result.combined == 0)) scsi_io_completion_reprep(cmd, q); else scsi_io_completion_action(cmd, result); @@ -1446,7 +1450,7 @@ static void scsi_complete(struct request *rq) INIT_LIST_HEAD(&cmd->eh_entry); atomic_inc(&cmd->device->iodone_cnt); - if (cmd->result) + if (cmd->status.combined) atomic_inc(&cmd->device->ioerr_cnt); disposition = scsi_decide_disposition(cmd); @@ -1490,7 +1494,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd) /* in SDEV_DEL we error all commands. DID_NO_CONNECT * returns an immediate error upwards, and signals * that the device is no longer present */ - cmd->result = DID_NO_CONNECT << 16; + cmd->status.combined = DID_NO_CONNECT << 16; goto done; } @@ -1524,12 +1528,12 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd) "queuecommand : command too long. " "cdb_size=%d host->max_cmd_len=%d\n", cmd->cmd_len, cmd->device->host->max_cmd_len)); - cmd->result = (DID_ABORT << 16); + cmd->status.combined = (DID_ABORT << 16); goto done; } if (unlikely(host->shost_state == SHOST_DEL)) { - cmd->result = (DID_NO_CONNECT << 16); + cmd->status.combined = (DID_NO_CONNECT << 16); goto done; } @@ -1742,15 +1746,15 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, ret = BLK_STS_DEV_RESOURCE; break; case BLK_STS_AGAIN: - scsi_req(req)->result = DID_BUS_BUSY << 16; + scsi_req(req)->status.combined = DID_BUS_BUSY << 16; if (req->rq_flags & RQF_DONTPREP) scsi_mq_uninit_cmd(cmd); break; default: if (unlikely(!scsi_device_online(sdev))) - scsi_req(req)->result = DID_NO_CONNECT << 16; + scsi_req(req)->status.combined = DID_NO_CONNECT << 16; else - scsi_req(req)->result = DID_ERROR << 16; + scsi_req(req)->status.combined = DID_ERROR << 16; /* * Make sure to release all allocated resources when * we hit an error, as we will never see this command @@ -2147,7 +2151,8 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result, retry_count = retries; + union scsi_status result; + int retry_count = retries; struct scsi_sense_hdr my_sshdr; memset(data, 0, sizeof(*data)); @@ -2182,8 +2187,8 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, memset(buffer, 0, len); - result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, - sshdr, timeout, retries, NULL); + result.combined = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, + len, sshdr, timeout, retries, NULL); /* This code looks awful: what it's doing is making sure an * ILLEGAL REQUEST sense return identifies the actual command @@ -2235,7 +2240,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, goto retry; } - return result; + return result.combined; } EXPORT_SYMBOL(scsi_mode_sense); diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c index 8ea44c6595ef..5c994ba1fad8 100644 --- a/drivers/scsi/scsi_logging.c +++ b/drivers/scsi/scsi_logging.c @@ -384,8 +384,8 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg, char *logbuf; size_t off, logbuf_len; const char *mlret_string = scsi_mlreturn_string(disposition); - const char *hb_string = scsi_hostbyte_string(cmd->result); - const char *db_string = scsi_driverbyte_string(cmd->result); + const char *hb_string = scsi_hostbyte_string(cmd->status.combined); + const char *db_string = scsi_driverbyte_string(cmd->status.combined); unsigned long cmd_age = (jiffies - cmd->jiffies_at_alloc) / HZ; logbuf = scsi_log_reserve_buffer(&logbuf_len); @@ -422,7 +422,7 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg, "hostbyte=%s ", hb_string); else off += scnprintf(logbuf + off, logbuf_len - off, - "hostbyte=0x%02x ", host_byte(cmd->result)); + "hostbyte=0x%02x ", host_byte(cmd->status)); if (WARN_ON(off >= logbuf_len)) goto out_printk; @@ -432,7 +432,7 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg, else off += scnprintf(logbuf + off, logbuf_len - off, "driverbyte=0x%02x ", - driver_byte(cmd->result)); + driver_byte(cmd->status)); off += scnprintf(logbuf + off, logbuf_len - off, "cmd_age=%lus", cmd_age); diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 9f1b7f3c650a..43346f7dedd1 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -580,7 +580,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, unsigned char scsi_cmd[MAX_COMMAND_SIZE]; int first_inquiry_len, try_inquiry_len, next_inquiry_len; int response_len = 0; - int pass, count, result; + int pass, count; + union scsi_status result; struct scsi_sense_hdr sshdr; *bflags = 0; @@ -607,16 +608,18 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, memset(inq_result, 0, try_inquiry_len); - result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, + result.combined = + scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, inq_result, try_inquiry_len, &sshdr, HZ / 2 + HZ * scsi_inq_timeout, 3, &resid); SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev, "scsi scan: INQUIRY %s with code 0x%x\n", - result ? "failed" : "successful", result)); + result.combined ? "failed" : "successful", + result.combined)); - if (result) { + if (result.combined) { /* * not-ready to ready transition [asc/ascq=0x28/0x0] * or power-on, reset [asc/ascq=0x29/0x0], continue. @@ -643,7 +646,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, break; } - if (result == 0) { + if (result.combined == 0) { scsi_sanitize_inquiry_string(&inq_result[8], 8); scsi_sanitize_inquiry_string(&inq_result[16], 16); scsi_sanitize_inquiry_string(&inq_result[32], 4); @@ -695,7 +698,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, /* If the last transfer attempt got an error, assume the * peripheral doesn't exist or is dead. */ - if (result) + if (result.combined) return -EIO; /* Don't report any more data than the device says is valid */ diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index c37dd15d16d2..8788066275df 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -109,7 +109,8 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, void *buffer, unsigned bufflen, struct scsi_sense_hdr *sshdr) { - int i, result; + int i; + union scsi_status result; unsigned char sense[SCSI_SENSE_BUFFERSIZE]; struct scsi_sense_hdr sshdr_tmp; @@ -121,7 +122,8 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, * The purpose of the RQF_PM flag below is to bypass the * SDEV_QUIESCE state. */ - result = scsi_execute(sdev, cmd, dir, buffer, bufflen, sense, + result.combined = + scsi_execute(sdev, cmd, dir, buffer, bufflen, sense, sshdr, DV_TIMEOUT, /* retries */ 1, REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | @@ -131,7 +133,7 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, sshdr->sense_key != UNIT_ATTENTION) break; } - return result; + return result.combined; } static struct { diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h index f624969a4f14..13da567f5b72 100644 --- a/include/trace/events/scsi.h +++ b/include/trace/events/scsi.h @@ -309,7 +309,7 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template, __entry->channel = cmd->device->channel; __entry->id = cmd->device->id; __entry->lun = cmd->device->lun; - __entry->result = cmd->result; + __entry->result = cmd->status.combined; __entry->opcode = cmd->cmnd[0]; __entry->cmd_len = cmd->cmd_len; __entry->data_sglen = scsi_sg_count(cmd); From patchwork Tue Apr 20 00:07:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5343AC433B4 for ; Tue, 20 Apr 2021 00:09:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 27F1C613AA for ; Tue, 20 Apr 2021 00:09:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233146AbhDTAJt (ORCPT ); Mon, 19 Apr 2021 20:09:49 -0400 Received: from mail-pj1-f41.google.com ([209.85.216.41]:51854 "EHLO mail-pj1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232960AbhDTAJm (ORCPT ); Mon, 19 Apr 2021 20:09:42 -0400 Received: by mail-pj1-f41.google.com with SMTP id lt13so10009476pjb.1 for ; Mon, 19 Apr 2021 17:09:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y8BoWzVj3N4mDUGM68HE8h8bJse46BESIDJN3iIgoBk=; b=WohhC//IT/8UBaH3r6moHzrGLtzm8Lw2cUQfeZiClgUHPYee2CT28O3Kdph3Qy6hmg GgTWPnSQohpOnG7vVTklOFjvoJfiNH2ed/K/4p3uIHRm7EKoIRh4XZ8b571h9RGgm734 mFPC0pAJRNUJH7f9Is8T4XdJj6oFczZ62/PORmhlz0APb/tM2pY3PuJTVyqvgf2n3hwP oKVkW9u5HeeMGrFjmFR6m754Ft2wG4GDg+hOzLa46RJfLNKWNCPZuVg/iYXbjsMOf2oM gFjL6UbyQrhk3eAg5AqGOT0d/Kx7+PrWVjwhWcQDZSuozGeHyFvVCiBFbspHx9xHFxD2 +EHg== X-Gm-Message-State: AOAM53210T1oyrL1YuheFbtXrQF8yXUFRwkPQb4aDKlUvoftKeavNjHH 3DsToSe+iqhahSw7hzpuJRFV9Z4RQ90= X-Google-Smtp-Source: ABdhPJxdjI0tgMDUTdwjnzo+bru/gHMC+9IfGCfnMWuAY0L3Pi80czmivmKOyqEDp2Tfhd8js2b9hg== X-Received: by 2002:a17:90b:915:: with SMTP id bo21mr1766665pjb.118.1618877352030; Mon, 19 Apr 2021 17:09:12 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:11 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , =?utf-8?q?Kai_M=C3=A4kisara?= Subject: [PATCH 017/117] st: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:05 -0700 Message-Id: <20210420000845.25873-18-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Kai Mäkisara Signed-off-by: Bart Van Assche --- drivers/scsi/st.c | 23 ++++++++++++----------- drivers/scsi/st.h | 5 +++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 9ca536aae784..3deea1f7c8b9 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -360,13 +360,13 @@ static void st_analyze_sense(struct st_request *SRpnt, struct st_cmdstatus *s) /* Convert the result to success code */ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) { - int result = SRpnt->result; + union scsi_status result = SRpnt->status; u8 scode; DEB(const char *stp;) char *name = tape_name(STp); struct st_cmdstatus *cmdstatp; - if (!result) + if (!result.combined) return 0; cmdstatp = &STp->buffer->cmdstat; @@ -380,7 +380,7 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) DEB( if (debugging) { st_printk(ST_DEB_MSG, STp, - "Error: %x, cmd: %x %x %x %x %x %x\n", result, + "Error: %x, cmd: %x %x %x %x %x %x\n", result.combined, SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2], SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]); if (cmdstatp->have_sense) @@ -390,8 +390,9 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) if (!debugging) { /* Abnormal conditions for tape */ if (!cmdstatp->have_sense) st_printk(KERN_WARNING, STp, - "Error %x (driver bt 0x%x, host bt 0x%x).\n", - result, driver_byte(result), host_byte(result)); + "Error %x (driver bt 0x%x, host bt 0x%x).\n", + result.combined, driver_byte(result), + host_byte(result)); else if (cmdstatp->have_sense && scode != NO_SENSE && scode != RECOVERED_ERROR && @@ -484,7 +485,7 @@ static void st_do_stats(struct scsi_tape *STp, struct request *req) atomic64_add(ktime_to_ns(now), &STp->stats->tot_write_time); atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time); atomic64_inc(&STp->stats->write_cnt); - if (scsi_req(req)->result) { + if (scsi_req(req)->status.combined) { atomic64_add(atomic_read(&STp->stats->last_write_size) - STp->buffer->cmdstat.residual, &STp->stats->write_byte_cnt); @@ -498,7 +499,7 @@ static void st_do_stats(struct scsi_tape *STp, struct request *req) atomic64_add(ktime_to_ns(now), &STp->stats->tot_read_time); atomic64_add(ktime_to_ns(now), &STp->stats->tot_io_time); atomic64_inc(&STp->stats->read_cnt); - if (scsi_req(req)->result) { + if (scsi_req(req)->status.combined) { atomic64_add(atomic_read(&STp->stats->last_read_size) - STp->buffer->cmdstat.residual, &STp->stats->read_byte_cnt); @@ -522,7 +523,7 @@ static void st_scsi_execute_end(struct request *req, blk_status_t status) struct scsi_tape *STp = SRpnt->stp; struct bio *tmp; - STp->buffer->cmdstat.midlevel_result = SRpnt->result = rq->result; + STp->buffer->cmdstat.midlevel_status = SRpnt->status = rq->status; STp->buffer->cmdstat.residual = rq->resid_len; st_do_stats(STp, req); @@ -718,7 +719,7 @@ static int write_behind_check(struct scsi_tape * STp) DEB(if (debugging && retval) st_printk(ST_DEB_MSG, STp, "Async write error %x, return value %d.\n", - STbuffer->cmdstat.midlevel_result, retval);) /* end DEB */ + STbuffer->cmdstat.midlevel_status.combined, retval);) /* end DEB */ return retval; } @@ -752,7 +753,7 @@ static int cross_eof(struct scsi_tape * STp, int forward) st_release_request(SRpnt); SRpnt = NULL; - if ((STp->buffer)->cmdstat.midlevel_result != 0) + if ((STp->buffer)->cmdstat.midlevel_status.combined != 0) st_printk(KERN_ERR, STp, "Stepping over filemark %s failed.\n", forward ? "forward" : "backward"); @@ -1118,7 +1119,7 @@ static int check_tape(struct scsi_tape *STp, struct file *filp) goto err_out; } - if (!SRpnt->result && !STp->buffer->cmdstat.have_sense) { + if (!SRpnt->status.combined && !STp->buffer->cmdstat.have_sense) { STp->max_block = ((STp->buffer)->b_data[1] << 16) | ((STp->buffer)->b_data[2] << 8) | (STp->buffer)->b_data[3]; STp->min_block = ((STp->buffer)->b_data[4] << 8) | diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h index 95d2e7a7988d..2021a5a9f65b 100644 --- a/drivers/scsi/st.h +++ b/drivers/scsi/st.h @@ -7,10 +7,11 @@ #include #include #include +#include /* Descriptor for analyzed sense data */ struct st_cmdstatus { - int midlevel_result; + union scsi_status midlevel_status; struct scsi_sense_hdr sense_hdr; int have_sense; int residual; @@ -27,7 +28,7 @@ struct scsi_tape; struct st_request { unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char sense[SCSI_SENSE_BUFFERSIZE]; - int result; + union scsi_status status; struct scsi_tape *stp; struct completion *waiting; struct bio *bio; From patchwork Tue Apr 20 00:07:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424250 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1576C43460 for ; Tue, 20 Apr 2021 00:09:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C7B76109E for ; Tue, 20 Apr 2021 00:09:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233195AbhDTAJv (ORCPT ); Mon, 19 Apr 2021 20:09:51 -0400 Received: from mail-pj1-f54.google.com ([209.85.216.54]:46809 "EHLO mail-pj1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232905AbhDTAJn (ORCPT ); Mon, 19 Apr 2021 20:09:43 -0400 Received: by mail-pj1-f54.google.com with SMTP id u14-20020a17090a1f0eb029014e38011b09so14624504pja.5 for ; Mon, 19 Apr 2021 17:09:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WMFt/Bzpg9Y/PdeyDOLVAMAou8mYJ4Jwx4g5pKqWxBE=; b=IicTnXjBI+KepoIvIH+qi7TqqshgNviEDXRf82s1wJ5LaS+6+bFv4f16HykvzbLRFz R8uvmF8gSHMI92BRatkLN5NXza1Ko/T392hNQrjVn1JHgEM2FixJG/asy9kX/rgn883z eoMC4/AME5EOTdRi1zGPgGDkktd8IJLu77vXmsRdQ9zj6TzKY95xkIhgwNKbBnDf7AIf dJTgSgFPXyDgRvF33Tw677e8HtmmS3hAkIQm0j9FTLVTTEmkOQlQGC2914MtTm/4ESr1 exDRxB8vwagwHTfiHezvfI9ZuEXKiQis3NKNSfuIehD8dgL6EJusuwn+dvtiHjd9HVyO /PDQ== X-Gm-Message-State: AOAM533b0hrDpmz3jNV4qT9JVpL75GRTjkUQLMLzFu9DNDptLTn3TJuT XhgX9L6ZNIDU3NzmJXipqR4= X-Google-Smtp-Source: ABdhPJz9Y25l3WmVhpNgqjdVv83zg74sxJHZpTYuQXqTOB085i9OKzy0gTbjCje7rMpIjw8ilcnyjA== X-Received: by 2002:a17:902:59d4:b029:ea:bbc5:c775 with SMTP id d20-20020a17090259d4b02900eabbc5c775mr25978431plj.11.1618877353107; Mon, 19 Apr 2021 17:09:13 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:12 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Doug Gilbert Subject: [PATCH 018/117] sg: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:06 -0700 Message-Id: <20210420000845.25873-19-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Doug Gilbert Signed-off-by: Bart Van Assche --- drivers/scsi/sg.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 737cea9d908e..82e79042de7b 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1344,7 +1344,8 @@ sg_rq_end_io(struct request *rq, blk_status_t status) unsigned long iflags; unsigned int ms; char *sense; - int result, resid, done = 1; + union scsi_status result; + int resid, done = 1; if (WARN_ON(srp->done != 0)) return; @@ -1358,20 +1359,20 @@ sg_rq_end_io(struct request *rq, blk_status_t status) pr_info("%s: device detaching\n", __func__); sense = req->sense; - result = req->result; + result = req->status; resid = req->resid_len; SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sdp, "sg_cmd_done: pack_id=%d, res=0x%x\n", - srp->header.pack_id, result)); + srp->header.pack_id, result.combined)); srp->header.resid = resid; ms = jiffies_to_msecs(jiffies); srp->header.duration = (ms > srp->header.duration) ? (ms - srp->header.duration) : 0; - if (0 != result) { + if (0 != result.combined) { struct scsi_sense_hdr sshdr; - srp->header.status = 0xff & result; + srp->header.status = 0xff & result.combined; srp->header.masked_status = status_byte(result); srp->header.msg_status = msg_byte(result); srp->header.host_status = host_byte(result); From patchwork Tue Apr 20 00:07:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7D8EC433B4 for ; Tue, 20 Apr 2021 00:09:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F6976109E for ; Tue, 20 Apr 2021 00:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233020AbhDTAJz (ORCPT ); Mon, 19 Apr 2021 20:09:55 -0400 Received: from mail-pj1-f42.google.com ([209.85.216.42]:40779 "EHLO mail-pj1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233002AbhDTAJq (ORCPT ); Mon, 19 Apr 2021 20:09:46 -0400 Received: by mail-pj1-f42.google.com with SMTP id g1-20020a17090adac1b0290150d07f9402so791163pjx.5 for ; Mon, 19 Apr 2021 17:09:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k9PGR7gcL0h9CQwt86u+nPPbbmNhrdNsOaEgLLiFlWI=; b=mVfZSkm8YsVYnGFSI4fvllTyXhkGYa3DK470jhJmPmPG6GNJ8Tm6kpiyFFbn1tYIRk 5TzHUM65U8VgD+ofFTmT3LwkILKTN+ZdVz7NbvsYCbfIakKez/hWIijFCQh7d1+nPzEj SNkrXX+EKw6a8qbfv4Su5rdZ8l9hgKckcQjot5eKmeYZR2BMjEHGSux1SP+xxlqOLwW7 zPUZEKmDRRpHOC4Zgoexsh/Guub9JVe0gqYHKaRXxTLCbtwyttjrUHsDzLc83P2LPUdn 2nKp6SNuYg7lB6/8rvaTaRyNa9PcmzstDJNuJmeKQn45+2FZMb8yvfp94kDQiOtVw1/d NNag== X-Gm-Message-State: AOAM531maLzLAAz5GLbGtx8A8aO9HrQ3w3Ue0rq9gtn5HB8KiVewzjGe ik4JFkzfs+Cuw3UPU5V+Hls= X-Google-Smtp-Source: ABdhPJzJZ48icVj8FfreV6TM2/Bj0Efv8YYfGgk3EuSF0RXp+k5IoU+83YCTwHURzlUbxDkshzkdbQ== X-Received: by 2002:a17:902:20a:b029:eb:873d:d73d with SMTP id 10-20020a170902020ab02900eb873dd73dmr23358584plc.54.1618877355627; Mon, 19 Apr 2021 17:09:15 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:15 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 020/117] 53c700: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:08 -0700 Message-Id: <20210420000845.25873-21-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Signed-off-by: Bart Van Assche --- drivers/scsi/53c700.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index ab42feab233f..dba27011eeee 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -634,7 +634,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) - 1); SCp->host_scribble = NULL; - SCp->result = result; + SCp->status.combined = result; SCp->scsi_done(SCp); } else { printk(KERN_ERR "53c700: SCSI DONE HAS NULL SCp\n"); @@ -1571,7 +1571,7 @@ NCR_700_intr(int irq, void *dev_id) * command again otherwise we'll * deadlock on the * hostdata->state_lock */ - SCp->result = DID_RESET << 16; + SCp->status.combined = DID_RESET << 16; SCp->scsi_done(SCp); } mdelay(25); From patchwork Tue Apr 20 00:07:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A9FFC433ED for ; Tue, 20 Apr 2021 00:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DFD3613AA for ; Tue, 20 Apr 2021 00:09:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233312AbhDTAJ6 (ORCPT ); Mon, 19 Apr 2021 20:09:58 -0400 Received: from mail-pj1-f47.google.com ([209.85.216.47]:39898 "EHLO mail-pj1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233087AbhDTAJs (ORCPT ); Mon, 19 Apr 2021 20:09:48 -0400 Received: by mail-pj1-f47.google.com with SMTP id ot17-20020a17090b3b51b0290109c9ac3c34so21334826pjb.4 for ; Mon, 19 Apr 2021 17:09:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XwMsKBytId2WdL1rtUGAMNeg9/dFS0GCUaKXfvLDvYw=; b=OssqBIzggOBGleJKcb1CDh0yYlW4dsiZOv8g9VR+S2oINxRToSVMWJ4c6dEEBwBVJt 8rA+a1ztPKJHSTcN6F4rvfyg1mPX+DAif/SEGhxhoKwN+9YqIgJfIpG8hWc1zbN78JuB j9lolNyvOW/bQTd1Gu+gnJzlApHZ62Bu2rkhrOMiZz8ZSZMlFGRhDi779/j/kL50O3oa v6h+Fzh0CpsdLsKTji3jpeCAsYzOVfhJMlkXRJUCZQ7j3lSAvKJOV0u8QpMx/uZtBqsn 3qcdGLQi7wfT0JAHRWev+pWOmC+hqIAGfn9zl2Zqdm8T0LjOp2Mbm9pkqq11hn/mFlpB B4NQ== X-Gm-Message-State: AOAM531jMCrw6mpX5qxw1s6hk+OPIw73jtld8cjx+38ZxzaJp3leNNTV mMO+g4JqeO/m2ZSTqJUwDJ4= X-Google-Smtp-Source: ABdhPJxei1dh8rvN6XhYS8wCOPPmL9szIngIrIAxClUACtDGxdZVNAFzh803r0fDvmFbJL6PoQ/hpA== X-Received: by 2002:a17:90a:cd06:: with SMTP id d6mr1837817pju.91.1618877357850; Mon, 19 Apr 2021 17:09:17 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:17 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Finn Thain Subject: [PATCH 022/117] NCR5380: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:10 -0700 Message-Id: <20210420000845.25873-23-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Finn Thain Signed-off-by: Bart Van Assche --- drivers/scsi/NCR5380.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 2ddbcaa667d1..5efe0e82c195 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -538,7 +538,7 @@ static void complete_cmd(struct Scsi_Host *instance, if (hostdata->sensing == cmd) { /* Autosense processing ends here */ - if (status_byte(cmd->result) != GOOD) { + if (status_byte(cmd->status) != GOOD) { scsi_eh_restore_cmnd(cmd, &hostdata->ses); } else { scsi_eh_restore_cmnd(cmd, &hostdata->ses); @@ -572,13 +572,13 @@ static int NCR5380_queue_command(struct Scsi_Host *instance, case WRITE_6: case WRITE_10: shost_printk(KERN_DEBUG, instance, "WRITE attempted with NDEBUG_NO_WRITE set\n"); - cmd->result = (DID_ERROR << 16); + cmd->status.combined = (DID_ERROR << 16); cmd->scsi_done(cmd); return 0; } #endif /* (NDEBUG & NDEBUG_NO_WRITE) */ - cmd->result = 0; + cmd->status.combined = 0; spin_lock_irqsave(&hostdata->lock, flags); @@ -961,7 +961,7 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) * SELECT interrupt will be disabled. * * If failed (no target) : cmd->scsi_done() will be called, and the - * cmd->result host byte set to DID_BAD_TARGET. + * cmd->status host byte set to DID_BAD_TARGET. */ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) @@ -1154,7 +1154,7 @@ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) if (!hostdata->selecting) return false; - cmd->result = DID_BAD_TARGET << 16; + cmd->status.combined = DID_BAD_TARGET << 16; complete_cmd(instance, cmd); dsprintk(NDEBUG_SELECTION, instance, "target did not respond within 250ms\n"); @@ -1203,7 +1203,7 @@ static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) NCR5380_transfer_pio(instance, &phase, &len, &data, 0); if (len) { NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; complete_cmd(instance, cmd); dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n"); ret = false; @@ -1743,7 +1743,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) shost_printk(KERN_DEBUG, instance, "NDEBUG_NO_DATAOUT set, attempted DATAOUT aborted\n"); sink = 1; do_abort(instance, 0); - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; complete_cmd(instance, cmd); hostdata->connected = NULL; hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); @@ -1826,9 +1826,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) hostdata->connected = NULL; hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); - cmd->result &= ~0xffff; - cmd->result |= cmd->SCp.Status; - cmd->result |= cmd->SCp.Message << 8; + cmd->status.combined &= ~0xffff; + cmd->status.combined |= cmd->SCp.Status; + cmd->status.combined |= cmd->SCp.Message << 8; set_resid_from_SCp(cmd); @@ -1980,7 +1980,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) if (msgout == ABORT) { hostdata->connected = NULL; hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; complete_cmd(instance, cmd); return; } @@ -2261,7 +2261,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) if (list_del_cmd(&hostdata->unissued, cmd)) { dsprintk(NDEBUG_ABORT, instance, "abort: removed %p from issue queue\n", cmd); - cmd->result = DID_ABORT << 16; + cmd->status.combined = DID_ABORT << 16; cmd->scsi_done(cmd); /* No tag or busy flag to worry about */ goto out; } @@ -2270,7 +2270,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p == selecting\n", cmd); hostdata->selecting = NULL; - cmd->result = DID_ABORT << 16; + cmd->status.combined = DID_ABORT << 16; complete_cmd(instance, cmd); goto out; } @@ -2341,7 +2341,7 @@ static void bus_reset_cleanup(struct Scsi_Host *instance) */ if (hostdata->selecting) { - hostdata->selecting->result = DID_RESET << 16; + hostdata->selecting->status.combined = DID_RESET << 16; complete_cmd(instance, hostdata->selecting); hostdata->selecting = NULL; } @@ -2399,7 +2399,7 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd) list_for_each_entry(ncmd, &hostdata->unissued, list) { struct scsi_cmnd *scmd = NCR5380_to_scmd(ncmd); - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; scmd->scsi_done(scmd); } INIT_LIST_HEAD(&hostdata->unissued); From patchwork Tue Apr 20 00:07:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61819C433ED for ; Tue, 20 Apr 2021 00:09:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 45841613B4 for ; Tue, 20 Apr 2021 00:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233501AbhDTAKF (ORCPT ); Mon, 19 Apr 2021 20:10:05 -0400 Received: from mail-pg1-f179.google.com ([209.85.215.179]:39427 "EHLO mail-pg1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233187AbhDTAJv (ORCPT ); Mon, 19 Apr 2021 20:09:51 -0400 Received: by mail-pg1-f179.google.com with SMTP id s22so4290451pgk.6 for ; Mon, 19 Apr 2021 17:09:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BZAnFHlYsbrhxzAh/ucwqA/x5Qkp3UvUFH9IDWwPMto=; b=sOJFzB5mRsHMLehFcAG+qdr06D633yZNFXfbFUe+cYDL8d7XPoPZ1DC2L1LyzIdJk7 Y/Z3TqLiX45YSxtCRYifigZAc/1tGLmdnNqD4+U2doXfJuA7ux2fcg63BLsprz4cPSVC HTYKT1yh12UayepdTNjjBbmpBi6KaNHBWttL2uw4EgY+JWUFInd9844i2nnKb1h0AuxP JkKjNq776Xo6kx44nmA9Op0v6CtbfeYMNOqBZl1nT0SvkXH7S3C+3Sd+H3HFqQBjMcYv w8Rs+9XeU2by5GJ03gsKzuCGgXNOUjLXi/QjRz3aX6sF6Y3DPlHUm0VQbPHVgNDO2rAd jWxw== X-Gm-Message-State: AOAM531Rj0FxyNzbzZdYrrjKkj8QDBAMwg7lpbHtLiUfBgeJxn4dbqPy fCS4Egzj/0GQpGOHP4m9Kl0= X-Google-Smtp-Source: ABdhPJzlKx7nk1zr8eBsdAQ3lldQDz10ZuIAq7Y/ciI8kiRVAIGDgQsGDv58Vyh3N3Z3gdddug1ViQ== X-Received: by 2002:a63:1e62:: with SMTP id p34mr5341991pgm.355.1618877360220; Mon, 19 Apr 2021 17:09:20 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:19 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Adaptec OEM Raid Solutions Subject: [PATCH 024/117] aacraid: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:12 -0700 Message-Id: <20210420000845.25873-25-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Adaptec OEM Raid Solutions Signed-off-by: Bart Van Assche --- drivers/scsi/aacraid/aachba.c | 142 +++++++++++++++++----------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index f1f62b5da8b7..a70b243990d5 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -556,7 +556,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr) } } - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; aac_fib_complete(fibptr); scsicmd->scsi_done(scsicmd); @@ -614,7 +614,7 @@ static int aac_probe_container_callback2(struct scsi_cmnd * scsicmd) if ((fsa_dev_ptr[scmd_id(scsicmd)].valid & 1)) return aac_scsi_cmd(scsicmd); - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; scsicmd->scsi_done(scsicmd); return 0; } @@ -1092,7 +1092,7 @@ static void get_container_serial_callback(void *context, struct fib * fibptr) } } - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; aac_fib_complete(fibptr); scsicmd->scsi_done(scsicmd); @@ -1191,7 +1191,7 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba) if (lba & 0xffffffff00000000LL) { int cid = scmd_id(cmd); dprintk((KERN_DEBUG "aacraid: Illegal lba\n")); - cmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + cmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE, ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); @@ -2358,11 +2358,11 @@ static void io_callback(void *context, struct fib * fibptr) readreply = (struct aac_read_reply *)fib_data(fibptr); switch (le32_to_cpu(readreply->status)) { case ST_OK: - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; dev->fsa_dev[cid].sense_data.sense_key = NO_SENSE; break; case ST_NOT_READY: - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, NOT_READY, SENCODE_BECOMING_READY, ASENCODE_BECOMING_READY, 0, 0); memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, @@ -2370,7 +2370,7 @@ static void io_callback(void *context, struct fib * fibptr) SCSI_SENSE_BUFFERSIZE)); break; case ST_MEDERR: - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, MEDIUM_ERROR, SENCODE_UNRECOVERED_READ_ERROR, ASENCODE_NO_SENSE, 0, 0); memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, @@ -2382,7 +2382,7 @@ static void io_callback(void *context, struct fib * fibptr) printk(KERN_WARNING "io_callback: io failed, status = %d\n", le32_to_cpu(readreply->status)); #endif - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE, ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); @@ -2457,7 +2457,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) if ((lba + count) > (dev->fsa_dev[scmd_id(scsicmd)].size)) { cid = scmd_id(scsicmd); dprintk((KERN_DEBUG "aacraid: Illegal lba\n")); - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE, ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); @@ -2489,7 +2489,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) /* * For some reason, the Fib didn't queue, return QUEUE_FULL */ - scsicmd->result = DID_OK << 16 | SAM_STAT_TASK_SET_FULL; + scsicmd->status.combined = SAM_STAT_TASK_SET_FULL; scsicmd->scsi_done(scsicmd); aac_fib_complete(cmd_fibcontext); aac_fib_free(cmd_fibcontext); @@ -2548,7 +2548,7 @@ static int aac_write(struct scsi_cmnd * scsicmd) if ((lba + count) > (dev->fsa_dev[scmd_id(scsicmd)].size)) { cid = scmd_id(scsicmd); dprintk((KERN_DEBUG "aacraid: Illegal lba\n")); - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE, ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); @@ -2580,7 +2580,7 @@ static int aac_write(struct scsi_cmnd * scsicmd) /* * For some reason, the Fib didn't queue, return QUEUE_FULL */ - scsicmd->result = DID_OK << 16 | SAM_STAT_TASK_SET_FULL; + scsicmd->status.combined = SAM_STAT_TASK_SET_FULL; scsicmd->scsi_done(scsicmd); aac_fib_complete(cmd_fibcontext); @@ -2603,7 +2603,7 @@ static void synchronize_callback(void *context, struct fib *fibptr) synchronizereply = fib_data(fibptr); if (le32_to_cpu(synchronizereply->status) == CT_OK) - cmd->result = DID_OK << 16 | SAM_STAT_GOOD; + cmd->status.combined = SAM_STAT_GOOD; else { struct scsi_device *sdev = cmd->device; struct aac_dev *dev = fibptr->dev; @@ -2611,7 +2611,7 @@ static void synchronize_callback(void *context, struct fib *fibptr) printk(KERN_WARNING "synchronize_callback: synchronize failed, status = %d\n", le32_to_cpu(synchronizereply->status)); - cmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + cmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE, ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0); @@ -2685,7 +2685,7 @@ static void aac_start_stop_callback(void *context, struct fib *fibptr) BUG_ON(fibptr == NULL); - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; aac_fib_complete(fibptr); aac_fib_free(fibptr); @@ -2702,7 +2702,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd) if (!(aac->supplement_adapter_info.supported_options2 & AAC_OPTION_POWER_MANAGEMENT)) { - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; scsicmd->scsi_done(scsicmd); return 0; } @@ -2777,7 +2777,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) if (scmd_channel(scsicmd) == CONTAINER_CHANNEL) { if((cid >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)) { - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; goto scsi_done_ret; } @@ -2821,7 +2821,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) return -1; return aac_send_srb_fib(scsicmd); } else { - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; goto scsi_done_ret; } } @@ -2833,7 +2833,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) (scsicmd->cmnd[0] != TEST_UNIT_READY)) { dprintk((KERN_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n", scsicmd->cmnd[0])); - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND, ASENCODE_INVALID_COMMAND, 0, 0); @@ -2862,7 +2862,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) case SYNCHRONIZE_CACHE: if (((aac_cache & 6) == 6) && dev->cache_protected) { - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; } /* Issue FIB to tell Firmware to flush it's cache */ @@ -2891,7 +2891,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) arr[1] = scsicmd->cmnd[2]; scsi_sg_copy_from_buffer(scsicmd, &inq_data, sizeof(inq_data)); - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; } else if (scsicmd->cmnd[2] == 0x80) { /* unit serial number page */ arr[3] = setinqserial(dev, &arr[4], @@ -2902,7 +2902,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) if (aac_wwn != 2) return aac_get_container_serial( scsicmd); - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; } else if (scsicmd->cmnd[2] == 0x83) { /* vpd page 0x83 - Device Identification Page */ char *sno = (char *)&inq_data; @@ -2911,10 +2911,10 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) if (aac_wwn != 2) return aac_get_container_serial( scsicmd); - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; } else { /* vpd page not implemented */ - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, ILLEGAL_REQUEST, SENCODE_INVALID_CDB_FIELD, ASENCODE_NO_SENSE, 7, 2); @@ -2940,7 +2940,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ scsi_sg_copy_from_buffer(scsicmd, &inq_data, sizeof(inq_data)); - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; } if (dev->in_reset) @@ -2989,7 +2989,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) /* Do not cache partition table for arrays */ scsicmd->device->removable = 1; - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; } @@ -3015,7 +3015,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) scsi_sg_copy_from_buffer(scsicmd, cp, sizeof(cp)); /* Do not cache partition table for arrays */ scsicmd->device->removable = 1; - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; } @@ -3094,7 +3094,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) scsi_sg_copy_from_buffer(scsicmd, (char *)&mpd, mode_buf_length); - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; } case MODE_SENSE_10: @@ -3171,7 +3171,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) (char *)&mpd10, mode_buf_length); - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; } case REQUEST_SENSE: @@ -3180,7 +3180,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) sizeof(struct sense_data)); memset(&dev->fsa_dev[cid].sense_data, 0, sizeof(struct sense_data)); - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; case ALLOW_MEDIUM_REMOVAL: @@ -3190,14 +3190,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) else fsa_dev_ptr[cid].locked = 0; - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; /* * These commands are all No-Ops */ case TEST_UNIT_READY: if (fsa_dev_ptr[cid].sense_data.sense_key == NOT_READY) { - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, NOT_READY, SENCODE_BECOMING_READY, ASENCODE_BECOMING_READY, 0, 0); @@ -3214,7 +3214,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) case REZERO_UNIT: case REASSIGN_BLOCKS: case SEEK_10: - scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD; + scsicmd->status.combined = SAM_STAT_GOOD; break; case START_STOP: @@ -3226,7 +3226,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) */ dprintk((KERN_WARNING "Unhandled SCSI Command: 0x%x.\n", scsicmd->cmnd[0])); - scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = SAM_STAT_CHECK_CONDITION; set_sense(&dev->fsa_dev[cid].sense_data, ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND, ASENCODE_INVALID_COMMAND, 0, 0); @@ -3407,7 +3407,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) le32_to_cpu(srbreply->status)); len = min_t(u32, le32_to_cpu(srbreply->sense_data_size), SCSI_SENSE_BUFFERSIZE); - scsicmd->result = DID_ERROR << 16 | SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined = DID_ERROR << 16 | SAM_STAT_CHECK_CONDITION; memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); } @@ -3419,7 +3419,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) case SRB_STATUS_ERROR_RECOVERY: case SRB_STATUS_PENDING: case SRB_STATUS_SUCCESS: - scsicmd->result = DID_OK << 16; + scsicmd->status.combined = 0; break; case SRB_STATUS_DATA_OVERRUN: switch (scsicmd->cmnd[0]) { @@ -3436,52 +3436,52 @@ static void aac_srb_callback(void *context, struct fib * fibptr) pr_warn("aacraid: SCSI CMD underflow\n"); else pr_warn("aacraid: SCSI CMD Data Overrun\n"); - scsicmd->result = DID_ERROR << 16; + scsicmd->status.combined = DID_ERROR << 16; break; case INQUIRY: - scsicmd->result = DID_OK << 16; + scsicmd->status.combined = 0; break; default: - scsicmd->result = DID_OK << 16; + scsicmd->status.combined = 0; break; } break; case SRB_STATUS_ABORTED: - scsicmd->result = DID_ABORT << 16; + scsicmd->status.combined = DID_ABORT << 16; break; case SRB_STATUS_ABORT_FAILED: /* * Not sure about this one - but assuming the * hba was trying to abort for some reason */ - scsicmd->result = DID_ERROR << 16; + scsicmd->status.combined = DID_ERROR << 16; break; case SRB_STATUS_PARITY_ERROR: - scsicmd->result = DID_PARITY << 16; + scsicmd->status.combined = DID_PARITY << 16; break; case SRB_STATUS_NO_DEVICE: case SRB_STATUS_INVALID_PATH_ID: case SRB_STATUS_INVALID_TARGET_ID: case SRB_STATUS_INVALID_LUN: case SRB_STATUS_SELECTION_TIMEOUT: - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; break; case SRB_STATUS_COMMAND_TIMEOUT: case SRB_STATUS_TIMEOUT: - scsicmd->result = DID_TIME_OUT << 16; + scsicmd->status.combined = DID_TIME_OUT << 16; break; case SRB_STATUS_BUSY: - scsicmd->result = DID_BUS_BUSY << 16; + scsicmd->status.combined = DID_BUS_BUSY << 16; break; case SRB_STATUS_BUS_RESET: - scsicmd->result = DID_RESET << 16; + scsicmd->status.combined = DID_RESET << 16; break; case SRB_STATUS_MESSAGE_REJECTED: - scsicmd->result = DID_ERROR << 16; + scsicmd->status.combined = DID_ERROR << 16; break; case SRB_STATUS_REQUEST_FLUSHED: case SRB_STATUS_ERROR: @@ -3517,12 +3517,12 @@ static void aac_srb_callback(void *context, struct fib * fibptr) || (scsicmd->cmnd[0] == ATA_16)) { if (scsicmd->cmnd[2] & (0x01 << 5)) { - scsicmd->result = DID_OK << 16; + scsicmd->status.combined = 0; } else { - scsicmd->result = DID_ERROR << 16; + scsicmd->status.combined = DID_ERROR << 16; } } else { - scsicmd->result = DID_ERROR << 16; + scsicmd->status.combined = DID_ERROR << 16; } break; } @@ -3530,7 +3530,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) == SAM_STAT_CHECK_CONDITION) { int len; - scsicmd->result |= SAM_STAT_CHECK_CONDITION; + scsicmd->status.combined |= SAM_STAT_CHECK_CONDITION; len = min_t(u32, le32_to_cpu(srbreply->sense_data_size), SCSI_SENSE_BUFFERSIZE); #ifdef AAC_DETAILED_STATUS_INFO @@ -3544,7 +3544,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) /* * OR in the scsi status (already shifted up a bit) */ - scsicmd->result |= le32_to_cpu(srbreply->scsi_status); + scsicmd->status.combined |= le32_to_cpu(srbreply->scsi_status); aac_fib_complete(fibptr); scsicmd->scsi_done(scsicmd); @@ -3554,13 +3554,13 @@ static void hba_resp_task_complete(struct aac_dev *dev, struct scsi_cmnd *scsicmd, struct aac_hba_resp *err) { - scsicmd->result = err->status; + scsicmd->status.combined = err->status; /* set residual count */ scsi_set_resid(scsicmd, le32_to_cpu(err->residual_count)); switch (err->status) { case SAM_STAT_GOOD: - scsicmd->result |= DID_OK << 16; + scsicmd->status.combined |= 0; break; case SAM_STAT_CHECK_CONDITION: { @@ -3571,19 +3571,19 @@ static void hba_resp_task_complete(struct aac_dev *dev, if (len) memcpy(scsicmd->sense_buffer, err->sense_response_buf, len); - scsicmd->result |= DID_OK << 16; + scsicmd->status.combined |= 0; break; } case SAM_STAT_BUSY: - scsicmd->result |= DID_BUS_BUSY << 16; + scsicmd->status.combined |= DID_BUS_BUSY << 16; break; case SAM_STAT_TASK_ABORTED: - scsicmd->result |= DID_ABORT << 16; + scsicmd->status.combined |= DID_ABORT << 16; break; case SAM_STAT_RESERVATION_CONFLICT: case SAM_STAT_TASK_SET_FULL: default: - scsicmd->result |= DID_ERROR << 16; + scsicmd->status.combined |= DID_ERROR << 16; break; } } @@ -3603,26 +3603,26 @@ static void hba_resp_task_failure(struct aac_dev *dev, dev->hba_map[bus][cid].devtype = AAC_DEVTYPE_ARC_RAW; dev->hba_map[bus][cid].rmw_nexus = 0xffffffff; } - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; break; } case HBA_RESP_STAT_IO_ERROR: case HBA_RESP_STAT_NO_PATH_TO_DEVICE: - scsicmd->result = DID_OK << 16 | SAM_STAT_BUSY; + scsicmd->status.combined = SAM_STAT_BUSY; break; case HBA_RESP_STAT_IO_ABORTED: - scsicmd->result = DID_ABORT << 16; + scsicmd->status.combined = DID_ABORT << 16; break; case HBA_RESP_STAT_INVALID_DEVICE: - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; break; case HBA_RESP_STAT_UNDERRUN: /* UNDERRUN is OK */ - scsicmd->result = DID_OK << 16; + scsicmd->status.combined = 0; break; case HBA_RESP_STAT_OVERRUN: default: - scsicmd->result = DID_ERROR << 16; + scsicmd->status.combined = DID_ERROR << 16; break; } } @@ -3655,7 +3655,7 @@ void aac_hba_callback(void *context, struct fib *fibptr) if (fibptr->flags & FIB_CONTEXT_FLAG_FASTRESP) { /* fast response */ - scsicmd->result = DID_OK << 16; + scsicmd->status.combined = 0; goto out; } @@ -3667,17 +3667,17 @@ void aac_hba_callback(void *context, struct fib *fibptr) hba_resp_task_failure(dev, scsicmd, err); break; case HBA_RESP_SVCRES_TMF_REJECTED: - scsicmd->result = DID_ERROR << 16; + scsicmd->status.combined = DID_ERROR << 16; break; case HBA_RESP_SVCRES_TMF_LUN_INVALID: - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; break; case HBA_RESP_SVCRES_TMF_COMPLETE: case HBA_RESP_SVCRES_TMF_SUCCEEDED: - scsicmd->result = DID_OK << 16; + scsicmd->status.combined = 0; break; default: - scsicmd->result = DID_ERROR << 16; + scsicmd->status.combined = DID_ERROR << 16; break; } @@ -3706,7 +3706,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) dev = (struct aac_dev *)scsicmd->device->host->hostdata; if (scmd_id(scsicmd) >= dev->maximum_num_physicals || scsicmd->device->lun > 7) { - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; scsicmd->scsi_done(scsicmd); return 0; } @@ -3747,7 +3747,7 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd) dev = shost_priv(scsicmd->device->host); if (scmd_id(scsicmd) >= dev->maximum_num_physicals || scsicmd->device->lun > AAC_MAX_LUN - 1) { - scsicmd->result = DID_NO_CONNECT << 16; + scsicmd->status.combined = DID_NO_CONNECT << 16; scsicmd->scsi_done(scsicmd); return 0; } From patchwork Tue Apr 20 00:07:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C2E0C43460 for ; Tue, 20 Apr 2021 00:09:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD39E6109E for ; Tue, 20 Apr 2021 00:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233159AbhDTAKI (ORCPT ); Mon, 19 Apr 2021 20:10:08 -0400 Received: from mail-pg1-f178.google.com ([209.85.215.178]:43781 "EHLO mail-pg1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233258AbhDTAJy (ORCPT ); Mon, 19 Apr 2021 20:09:54 -0400 Received: by mail-pg1-f178.google.com with SMTP id p12so25395256pgj.10 for ; Mon, 19 Apr 2021 17:09:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HRAywc+wYKR14aBGGME5mwCtOfuNOyXvxePe8lGxNuI=; b=Ez3Xea5WimLE0QUah1UVdJQKWEmI+Ocq3ePPYkTlcwtUiF5GbUVED27gNxq+bt2pMc OdDxjW0PS9ENJdVja1QFbUjGCZ9sPNMWgfYbYy8mqvxLf+qrsuNjCLXAc7zgDFSfhfPB 0BLXEyVuFQp0VtYucwCTxWIHYQmKt9dr2mYWJbKxb52F3j9daa0bNEECba+/MQ2W0Xc9 R7wixs9/NeAAPR60hARgwrJTjZTEJ1E1DIGwOteA9nh8N5HDwzc4hRkMR64QJsUk4+3w 7arBImaIuGraVCMBrsgxVH810qazS8EwECkMbxgz+Z9LXmiEgraq3QJUcIgJ7T4M3NWy Xi/Q== X-Gm-Message-State: AOAM533aBcpj7CQ0h3JfzC9OPn+jr7/E0UJUYRUB8LV+Iqrq/5KHjLYn v+yZvy4FtSum9IU7fnDZs18HbUaz9vRESQ== X-Google-Smtp-Source: ABdhPJzytwdMkvm6pyjr5lhBwO0m1giGoEXP/cNHuXNOfLGJO8yzX/pYQvSBTNrWcUjNhxs2jq2QSw== X-Received: by 2002:a62:ee09:0:b029:211:1113:2e7c with SMTP id e9-20020a62ee090000b029021111132e7cmr21979381pfi.49.1618877363490; Mon, 19 Apr 2021 17:09:23 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:22 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Matthew Wilcox , Hannes Reinecke Subject: [PATCH 027/117] advansys: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:15 -0700 Message-Id: <20210420000845.25873-28-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Matthew Wilcox Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/scsi/advansys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index e9516de8c18b..9b8d463e1bfd 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -5980,7 +5980,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) /* * 'done_status' contains the command's ending status. */ - scp->result = 0; + scp->status.combined = 0; switch (scsiqp->done_status) { case QD_NO_ERROR: ASC_DBG(2, "QD_NO_ERROR\n"); @@ -6732,7 +6732,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) /* * 'qdonep' contains the command's ending status. */ - scp->result = 0; + scp->status.combined = 0; switch (qdonep->d3.done_stat) { case QD_NO_ERROR: ASC_DBG(2, "QD_NO_ERROR\n"); From patchwork Tue Apr 20 00:07:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BAB8C433ED for ; Tue, 20 Apr 2021 00:09:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 272E36109E for ; Tue, 20 Apr 2021 00:09:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233580AbhDTAKL (ORCPT ); Mon, 19 Apr 2021 20:10:11 -0400 Received: from mail-pl1-f175.google.com ([209.85.214.175]:41503 "EHLO mail-pl1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233055AbhDTAJz (ORCPT ); Mon, 19 Apr 2021 20:09:55 -0400 Received: by mail-pl1-f175.google.com with SMTP id e2so14366812plh.8 for ; Mon, 19 Apr 2021 17:09:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GUc8U2ftArdv73hIF2MA5A7z8Pvd/rAvL6Fang6y8uI=; b=jgVCl27owyN2J20khNgXqGQiZM4gIcQZhMqoVw+rTrNGOtPV3VxBYRdOWGig6OSNwN I/Kj2Y1QXGuANBHEMFv3wYIu/fJcp5ZlP7kJu1A37ol4dM6BSHfyWznSWOGcW5BRqmrm rzXsErN7onhtQLubwUQ32ZDsH25STIBKlOI/2kWS/jOva5UUSoseNcwI7aVeapdlvKBd anvTV2APeNXfuB49uBcQf4MKUyOxuH8YnPE2QXY7h3TWjVlgmXf79/xhcoNgPGWkvAsJ v4kMcPRBhyWtIL6CM9tUu7rzaKO3Ib/w4gifEoRkqN9+yuVCHbFNF2WPTOWYPr0Wbup9 y16A== X-Gm-Message-State: AOAM5327qUzVitlUqyeT/Lc/nGWNJ0ceEtivIoq37QtwJwrK+t7Z/Adf bI5WZ+l6MT0kQjPB766MkzFRKp3HuE/wZg== X-Google-Smtp-Source: ABdhPJyZLpCm6NMrO5bpr9RXO0+narMCWbrhn/F0FRC7CCzP651DhMLDHQaADucC2a10elhIDQjTdg== X-Received: by 2002:a17:90b:34b:: with SMTP id fh11mr1845435pjb.105.1618877364677; Mon, 19 Apr 2021 17:09:24 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:24 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Juergen E. Fischer" Subject: [PATCH 028/117] aha*: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:16 -0700 Message-Id: <20210420000845.25873-29-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: "Juergen E. Fischer" Signed-off-by: Bart Van Assche --- drivers/scsi/aha152x.c | 4 ++-- drivers/scsi/aha1542.c | 4 ++-- drivers/scsi/aha1740.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index d8e19afa7a14..a1f5764d3577 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -1281,7 +1281,7 @@ static void done(struct Scsi_Host *shpnt, int error) DONE_SC = CURRENT_SC; CURRENT_SC = NULL; - DONE_SC->result = error; + DONE_SC->status.combined = error; } else printk(KERN_ERR "aha152x: done() called outside of command\n"); } @@ -2254,7 +2254,7 @@ static void rsti_run(struct Scsi_Host *shpnt) kfree(ptr->host_scribble); ptr->host_scribble=NULL; - ptr->result = DID_RESET << 16; + ptr->status.combined = DID_RESET << 16; ptr->scsi_done(ptr); } diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 21aab9f5b117..4d4864120f30 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c @@ -398,7 +398,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id) if (errstatus) printk("aha1542_intr_handle: returning %6x\n", errstatus); #endif - tmp_cmd->result = errstatus; + tmp_cmd->status.combined = errstatus; aha1542->int_cmds[mbo] = NULL; /* This effectively frees up the mailbox slot, as * far as queuecommand is concerned */ @@ -422,7 +422,7 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) if (*cmd->cmnd == REQUEST_SENSE) { /* Don't do the command - we have the sense data already */ - cmd->result = 0; + cmd->status.combined = 0; cmd->scsi_done(cmd); return 0; } diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index 0dc831026e9e..a105599872e8 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c @@ -275,7 +275,7 @@ static irqreturn_t aha1740_intr_handle(int irq, void *dev_id) DEB(if (errstatus) printk("aha1740_intr_handle: returning %6x\n", errstatus)); - SCtmp->result = errstatus; + SCtmp->status.combined = errstatus; my_done = ecbptr->done; memset(ecbptr,0,sizeof(struct ecb)); if ( my_done ) @@ -326,7 +326,7 @@ static int aha1740_queuecommand_lck(struct scsi_cmnd * SCpnt, DEB(int i); if(*cmd == REQUEST_SENSE) { - SCpnt->result = 0; + SCpnt->status.combined = 0; done(SCpnt); return 0; } From patchwork Tue Apr 20 00:07:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07A04C43460 for ; Tue, 20 Apr 2021 00:09:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBC35613AA for ; Tue, 20 Apr 2021 00:09:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233112AbhDTAKO (ORCPT ); Mon, 19 Apr 2021 20:10:14 -0400 Received: from mail-pj1-f41.google.com ([209.85.216.41]:36537 "EHLO mail-pj1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbhDTAJ5 (ORCPT ); Mon, 19 Apr 2021 20:09:57 -0400 Received: by mail-pj1-f41.google.com with SMTP id f2-20020a17090a4a82b02900c67bf8dc69so21357360pjh.1 for ; Mon, 19 Apr 2021 17:09:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B4HyuekF2NhvlDK/R3K3jpHV/KDSGmRipp0zFJgr++I=; b=Jo5oGJ4PjOqesgENd6CywhgrYSSKUSGKvw3Ifl/V5Gens38tKDfDcASL+HudDnR6aD MK1zz72lC2D7TM1Jwb2jVhJtTq6WbGS2R5xr4H+pddDBzIZ5nyh1ELV+3gU+GinkItqT fWwg7Pq5MV6jDMzwJpbN1XhgET+QSm8y+uwNjjfdle9fmzGVb8WdEIrocKIcmiaW4OZp Gk+xZOIb/4nGLEx7sAcTfPTDTOJw2cUKhaKusyUfFlHw7q+w3aOerTecuNjIhRMxTrDP rEs+N6xLhSXYA3Roj7OWodyUWLGNvTSYgXs1pbYqaXHEhoUmatvIoVSqaz6st81nWx6/ Ak0A== X-Gm-Message-State: AOAM532Zgx0itFsmgurp3WC6wipSr1oVbCNK3/ROsxjxWRnfziHbA9Uc KbdOU/f39e5SCB2/lI/GLJ4= X-Google-Smtp-Source: ABdhPJwdPF8gSdhyKBXiEs/dL6Vuh+qPGK5/IYXpgVCeXkFZGd60wUr4t8e0MQbHucgNHFBtmes70g== X-Received: by 2002:a17:902:c14d:b029:ec:acd9:d5a0 with SMTP id 13-20020a170902c14db02900ecacd9d5a0mr5207199plj.60.1618877366810; Mon, 19 Apr 2021 17:09:26 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:26 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 030/117] arcmsr: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:18 -0700 Message-Id: <20210420000845.25873-31-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Signed-off-by: Bart Van Assche --- drivers/scsi/arcmsr/arcmsr_hba.c | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 4b79661275c9..c410fcd1c11f 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -1326,7 +1326,7 @@ static void arcmsr_report_sense_info(struct CommandControlBlock *ccb) struct scsi_cmnd *pcmd = ccb->pcmd; struct SENSE_DATA *sensebuffer = (struct SENSE_DATA *)pcmd->sense_buffer; - pcmd->result = (DID_OK << 16) | (CHECK_CONDITION << 1); + pcmd->status.combined = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; if (sensebuffer) { int sense_data_length = sizeof(struct SENSE_DATA) < SCSI_SENSE_BUFFERSIZE @@ -1335,7 +1335,7 @@ static void arcmsr_report_sense_info(struct CommandControlBlock *ccb) memcpy(sensebuffer, ccb->arcmsr_cdb.SenseData, sense_data_length); sensebuffer->ErrorCode = SCSI_SENSE_CURRENT_ERRORS; sensebuffer->Valid = 1; - pcmd->result |= (DRIVER_SENSE << 24); + pcmd->status.b.driver = DRIVER_SENSE; } } @@ -1390,13 +1390,13 @@ static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb, if (!error) { if (acb->devstate[id][lun] == ARECA_RAID_GONE) acb->devstate[id][lun] = ARECA_RAID_GOOD; - ccb->pcmd->result = DID_OK << 16; + ccb->pcmd->status.combined = DID_OK << 16; arcmsr_ccb_complete(ccb); }else{ switch (ccb->arcmsr_cdb.DeviceStatus) { case ARCMSR_DEV_SELECT_TIMEOUT: { acb->devstate[id][lun] = ARECA_RAID_GONE; - ccb->pcmd->result = DID_NO_CONNECT << 16; + ccb->pcmd->status.combined = DID_NO_CONNECT << 16; arcmsr_ccb_complete(ccb); } break; @@ -1405,7 +1405,7 @@ static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb, case ARCMSR_DEV_INIT_FAIL: { acb->devstate[id][lun] = ARECA_RAID_GONE; - ccb->pcmd->result = DID_BAD_TARGET << 16; + ccb->pcmd->status.combined = DID_BAD_TARGET << 16; arcmsr_ccb_complete(ccb); } break; @@ -1426,7 +1426,7 @@ static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb, , lun , ccb->arcmsr_cdb.DeviceStatus); acb->devstate[id][lun] = ARECA_RAID_GONE; - ccb->pcmd->result = DID_NO_CONNECT << 16; + ccb->pcmd->status.combined = DID_NO_CONNECT << 16; arcmsr_ccb_complete(ccb); break; } @@ -1439,7 +1439,7 @@ static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct Comma if (pCCB->startdone == ARCMSR_CCB_ABORTED) { struct scsi_cmnd *abortcmd = pCCB->pcmd; if (abortcmd) { - abortcmd->result |= DID_ABORT << 16; + abortcmd->status.combined |= DID_ABORT << 16; arcmsr_ccb_complete(pCCB); printk(KERN_NOTICE "arcmsr%d: pCCB ='0x%p' isr got aborted command \n", acb->host->host_no, pCCB); @@ -1594,7 +1594,7 @@ static void arcmsr_remove_scsi_devices(struct AdapterControlBlock *acb) for (i = 0; i < acb->maxFreeCCB; i++) { ccb = acb->pccb_pool[i]; if (ccb->startdone == ARCMSR_CCB_START) { - ccb->pcmd->result = DID_NO_CONNECT << 16; + ccb->pcmd->status.combined = DID_NO_CONNECT << 16; arcmsr_pci_unmap_dma(ccb); ccb->pcmd->scsi_done(ccb->pcmd); } @@ -1686,7 +1686,7 @@ static void arcmsr_remove(struct pci_dev *pdev) struct CommandControlBlock *ccb = acb->pccb_pool[i]; if (ccb->startdone == ARCMSR_CCB_START) { ccb->startdone = ARCMSR_CCB_ABORTED; - ccb->pcmd->result = DID_ABORT << 16; + ccb->pcmd->status.combined = DID_ABORT << 16; arcmsr_ccb_complete(ccb); } } @@ -3178,7 +3178,7 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb, struct scatterlist *sg; if (cmd->device->lun) { - cmd->result = (DID_TIME_OUT << 16); + cmd->status.combined = (DID_TIME_OUT << 16); cmd->scsi_done(cmd); return; } @@ -3209,7 +3209,7 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb, case WRITE_BUFFER: case READ_BUFFER: { if (arcmsr_iop_message_xfer(acb, cmd)) - cmd->result = (DID_ERROR << 16); + cmd->status.combined = (DID_ERROR << 16); cmd->scsi_done(cmd); } break; @@ -3227,13 +3227,13 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd, int target = cmd->device->id; if (acb->acb_flags & ACB_F_ADAPTER_REMOVED) { - cmd->result = (DID_NO_CONNECT << 16); + cmd->status.combined = (DID_NO_CONNECT << 16); cmd->scsi_done(cmd); return 0; } cmd->scsi_done = done; cmd->host_scribble = NULL; - cmd->result = 0; + cmd->status.combined = 0; if (target == 16) { /* virtual device for iop message transfer */ arcmsr_handle_virtual_command(acb, cmd); @@ -3243,7 +3243,7 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd, if (!ccb) return SCSI_MLQUEUE_HOST_BUSY; if (arcmsr_build_ccb( acb, ccb, cmd ) == FAILED) { - cmd->result = (DID_ERROR << 16) | (RESERVATION_CONFLICT << 1); + cmd->status.combined = (DID_ERROR << 16) | SAM_STAT_RESERVATION_CONFLICT; cmd->scsi_done(cmd); return 0; } @@ -3516,7 +3516,7 @@ static int arcmsr_hbaA_polling_ccbdone(struct AdapterControlBlock *acb, , ccb->pcmd->device->id , (u32)ccb->pcmd->device->lun , ccb); - ccb->pcmd->result = DID_ABORT << 16; + ccb->pcmd->status.combined = DID_ABORT << 16; arcmsr_ccb_complete(ccb); continue; } @@ -3585,7 +3585,7 @@ static int arcmsr_hbaB_polling_ccbdone(struct AdapterControlBlock *acb, ,ccb->pcmd->device->id ,(u32)ccb->pcmd->device->lun ,ccb); - ccb->pcmd->result = DID_ABORT << 16; + ccb->pcmd->status.combined = DID_ABORT << 16; arcmsr_ccb_complete(ccb); continue; } @@ -3647,7 +3647,7 @@ static int arcmsr_hbaC_polling_ccbdone(struct AdapterControlBlock *acb, , pCCB->pcmd->device->id , (u32)pCCB->pcmd->device->lun , pCCB); - pCCB->pcmd->result = DID_ABORT << 16; + pCCB->pcmd->status.combined = DID_ABORT << 16; arcmsr_ccb_complete(pCCB); continue; } @@ -3722,7 +3722,7 @@ static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb, , pCCB->pcmd->device->id , (u32)pCCB->pcmd->device->lun , pCCB); - pCCB->pcmd->result = DID_ABORT << 16; + pCCB->pcmd->status.combined = DID_ABORT << 16; arcmsr_ccb_complete(pCCB); continue; } @@ -3790,7 +3790,7 @@ static int arcmsr_hbaE_polling_ccbdone(struct AdapterControlBlock *acb, , pCCB->pcmd->device->id , (u32)pCCB->pcmd->device->lun , pCCB); - pCCB->pcmd->result = DID_ABORT << 16; + pCCB->pcmd->status.combined = DID_ABORT << 16; arcmsr_ccb_complete(pCCB); continue; } From patchwork Tue Apr 20 00:07:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8CB8C433ED for ; Tue, 20 Apr 2021 00:09:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC67C613AA for ; Tue, 20 Apr 2021 00:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233162AbhDTAKO (ORCPT ); Mon, 19 Apr 2021 20:10:14 -0400 Received: from mail-pl1-f173.google.com ([209.85.214.173]:36848 "EHLO mail-pl1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbhDTAJ7 (ORCPT ); Mon, 19 Apr 2021 20:09:59 -0400 Received: by mail-pl1-f173.google.com with SMTP id g16so1821149plq.3 for ; Mon, 19 Apr 2021 17:09:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uct9dVj7soP7jCycwyDRbNVMWwDhX5fyZFVnfezsjlU=; b=dpNaA+VYTpQkk7m6jnvabD033nmDu7827hEy1u7+IgcUxKJSRi6ONAFGdiOptshlwL hnqfhKpT1Lgic/vYKUtTam9AQ/t+TQ1fCLtC5Eq2BOrM7vL2rpQZ6fZGNEKb6q6IC0hV iXhwGQ6uMSs9LRPH/WijbWo9h5LgM8219ZBDdH3xgDBBRmyM89g4WUFLE2tU/5Rhs0Jy qddGFXNrUdGklxaeJOtaLYMZWbJ+vhqi6DMdWe6qAAIRlyeZSVBWFEhdei8TtCwo/s2w uA6kQ/y0TUkREhW4qi7kkcylM3JxLHSkN56pkmQnn5+L0OiocxsJ/3XvTPFOQCqrx+QD Ighg== X-Gm-Message-State: AOAM530nk6xgHVT14Mogbm46k0qk/eef99FQ5saN07sSSsNFJoIUopCb nFL1No9lquXP/x+MgBE9axWnbpLEHBZLww== X-Google-Smtp-Source: ABdhPJzfFoMNZB1xXW+mcsZaQlJfBAu+NGnQJnNPxKWaVG6eJECwMMlCEJWcoWNwrH2K9AiUnwQh3A== X-Received: by 2002:a17:903:304b:b029:eb:4cf:8321 with SMTP id u11-20020a170903304bb02900eb04cf8321mr25973336pla.40.1618877369158; Mon, 19 Apr 2021 17:09:29 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:28 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 032/117] atp870u: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:20 -0700 Message-Id: <20210420000845.25873-33-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Signed-off-by: Bart Van Assche --- drivers/scsi/atp870u.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 9d179cd15bb8..0fb5af026229 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -494,13 +494,13 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) dev->last_cmd[c] = 0xff; } if (i == 0x16) { - workreq->result = atp_readb_io(dev, c, 0x0f); + workreq->status.combined = atp_readb_io(dev, c, 0x0f); if (((dev->r1f[c][target_id] & 0x10) != 0) && is885(dev)) { printk(KERN_WARNING "AEC67162 CRC ERROR !\n"); - workreq->result = SAM_STAT_CHECK_CONDITION; + workreq->status.combined = SAM_STAT_CHECK_CONDITION; } } else - workreq->result = SAM_STAT_CHECK_CONDITION; + workreq->status.combined = SAM_STAT_CHECK_CONDITION; if (is885(dev)) { j = atp_readb_base(dev, 0x29) | 0x01; @@ -630,7 +630,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p, req_p->sense_buffer[0]=0; scsi_set_resid(req_p, 0); if (scmd_channel(req_p) > 1) { - req_p->result = DID_BAD_TARGET << 16; + req_p->status.combined = DID_BAD_TARGET << 16; done(req_p); #ifdef ED_DBGP printk("atp870u_queuecommand : req_p->device->channel > 1\n"); @@ -649,7 +649,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p, */ if ((m & dev->active_id[c]) == 0) { - req_p->result = DID_BAD_TARGET << 16; + req_p->status.combined = DID_BAD_TARGET << 16; done(req_p); return 0; } @@ -660,7 +660,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p, #ifdef ED_DBGP printk( "atp870u_queuecommand: done can't be NULL\n"); #endif - req_p->result = 0; + req_p->status.combined = 0; done(req_p); return 0; } @@ -684,7 +684,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p, printk("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n"); #endif dev->quend[c]--; - req_p->result = DID_BUS_BUSY << 16; + req_p->status.combined = DID_BUS_BUSY << 16; done(req_p); return 0; } From patchwork Tue Apr 20 00:07:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84D95C43460 for ; Tue, 20 Apr 2021 00:09:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F97E6109E for ; Tue, 20 Apr 2021 00:09:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233331AbhDTAKR (ORCPT ); Mon, 19 Apr 2021 20:10:17 -0400 Received: from mail-pg1-f179.google.com ([209.85.215.179]:42751 "EHLO mail-pg1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233360AbhDTAKC (ORCPT ); Mon, 19 Apr 2021 20:10:02 -0400 Received: by mail-pg1-f179.google.com with SMTP id m12so4673242pgr.9 for ; Mon, 19 Apr 2021 17:09:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U0IX1kl6bIG5rdB3UU2k/e0cRn/9x8iQILwZ4F/kStg=; b=NbQ3MYxJXl/dJ0WI8MhhFJK0cKGxATzqDkyxV/q2yXPG12JHzutW8ovUPoPqAZmtAY Salrp4TfqubKQWVOY37LfPdW0FAUHo1q9gg//H6hg33o0FJfDIWo0r1vxyvh5GEDEOwo zjCOa3t0SBBLm/2eECgEUxjbTI5Y/NkSmtXMbFxi6en7MCbVUY+oATC9OBG9tcO0Xv5x 1ja2XxeVbuGnDaWaO5Reh/MgkzYk6K09oV2UPYVz96duojNX7YX6eWGHkc4ix5zkIuL1 ur9uY81cAbyzAYDBQJw7WQghseZ6Fb6q/gz6KKUiAol3DxxMBA0fvuoosxw96JHaBSdL nkrg== X-Gm-Message-State: AOAM531CrgnGwK9ihih3fnHRt9Qlj475iyLub8gDGd0lju3cJ+Wzq9It vYsdWEE94XmbO/9s9PiipjI= X-Google-Smtp-Source: ABdhPJyhPAd1LXY2+5CkKqYM5NhqD3WLHroYIAtxT93O8C6lDJj7W1VNnejcjvC9oTNiFfP6O8WmcA== X-Received: by 2002:a63:a847:: with SMTP id i7mr10257562pgp.203.1618877371509; Mon, 19 Apr 2021 17:09:31 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:30 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Anil Gurumurthy , Sudarsana Kalluru Subject: [PATCH 034/117] bfa: Use type int32_t to represent a signed integer Date: Mon, 19 Apr 2021 17:07:22 -0700 Message-Id: <20210420000845.25873-35-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since a negative value may be assigned to 'rc', use a signed type for that variable. Cc: Anil Gurumurthy Cc: Sudarsana Kalluru Fixes: b85daafe46ee ("[SCSI] bfa: Add BSG interface to support ELS, CT and vendor commands.") Signed-off-by: Bart Van Assche --- drivers/scsi/bfa/bfad_bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index be8dfbe13e90..371856bc67a8 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -3552,7 +3552,7 @@ bfad_im_bsg_request(struct bsg_job *job) { struct fc_bsg_request *bsg_request = job->request; struct fc_bsg_reply *bsg_reply = job->reply; - uint32_t rc = BFA_STATUS_OK; + int32_t rc = BFA_STATUS_OK; switch (bsg_request->msgcode) { case FC_BSG_HST_VENDOR: From patchwork Tue Apr 20 00:07:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC7C6C433B4 for ; Tue, 20 Apr 2021 00:09:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B956961363 for ; Tue, 20 Apr 2021 00:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233645AbhDTAKV (ORCPT ); Mon, 19 Apr 2021 20:10:21 -0400 Received: from mail-pl1-f176.google.com ([209.85.214.176]:42693 "EHLO mail-pl1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233465AbhDTAKE (ORCPT ); Mon, 19 Apr 2021 20:10:04 -0400 Received: by mail-pl1-f176.google.com with SMTP id v13so5082332ple.9 for ; Mon, 19 Apr 2021 17:09:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8VlAWm93j2qjH61U7fZQAvmeRW038m4/ro9Cv0tDe0o=; b=nVNIzRutr59q+X8yQ1qE0dWEwl/13rVeonuWc/Ivq3Bi0rPVKIaoXUTjytlxY/sp4O sGhVk2ZOOEUys4xmXTgD0vTCN8pbeDmv1nDNlUp3tcV6Fk0Om7K4BRKIPgv4mahckIlN leEc4C53X7pFJ+OL63jGx6thaCQ8EYiIWi76kV4f1giMUL1ht3/xY1WFfXsIyqmF47ES jQmvjj1nF111x4hB5oI0n/E+/JmOHU9nWqBCAASMLeqD2Iu11X0CHaSJXMY1BIPIpiU+ 3gxLWvcO7mAFEAIGabSK+7Rob1yKRNkJF/f3k7cfSBapjAeakWX/FIhJsDliKnUobtxi BU2Q== X-Gm-Message-State: AOAM530EtOqPJN8avsNOQgf6clm0ewYRWDVrpR2kvq3Ultr3L7b7ve7D gK1dqSWGW381bLKe0NlEZ3yrepSL2YRXvA== X-Google-Smtp-Source: ABdhPJzg1S0PBqx4gil/KHaLWS3o5HwscU6Htmjtggseqxng1BkC20bidVbHLLc5cFCp3ah/6eXMOA== X-Received: by 2002:a17:90a:e00f:: with SMTP id u15mr1778563pjy.26.1618877374090; Mon, 19 Apr 2021 17:09:34 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:33 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Saurav Kashyap , Javed Hasan , GR-QLogic-Storage-Upstream@marvell.com Subject: [PATCH 036/117] bnx2fc: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:24 -0700 Message-Id: <20210420000845.25873-37-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Saurav Kashyap Cc: Javed Hasan Cc: GR-QLogic-Storage-Upstream@marvell.com Signed-off-by: Bart Van Assche --- drivers/scsi/bnx2fc/bnx2fc_io.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 1a0dc18d6915..9ae826fd3294 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c @@ -198,10 +198,10 @@ static void bnx2fc_scsi_done(struct bnx2fc_cmd *io_req, int err_code) return; } - sc_cmd->result = err_code << 16; + sc_cmd->status.combined = err_code << 16; BNX2FC_IO_DBG(io_req, "sc=%p, result=0x%x, retries=%d, allowed=%d\n", - sc_cmd, host_byte(sc_cmd->result), sc_cmd->retries, + sc_cmd, host_byte(sc_cmd->status), sc_cmd->retries, sc_cmd->allowed); scsi_set_resid(sc_cmd, scsi_bufflen(sc_cmd)); sc_cmd->SCp.ptr = NULL; @@ -1579,10 +1579,10 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req, case FC_GOOD: if (io_req->cdb_status == 0) { /* Good IO completion */ - sc_cmd->result = DID_OK << 16; + sc_cmd->status.combined = 0; } else { /* Transport status is good, SCSI status not good */ - sc_cmd->result = (DID_OK << 16) | io_req->cdb_status; + sc_cmd->status.combined = io_req->cdb_status; } if (io_req->fcp_resid) scsi_set_resid(sc_cmd, io_req->fcp_resid); @@ -1851,7 +1851,7 @@ int bnx2fc_queuecommand(struct Scsi_Host *host, rval = fc_remote_port_chkready(rport); if (rval) { - sc_cmd->result = rval; + sc_cmd->status.combined = rval; sc_cmd->scsi_done(sc_cmd); return 0; } @@ -1974,13 +1974,13 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, case FC_GOOD: if (io_req->cdb_status == 0) { /* Good IO completion */ - sc_cmd->result = DID_OK << 16; + sc_cmd->status.combined = 0; } else { /* Transport status is good, SCSI status not good */ BNX2FC_IO_DBG(io_req, "scsi_cmpl: cdb_status = %d" " fcp_resid = 0x%x\n", io_req->cdb_status, io_req->fcp_resid); - sc_cmd->result = (DID_OK << 16) | io_req->cdb_status; + sc_cmd->status.combined = io_req->cdb_status; if (io_req->cdb_status == SAM_STAT_TASK_SET_FULL || io_req->cdb_status == SAM_STAT_BUSY) { From patchwork Tue Apr 20 00:07:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F554C43460 for ; Tue, 20 Apr 2021 00:09:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02F9B6109E for ; Tue, 20 Apr 2021 00:09:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233225AbhDTAKY (ORCPT ); Mon, 19 Apr 2021 20:10:24 -0400 Received: from mail-pg1-f181.google.com ([209.85.215.181]:39445 "EHLO mail-pg1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232986AbhDTAKI (ORCPT ); Mon, 19 Apr 2021 20:10:08 -0400 Received: by mail-pg1-f181.google.com with SMTP id s22so4290808pgk.6 for ; Mon, 19 Apr 2021 17:09:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yGpyfe1y9hdi7f1v0mhsqFa9PYwPbUjfmXXPgGJ412U=; b=Fx9EZsRi59vBf8GHvF26EUVHBdsmOZtei13gw2VJ1zx2GtdlQZ11OQzkfT9KI8t/Or b9u39v/NkiiGJRqbvZVNx5RGlyHQ0TJulX/aNOmsFPEh/eXKO4U33OGKXiHXF9Ax0hdj OVwiqwJhtlghFBY0BWAx0hNuhlR6/rqc0c7tTwdnap914LCsl7bYXszEI7OiCqzqvqPE uW503o8kRbB2A0v+nNdgNKN+13rDUo3aDyYgDmgvglWHAHR6Xv29j9BEM6KXKP5Kb24B gIGJKlnhdSXZ8CdNGGwvzXgoIVYhpnQB5gSwnvom97kCMIS+wwq8fCIOni7P6I4O5XZK zxUw== X-Gm-Message-State: AOAM533Ode7xBaS5efsHlsMhAHI7l/ZPdnJN/VKn37p00AFfenImAT1h 0TNw4o9gQHYMlKhAArEz+a0= X-Google-Smtp-Source: ABdhPJxLBV+gkulKQ6zpaWxp9+GKQN5rHrOuOvGyzkWA+gL0aOcRyYAzw6NDx0DCm8gEOctXAsgbWg== X-Received: by 2002:a63:ff0a:: with SMTP id k10mr14530972pgi.303.1618877377405; Mon, 19 Apr 2021 17:09:37 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:36 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Manoj N . Kumar" , "Matthew R . Ochs" , Uma Krishnan Subject: [PATCH 039/117] cxlflash: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:27 -0700 Message-Id: <20210420000845.25873-40-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Manoj N. Kumar Cc: Matthew R. Ochs Cc: Uma Krishnan Signed-off-by: Bart Van Assche --- drivers/scsi/cxlflash/main.c | 32 +++++++++++++++---------------- drivers/scsi/cxlflash/superpipe.c | 16 ++++++++-------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index dc36531d589e..8c5c28f29911 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -59,7 +59,7 @@ static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp) if (ioasa->rc.flags & SISL_RC_FLAGS_OVERRUN) { dev_dbg(dev, "%s: cmd underrun cmd = %p scp = %p\n", __func__, cmd, scp); - scp->result = (DID_ERROR << 16); + scp->status.combined = (DID_ERROR << 16); } dev_dbg(dev, "%s: cmd failed afu_rc=%02x scsi_rc=%02x fc_rc=%02x " @@ -72,20 +72,20 @@ static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp) if (ioasa->rc.flags & SISL_RC_FLAGS_SENSE_VALID) { memcpy(scp->sense_buffer, ioasa->sense_data, SISL_SENSE_DATA_LEN); - scp->result = ioasa->rc.scsi_rc; + scp->status.combined = ioasa->rc.scsi_rc; } else - scp->result = ioasa->rc.scsi_rc | (DID_ERROR << 16); + scp->status.combined = ioasa->rc.scsi_rc | (DID_ERROR << 16); } /* - * We encountered an error. Set scp->result based on nature + * We encountered an error. Set scp->status based on nature * of error. */ if (ioasa->rc.fc_rc) { /* We have an FC status */ switch (ioasa->rc.fc_rc) { case SISL_FC_RC_LINKDOWN: - scp->result = (DID_REQUEUE << 16); + scp->status.combined = (DID_REQUEUE << 16); break; case SISL_FC_RC_RESID: /* This indicates an FCP resid underrun */ @@ -95,7 +95,7 @@ static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp) * If not then we must handle it here. * This is probably an AFU bug. */ - scp->result = (DID_ERROR << 16); + scp->status.combined = (DID_ERROR << 16); } break; case SISL_FC_RC_RESIDERR: @@ -108,7 +108,7 @@ static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp) case SISL_FC_RC_WRABORTPEND: case SISL_FC_RC_NOEXP: case SISL_FC_RC_INUSE: - scp->result = (DID_ERROR << 16); + scp->status.combined = (DID_ERROR << 16); break; } } @@ -117,25 +117,25 @@ static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp) /* We have an AFU error */ switch (ioasa->rc.afu_rc) { case SISL_AFU_RC_NO_CHANNELS: - scp->result = (DID_NO_CONNECT << 16); + scp->status.combined = (DID_NO_CONNECT << 16); break; case SISL_AFU_RC_DATA_DMA_ERR: switch (ioasa->afu_extra) { case SISL_AFU_DMA_ERR_PAGE_IN: /* Retry */ - scp->result = (DID_IMM_RETRY << 16); + scp->status.combined = (DID_IMM_RETRY << 16); break; case SISL_AFU_DMA_ERR_INVALID_EA: default: - scp->result = (DID_ERROR << 16); + scp->status.combined = (DID_ERROR << 16); } break; case SISL_AFU_RC_OUT_OF_DATA_BUFS: /* Retry */ - scp->result = (DID_ALLOC_FAILURE << 16); + scp->status.combined = (DID_ALLOC_FAILURE << 16); break; default: - scp->result = (DID_ERROR << 16); + scp->status.combined = (DID_ERROR << 16); } } } @@ -167,10 +167,10 @@ static void cmd_complete(struct afu_cmd *cmd) if (unlikely(cmd->sa.ioasc)) process_cmd_err(cmd, scp); else - scp->result = (DID_OK << 16); + scp->status.combined = (DID_OK << 16); dev_dbg_ratelimited(dev, "%s:scp=%p result=%08x ioasc=%08x\n", - __func__, scp, scp->result, cmd->sa.ioasc); + __func__, scp, scp->status.combined, cmd->sa.ioasc); scp->scsi_done(scp); } else if (cmd->cmd_tmf) { spin_lock_irqsave(&cfg->tmf_slock, lock_flags); @@ -204,7 +204,7 @@ static void flush_pending_cmds(struct hwq *hwq) if (cmd->scp) { scp = cmd->scp; - scp->result = (DID_IMM_RETRY << 16); + scp->status.combined = (DID_IMM_RETRY << 16); scp->scsi_done(scp); } else { cmd->cmd_aborted = true; @@ -600,7 +600,7 @@ static int cxlflash_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scp) goto out; case STATE_FAILTERM: dev_dbg_ratelimited(dev, "%s: device has failed\n", __func__); - scp->result = (DID_NO_CONNECT << 16); + scp->status.combined = (DID_NO_CONNECT << 16); scp->scsi_done(scp); rc = 0; goto out; diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c index ee11ec340654..4a19a154e237 100644 --- a/drivers/scsi/cxlflash/superpipe.c +++ b/drivers/scsi/cxlflash/superpipe.c @@ -336,7 +336,7 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli) u8 *cmd_buf = NULL; u8 *scsi_cmd = NULL; int rc = 0; - int result = 0; + union scsi_status result; int retry_cnt = 0; u32 to = CMD_TIMEOUT * HZ; @@ -357,26 +357,26 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli) /* Drop the ioctl read semahpore across lengthy call */ up_read(&cfg->ioctl_rwsem); - result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf, + result.combined = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf, CMD_BUFSIZE, NULL, &sshdr, to, CMD_RETRIES, 0, 0, NULL); down_read(&cfg->ioctl_rwsem); rc = check_state(cfg); if (rc) { dev_err(dev, "%s: Failed state result=%08x\n", - __func__, result); + __func__, result.combined); rc = -ENODEV; goto out; } if (driver_byte(result) == DRIVER_SENSE) { - result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */ - if (result & SAM_STAT_CHECK_CONDITION) { + result.b.driver = DRIVER_OK; /* DRIVER_SENSE is not an error */ + if (result.b.status & SAM_STAT_CHECK_CONDITION) { switch (sshdr.sense_key) { case NO_SENSE: case RECOVERED_ERROR: case NOT_READY: - result &= ~SAM_STAT_CHECK_CONDITION; + result.b.status &= ~SAM_STAT_CHECK_CONDITION; break; case UNIT_ATTENTION: switch (sshdr.asc) { @@ -398,9 +398,9 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli) } } - if (result) { + if (result.combined) { dev_err(dev, "%s: command failed, result=%08x\n", - __func__, result); + __func__, result.combined); rc = -EIO; goto out; } From patchwork Tue Apr 20 00:07:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E27AC433ED for ; Tue, 20 Apr 2021 00:09:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22E2E6109E for ; Tue, 20 Apr 2021 00:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230382AbhDTAKZ (ORCPT ); Mon, 19 Apr 2021 20:10:25 -0400 Received: from mail-pj1-f44.google.com ([209.85.216.44]:41956 "EHLO mail-pj1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233570AbhDTAKK (ORCPT ); Mon, 19 Apr 2021 20:10:10 -0400 Received: by mail-pj1-f44.google.com with SMTP id y22-20020a17090a8b16b0290150ae1a6d2bso2541592pjn.0 for ; Mon, 19 Apr 2021 17:09:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d9FdBKQgIaEDCc3LsQu6uWep6uErvCjZ3+grnSx6rQQ=; b=p9IE9WUHs7epBaIuSH7ofzobqd7xNYDtreWE3NF72QiZLY6y5KohXXdHBG8j2InyS4 vWil/r595c74muh2zkegMEDfeBOJTHTVGzRa4Uocpznq1OstVFxc7j5ld4jY+JrQIAVy yKTrRjkBMPKsyFkUgEwYDWltwnY8Hza3+7oz9PSxc60+ued+lOwJyBlIrRNp6L6U9wU4 Na41FlcisU5PpU42mgfxpOH2eY8WqW1ezooaEOt4ZwTYgrAhML2gd63o47jk5vo2GYzC a7Mu3zL/6S1ivIn6Vun8Hhk9Ch4I9t6h6nvZuJMiR/Fzs1aUvSMGGMk3zNcGcgYco5Mv 5xzg== X-Gm-Message-State: AOAM531mznJH7nQrNUdF93oJ5bjcowXwQ1U0+b+AvAHoT7moYeyJh2Hp T1xiRLtqAL0p8KNXjpq01RU= X-Google-Smtp-Source: ABdhPJyS3XEXAW6Y8bo9W0R9Jm1rWxqd+3PoXLj+BI4ZzizcQF8bUrOAA3fhlPGqiuQxmw7pyudwJw== X-Received: by 2002:a17:902:dacd:b029:e5:cf71:3901 with SMTP id q13-20020a170902dacdb02900e5cf713901mr25021154plx.23.1618877378581; Mon, 19 Apr 2021 17:09:38 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:38 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Oliver Neukum , Ali Akcaagac , Jamie Lenehan Subject: [PATCH 040/117] dc395x: Use the set_{host, msg, status}_byte() functions Date: Mon, 19 Apr 2021 17:07:28 -0700 Message-Id: <20210420000845.25873-41-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use the set_{host,msg,status}_byte() functions instead of the SET_RES_*() macros. This patch does not change any functionality. Cc: Oliver Neukum Cc: Ali Akcaagac Cc: Jamie Lenehan Signed-off-by: Bart Van Assche --- drivers/scsi/dc395x.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index be87d5a7583d..6252352ddd96 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -160,22 +160,11 @@ #define DC395x_write16(acb,address,value) outw((value), acb->io_port_base + (address)) #define DC395x_write32(acb,address,value) outl((value), acb->io_port_base + (address)) -/* cmd->result */ -#define RES_TARGET 0x000000FF /* Target State */ -#define RES_TARGET_LNX STATUS_MASK /* Only official ... */ -#define RES_ENDMSG 0x0000FF00 /* End Message */ #define RES_DID 0x00FF0000 /* DID_ codes */ -#define RES_DRV 0xFF000000 /* DRIVER_ codes */ #define MK_RES(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt)) #define MK_RES_LNX(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt)<<1) -#define SET_RES_TARGET(who,tgt) { who &= ~RES_TARGET; who |= (int)(tgt); } -#define SET_RES_TARGET_LNX(who,tgt) { who &= ~RES_TARGET_LNX; who |= (int)(tgt) << 1; } -#define SET_RES_MSG(who,msg) { who &= ~RES_ENDMSG; who |= (int)(msg) << 8; } -#define SET_RES_DID(who,did) { who &= ~RES_DID; who |= (int)(did) << 16; } -#define SET_RES_DRV(who,drv) { who &= ~RES_DRV; who |= (int)(drv) << 24; } - #define TAG_NONE 255 /* @@ -3244,7 +3233,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, cmd->result = MK_RES_LNX(DRIVER_SENSE, DID_OK, srb->end_message, CHECK_CONDITION); - /*SET_RES_DID(cmd->result,DID_OK) */ + /*set_host_byte(cmd,DID_OK) */ else cmd->result = MK_RES_LNX(DRIVER_SENSE, DID_OK, @@ -3280,9 +3269,9 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, cmd->result = DID_NO_CONNECT << 16; } else { srb->adapter_status = 0; - SET_RES_DID(cmd->result, DID_ERROR); - SET_RES_MSG(cmd->result, srb->end_message); - SET_RES_TARGET(cmd->result, status); + set_host_byte(cmd, DID_ERROR); + set_msg_byte(cmd, srb->end_message); + set_status_byte(cmd, status); } } else { @@ -3292,16 +3281,16 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, status = srb->adapter_status; if (status & H_OVER_UNDER_RUN) { srb->target_status = 0; - SET_RES_DID(cmd->result, DID_OK); - SET_RES_MSG(cmd->result, srb->end_message); + set_host_byte(cmd, DID_OK); + set_msg_byte(cmd, srb->end_message); } else if (srb->status & PARITY_ERROR) { - SET_RES_DID(cmd->result, DID_PARITY); - SET_RES_MSG(cmd->result, srb->end_message); + set_host_byte(cmd, DID_PARITY); + set_msg_byte(cmd, srb->end_message); } else { /* No error */ srb->adapter_status = 0; srb->target_status = 0; - SET_RES_DID(cmd->result, DID_OK); + set_host_byte(cmd, DID_OK); } } From patchwork Tue Apr 20 00:07:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424936 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFFE9C43470 for ; Tue, 20 Apr 2021 00:09:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B45E5613AC for ; Tue, 20 Apr 2021 00:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229839AbhDTAK0 (ORCPT ); Mon, 19 Apr 2021 20:10:26 -0400 Received: from mail-pf1-f181.google.com ([209.85.210.181]:41903 "EHLO mail-pf1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233002AbhDTAKL (ORCPT ); Mon, 19 Apr 2021 20:10:11 -0400 Received: by mail-pf1-f181.google.com with SMTP id w6so9773669pfc.8 for ; Mon, 19 Apr 2021 17:09:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0TwEJi+WVV7aYATsNLmd7donpiIIqPRjM15W38iQPEc=; b=T+3A+XgGoj5uapm/35bp4YYVuAcMFkUXYIxMxhfkY7wPM03dmUvY8a0QG40uJvXszM 4tnXN3COjnPHuxUi0DQpXZyG8R5SO9Lo/W/4Lj1wUielW/+1pW/I01oehhnOVyifFR0H adpEq601qdKL8Vm5J7YH+JM8Vmd1b6DlLlYTXJdeBBBz/P/0FbpCfDSyq0irbtWvEtE1 TPmnbm3l503p7uMKhl+0eqlIdPM82Yzdj9sDy+ahGIdNyYLdHC00CntMA1Em4apXXtXj DPj+ZvC0fCYf7wGnBbbJhldpdeev0GDlCAKpGx1jDHolRAPhihAV2rSBRx8OL4mLVD6D fcJg== X-Gm-Message-State: AOAM532w37D2A4gpkloDLk5Uhf+knqmBA2ERQ0q+No/Rk3P2W90fqucr gy4MiE2mEVAC99fmkWa+3rw= X-Google-Smtp-Source: ABdhPJw0Z+mRgmHUDEzccEX9I+7+y6oAxduy4SyFmA0/KcN3S1EJyGSjNDisKXqDljkCfd+kcYAuGg== X-Received: by 2002:aa7:9190:0:b029:22d:6789:cc83 with SMTP id x16-20020aa791900000b029022d6789cc83mr22604715pfa.9.1618877380814; Mon, 19 Apr 2021 17:09:40 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:40 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Adaptec OEM Raid Solutions Subject: [PATCH 042/117] dpt_i2o: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:30 -0700 Message-Id: <20210420000845.25873-43-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Adaptec OEM Raid Solutions Signed-off-by: Bart Van Assche --- drivers/scsi/dpt_i2o.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index a18a4a08f049..30a8d4817dab 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -430,7 +430,7 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd */ if ((cmd->cmnd[0] == REQUEST_SENSE) && (cmd->sense_buffer[0] != 0)) { - cmd->result = (DID_OK << 16); + cmd->status.combined = (DID_OK << 16); cmd->scsi_done(cmd); return 0; } @@ -455,7 +455,7 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd if ((pDev = adpt_find_device(pHba, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun)) == NULL) { // TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response // with type 7F (for all luns less than the max for this bus,id) so the lun scan will continue. - cmd->result = (DID_NO_CONNECT << 16); + cmd->status.combined = (DID_NO_CONNECT << 16); cmd->scsi_done(cmd); return 0; } @@ -2226,7 +2226,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d default: printk(KERN_WARNING"%s: scsi opcode 0x%x not supported.\n", pHba->name, cmd->cmnd[0]); - cmd->result = (DID_ERROR <<16); + cmd->status.combined = DID_ERROR << 16; cmd->scsi_done(cmd); return 0; } @@ -2359,15 +2359,15 @@ static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd) if(!(reply_flags & MSG_FAIL)) { switch(detailed_status & I2O_SCSI_DSC_MASK) { case I2O_SCSI_DSC_SUCCESS: - cmd->result = (DID_OK << 16); + cmd->status.combined = (DID_OK << 16); // handle underflow if (readl(reply+20) < cmd->underflow) { - cmd->result = (DID_ERROR <<16); + cmd->status.combined = DID_ERROR << 16; printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name); } break; case I2O_SCSI_DSC_REQUEST_ABORTED: - cmd->result = (DID_ABORT << 16); + cmd->status.combined = (DID_ABORT << 16); break; case I2O_SCSI_DSC_PATH_INVALID: case I2O_SCSI_DSC_DEVICE_NOT_PRESENT: @@ -2377,19 +2377,19 @@ static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd) case I2O_SCSI_DSC_RESOURCE_UNAVAILABLE: printk(KERN_WARNING"%s: SCSI Timeout-Device (%d,%d,%llu) hba status=0x%x, dev status=0x%x, cmd=0x%x\n", pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]); - cmd->result = (DID_TIME_OUT << 16); + cmd->status.combined = (DID_TIME_OUT << 16); break; case I2O_SCSI_DSC_ADAPTER_BUSY: case I2O_SCSI_DSC_BUS_BUSY: - cmd->result = (DID_BUS_BUSY << 16); + cmd->status.combined = (DID_BUS_BUSY << 16); break; case I2O_SCSI_DSC_SCSI_BUS_RESET: case I2O_SCSI_DSC_BDR_MESSAGE_SENT: - cmd->result = (DID_RESET << 16); + cmd->status.combined = (DID_RESET << 16); break; case I2O_SCSI_DSC_PARITY_ERROR_FAILURE: printk(KERN_WARNING"%s: SCSI CMD parity error\n",pHba->name); - cmd->result = (DID_PARITY << 16); + cmd->status.combined = (DID_PARITY << 16); break; case I2O_SCSI_DSC_UNABLE_TO_ABORT: case I2O_SCSI_DSC_COMPLETE_WITH_ERROR: @@ -2418,7 +2418,7 @@ static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd) printk(KERN_WARNING"%s: SCSI error %0x-Device(%d,%d,%llu) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n", pHba->name, detailed_status & I2O_SCSI_DSC_MASK, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]); - cmd->result = (DID_ERROR << 16); + cmd->status.combined = (DID_ERROR << 16); break; } @@ -2431,7 +2431,7 @@ static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd) if(cmd->sense_buffer[0] == 0x70 /* class 7 */ && cmd->sense_buffer[2] == DATA_PROTECT ){ /* This is to handle an array failed */ - cmd->result = (DID_TIME_OUT << 16); + cmd->status.combined = (DID_TIME_OUT << 16); printk(KERN_WARNING"%s: SCSI Data Protect-Device (%d,%d,%llu) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n", pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]); @@ -2443,13 +2443,13 @@ static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd) * the card rejected it. We should signal a retry * for a limitted number of retries. */ - cmd->result = (DID_TIME_OUT << 16); + cmd->status.combined = (DID_TIME_OUT << 16); printk(KERN_WARNING"%s: I2O MSG_FAIL - Device (%d,%d,%llu) tid=%d, cmd=0x%x\n", pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, ((struct adpt_device*)(cmd->device->hostdata))->tid, cmd->cmnd[0]); } - cmd->result |= (dev_status); + cmd->status.combined |= (dev_status); if(cmd->scsi_done != NULL){ cmd->scsi_done(cmd); From patchwork Tue Apr 20 00:07:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BE03C43600 for ; Tue, 20 Apr 2021 00:09:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 78F34613AA for ; Tue, 20 Apr 2021 00:09:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233604AbhDTAK1 (ORCPT ); Mon, 19 Apr 2021 20:10:27 -0400 Received: from mail-pj1-f42.google.com ([209.85.216.42]:33774 "EHLO mail-pj1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233632AbhDTAKN (ORCPT ); Mon, 19 Apr 2021 20:10:13 -0400 Received: by mail-pj1-f42.google.com with SMTP id kb13-20020a17090ae7cdb02901503d67f0beso397725pjb.0 for ; Mon, 19 Apr 2021 17:09:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6i3dul2nqK3b2IAOlko0yNKzep22prs4WbyldnpEDUU=; b=dYXeN7fEx0sDiXkR51MDHtCzgc17Ag1JVG1RYaVXNjKD9rdWVVH3s2K/QkGFtmJOqS RfvSv0/cGWq/T+/h3IsaAdqBQ5YqXR2IVYx/dlYgGJsfuBXvxYfvosGJcSZ6H2xzu4Vf kI5LLKdWxJ6NBy7xoqZZRUsTdnUbSoV06sdlsG21bd12dLLqlVoseVsAV5jm10nVvCN9 W54r3h6+7nVt0HwPLyGPwVqhxTqhfk3J/SHLaHEhs/tl4dEWN78S/IoJb5AtZDZ42xv3 75a9W2Fnsz11WKyriO8gkVo9CvsmBXyUTV7YfLs+IPcrRJCJSAP3FHGEaMRZ2+TBMRU7 gozw== X-Gm-Message-State: AOAM531RRcfR3uqIQEPK8m2CqGFYtoY2zr2B7UBZqHi3ulWSFptqXFFG H1TgIzolGgKi8WT08m7X7rR1FbwEodXgMw== X-Google-Smtp-Source: ABdhPJxJ7kKtcNN8tTSOHKAMe0MXA6sSUBVbeV+Ki7aPjdXWklOUoOnrcrMattIYHpnJ8ItPttg5HQ== X-Received: by 2002:a17:902:7795:b029:ec:b1ca:de75 with SMTP id o21-20020a1709027795b02900ecb1cade75mr3468572pll.70.1618877381912; Mon, 19 Apr 2021 17:09:41 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:41 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Bradley Grove Subject: [PATCH 043/117] esas2r: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:31 -0700 Message-Id: <20210420000845.25873-44-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Bradley Grove Signed-off-by: Bart Van Assche --- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h index ed63f7a9ea54..3823ec7909c4 100644 --- a/drivers/scsi/esas2r/esas2r.h +++ b/drivers/scsi/esas2r/esas2r.h @@ -1010,7 +1010,7 @@ void esas2r_complete_request_cb(struct esas2r_adapter *a, void esas2r_reset_detected(struct esas2r_adapter *a); void esas2r_target_state_changed(struct esas2r_adapter *ha, u16 targ_id, u8 state); -int esas2r_req_status_to_error(u8 req_stat); +enum host_status esas2r_req_status_to_error(u8 req_stat); void esas2r_kill_adapter(int i); void esas2r_free_request(struct esas2r_adapter *a, struct esas2r_request *rq); struct esas2r_request *esas2r_alloc_request(struct esas2r_adapter *a); diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c index a9dd6345f064..0967bfc751cc 100644 --- a/drivers/scsi/esas2r/esas2r_main.c +++ b/drivers/scsi/esas2r/esas2r_main.c @@ -824,10 +824,10 @@ int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) unsigned bufflen; /* Assume success, if it fails we will fix the result later. */ - cmd->result = DID_OK << 16; + cmd->status.combined = DID_OK << 16; if (unlikely(test_bit(AF_DEGRADED_MODE, &a->flags))) { - cmd->result = DID_NO_CONNECT << 16; + cmd->status.combined = DID_NO_CONNECT << 16; cmd->scsi_done(cmd); return 0; } @@ -984,7 +984,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd) esas2r_log(ESAS2R_LOG_INFO, "eh_abort (%p)", cmd); if (test_bit(AF_DEGRADED_MODE, &a->flags)) { - cmd->result = DID_ABORT << 16; + cmd->status.combined = DID_ABORT << 16; scsi_set_resid(cmd, 0); @@ -1050,7 +1050,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd) * freed it, or we didn't find it at all. Either way, success! */ - cmd->result = DID_ABORT << 16; + cmd->status.combined = DID_ABORT << 16; scsi_set_resid(cmd, 0); @@ -1523,7 +1523,7 @@ void esas2r_complete_request_cb(struct esas2r_adapter *a, rq->func_rsp.scsi_rsp.scsi_stat, rq->cmd); - rq->cmd->result = + rq->cmd->status.combined = ((esas2r_req_status_to_error(rq->req_stat) << 16) | (rq->func_rsp.scsi_rsp.scsi_stat & STATUS_MASK)); @@ -1873,7 +1873,7 @@ void esas2r_target_state_changed(struct esas2r_adapter *a, u16 targ_id, } /* Translate status to a Linux SCSI mid-layer error code */ -int esas2r_req_status_to_error(u8 req_stat) +enum host_status esas2r_req_status_to_error(u8 req_stat) { switch (req_stat) { case RS_OVERRUN: From patchwork Tue Apr 20 00:07:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424934 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F37AC43603 for ; Tue, 20 Apr 2021 00:09:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24F626109E for ; Tue, 20 Apr 2021 00:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233648AbhDTAK1 (ORCPT ); Mon, 19 Apr 2021 20:10:27 -0400 Received: from mail-pj1-f51.google.com ([209.85.216.51]:35791 "EHLO mail-pj1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbhDTAKP (ORCPT ); Mon, 19 Apr 2021 20:10:15 -0400 Received: by mail-pj1-f51.google.com with SMTP id j21-20020a17090ae615b02901505b998b45so6028472pjy.0 for ; Mon, 19 Apr 2021 17:09:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kPO8cztLzNZArvuaWUEWmi7eEIQSF001uSkhS/0DFVA=; b=hWdmtQQmVp7IZhsu/RNedIB2hULl1VjjO8U/DnU6U5YnTEQtj0DnbrhiclI1rAZ7RQ y0XHLcGdB1VIOMG7+T/8fvRJSPVPZXSfJAD1W6V6oLEMe7+mSYdc27sc6aPtqAAa3BDU V0KNdJjrskBKT7bHcUU2ugMnY8BMFmHEY2O9K8lAJzfADOvAAauHVXVQNIsqZVVfhdhs 1XnVDNDTSeuiflT/t6HjKQb6P1WJBtEVAK+k6U9v+mzG5ZRJDpw+CKDsdajgJQJEAecN /mcQV1uzdkxmfzXVV9Ks7Z2NyEc0JJdmjBClz2C/C0YhSkY0wufm8VtE/pGtP2AS7lB0 XLZA== X-Gm-Message-State: AOAM531Xy+Mp+QODsE6SNMQS93bbp1FLwVpMgtxs5xvORJx0KBAiaH9Y Dun8LmYL6SAMaOVxdwMHZC4= X-Google-Smtp-Source: ABdhPJxTkj8RVmO2UX+2neIPxz/1uLiAD3xA8QCEMgf0nXr8pyciv4HzUq7c3m1GOJeBBXXbtND9zw== X-Received: by 2002:a17:902:b947:b029:ec:b04d:c8a2 with SMTP id h7-20020a170902b947b02900ecb04dc8a2mr3947676pls.2.1618877385259; Mon, 19 Apr 2021 17:09:45 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:44 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Russell King Subject: [PATCH 046/117] fas216: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:34 -0700 Message-Id: <20210420000845.25873-47-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Russell King Signed-off-by: Bart Van Assche --- drivers/scsi/arm/fas216.c | 40 ++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index b9ca25c77075..86fa59587a3b 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -399,7 +399,7 @@ static void print_debug_list(void) printk("\n"); } -static void fas216_done(FAS216_Info *info, unsigned int result); +static void fas216_done(FAS216_Info *info, enum host_status result); /** * fas216_get_last_msg - retrive last message from the list @@ -1986,7 +1986,7 @@ static void fas216_kick(FAS216_Info *info) * Clean up from issuing a BUS DEVICE RESET message to a device. */ static void fas216_devicereset_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, - unsigned int result) + enum host_status result) { fas216_log(info, LOG_ERROR, "fas216 device reset complete"); @@ -2004,7 +2004,7 @@ static void fas216_devicereset_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, * Finish processing automatic request sense command */ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, - unsigned int result) + enum host_status result) { fas216_log_target(info, LOG_CONNECT, SCpnt->device->id, "request sense complete, result=0x%04x%02x%02x", @@ -2020,7 +2020,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, //printk("scsi%d.%c: sense buffer: ", info->host->host_no, '0' + SCpnt->device->id); //{ int i; for (i = 0; i < 32; i++) printk("%02x ", SCpnt->sense_buffer[i]); printk("\n"); } /* - * Note that we don't set SCpnt->result, since that should + * Note that we don't set SCpnt->status since that should * reflect the status of the command that we were asked by * the upper layers to process. This would have been set * correctly by fas216_std_done. @@ -2038,36 +2038,38 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, * Finish processing of standard command */ static void -fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) +fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, + enum host_status result) { info->stats.fins += 1; - SCpnt->result = result << 16 | info->scsi.SCp.Message << 8 | - info->scsi.SCp.Status; + SCpnt->status = (union scsi_status){.b.host = result, + .b.msg = info->scsi.SCp.Message, + .b.status = info->scsi.SCp.Status}; fas216_log_command(info, LOG_CONNECT, SCpnt, - "command complete, result=0x%08x", SCpnt->result); + "command complete, result=0x%08x", SCpnt->status.combined); /* * If the driver detected an error, we're all done. */ - if (host_byte(SCpnt->result) != DID_OK || - msg_byte(SCpnt->result) != COMMAND_COMPLETE) + if (host_byte(SCpnt->status) != DID_OK || + msg_byte(SCpnt->status) != COMMAND_COMPLETE) goto done; /* * If the command returned CHECK_CONDITION or COMMAND_TERMINATED * status, request the sense information. */ - if (status_byte(SCpnt->result) == CHECK_CONDITION || - status_byte(SCpnt->result) == COMMAND_TERMINATED) + if (status_byte(SCpnt->status) == CHECK_CONDITION || + status_byte(SCpnt->status) == COMMAND_TERMINATED) goto request_sense; /* * If the command did not complete with GOOD status, * we are all done here. */ - if (status_byte(SCpnt->result) != GOOD) + if (status_byte(SCpnt->status) != GOOD) goto done; /* @@ -2087,7 +2089,7 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) default: scmd_printk(KERN_ERR, SCpnt, "incomplete data transfer detected: res=%08X ptr=%p len=%X\n", - SCpnt->result, info->scsi.SCp.ptr, + SCpnt->status.combined, info->scsi.SCp.ptr, info->scsi.SCp.this_residual); scsi_print_command(SCpnt); set_host_byte(SCpnt, DID_ERROR); @@ -2132,13 +2134,13 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) /** * fas216_done - complete processing for current command * @info: interface that completed - * @result: driver byte of result + * @result: host byte of result * * Complete processing for current command */ -static void fas216_done(FAS216_Info *info, unsigned int result) +static void fas216_done(FAS216_Info *info, enum host_status result) { - void (*fn)(FAS216_Info *, struct scsi_cmnd *, unsigned int); + void (*fn)(FAS216_Info *, struct scsi_cmnd *, enum host_status); struct scsi_cmnd *SCpnt; unsigned long flags; @@ -2178,7 +2180,7 @@ static void fas216_done(FAS216_Info *info, unsigned int result) clear_bit(SCpnt->device->id * 8 + (u8)(SCpnt->device->lun & 0x7), info->busyluns); - fn = (void (*)(FAS216_Info *, struct scsi_cmnd *, unsigned int))SCpnt->host_scribble; + fn = (void *)SCpnt->host_scribble; fn(info, SCpnt, result); if (info->scsi.irq) { @@ -2216,7 +2218,7 @@ static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt, SCpnt->scsi_done = done; SCpnt->host_scribble = (void *)fas216_std_done; - SCpnt->result = 0; + SCpnt->status.combined = 0; init_SCp(SCpnt); From patchwork Tue Apr 20 00:07:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 043C4C43461 for ; Tue, 20 Apr 2021 00:10:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D323461363 for ; Tue, 20 Apr 2021 00:09:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233669AbhDTAK2 (ORCPT ); Mon, 19 Apr 2021 20:10:28 -0400 Received: from mail-pj1-f49.google.com ([209.85.216.49]:35791 "EHLO mail-pj1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233360AbhDTAKS (ORCPT ); Mon, 19 Apr 2021 20:10:18 -0400 Received: by mail-pj1-f49.google.com with SMTP id j21-20020a17090ae615b02901505b998b45so6028529pjy.0 for ; Mon, 19 Apr 2021 17:09:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nL9cxygs1wA1Iy23q/ju/a4ZANjJRPco9wm6Co0e7Wc=; b=TD8O1EgNSabDeUJWo4ciXr6YGSs+8x6CXvYc1pvIhHDVm25vIx3WpOvGtLHdcFC2Sm qOQyzaGDeDUUCxBTrVFZNveYBp0bCpoM+FLAvqtDO/YXiljWWOsySSW0mfIBc4Bzem8k IsIXHfcqAqjxTaM2rS/6jeW5x7BlBNgW6sjI3AJzV9Mjpu7is+j7B8pjaCoC5ojlrtxE K6tkXKv95ZsAMn+27p+nUApRTVxIfgfXnxlSDh2kBbesOwe1bPUi1quuXGeZfH7OewbK Cr79nEdGY/5OTTSGzLAuae+KwBE/P2mRQ+HkkkBDofSdU1FcyNh6CaRAVRuFr91P2T0s wBzg== X-Gm-Message-State: AOAM533nz0w9s6foOpsTx7+GS+2vFoKozGXgyTpwpbTj8hGNTmsYFtyA EDbRzoMF4zLmCKb60sLGzAY= X-Google-Smtp-Source: ABdhPJxanPHQao3CEr1XhwSjXNFoXJbbCW+LOJhOCWNG/XFdxvRTsHiF5Ap4hAcXpHaNAkbMrN8t2g== X-Received: by 2002:a17:902:59d4:b029:ea:bbc5:c775 with SMTP id d20-20020a17090259d4b02900eabbc5c775mr25980609plj.11.1618877387425; Mon, 19 Apr 2021 17:09:47 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:46 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 048/117] fdomain: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:36 -0700 Message-Id: <20210420000845.25873-49-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Signed-off-by: Bart Van Assche --- drivers/scsi/fdomain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 772bdc93930a..a985a15588dc 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c @@ -206,7 +206,7 @@ static void fdomain_finish_cmd(struct fdomain *fd, int result) { outb(0, fd->base + REG_ICTL); fdomain_make_bus_idle(fd); - fd->cur_cmd->result = result; + fd->cur_cmd->status.combined = result; fd->cur_cmd->scsi_done(fd->cur_cmd); fd->cur_cmd = NULL; } @@ -439,7 +439,7 @@ static int fdomain_abort(struct scsi_cmnd *cmd) fdomain_make_bus_idle(fd); fd->cur_cmd->SCp.phase |= aborted; - fd->cur_cmd->result = DID_ABORT << 16; + fd->cur_cmd->status.combined = DID_ABORT << 16; /* Aborts are not done well. . . */ fdomain_finish_cmd(fd, DID_ABORT << 16); From patchwork Tue Apr 20 00:07:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424932 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 506E6C433ED for ; Tue, 20 Apr 2021 00:10:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 280416109E for ; Tue, 20 Apr 2021 00:10:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233736AbhDTAKa (ORCPT ); Mon, 19 Apr 2021 20:10:30 -0400 Received: from mail-pl1-f181.google.com ([209.85.214.181]:35416 "EHLO mail-pl1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233156AbhDTAKU (ORCPT ); Mon, 19 Apr 2021 20:10:20 -0400 Received: by mail-pl1-f181.google.com with SMTP id e9so1695641plj.2 for ; Mon, 19 Apr 2021 17:09:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2qvxVa6iVc0a+8az0ddZrswZIYaKQqoWuNMljUhUyXE=; b=D/NslOcjXk6iotx/Z/E2gpkly8z+Gev5DX+R9dC8vHuccCu73IKAuOYdrv9FxnbV4k /u/VxSvr8UOg0fu0HbFDGX0CFMIFhJGtGsL3gvHPeCZw8oXwT9KF0dit3XHT0D4YgOjs lVmRWj0vA9sJmTAnUQ6gHHreIAImkaLiqMOEex8g2XLFz78GUBxkCTCP4MrKOwhaayiN pexc7ZmccvGkyUS7z9IKoXYtPFIrowzZwAs7PV98ma/6gW3oVugd6AxKMiwhwrfBZz01 egxIrDLMjsYPIyfCzaxwFm7WZEYIRrlgSuQVKzvzpLTAcCDw8OkFXCc0RNo7tvUQp9xH g/cA== X-Gm-Message-State: AOAM530lMfW2FUtFI+vlfh51bgJBzqCFaJwqGcIbA+g9x6eHg5y6Qz6J bYXTfZ4iY9qqGgaUKhEHi08= X-Google-Smtp-Source: ABdhPJx4VFVNRKejXBN5yVkwlFt8AW0J+EmnQRcxdGcfATqhivL55wXqpgliijkaUw55EF1qWV+EjA== X-Received: by 2002:a17:902:6544:b029:ea:f94e:9d4e with SMTP id d4-20020a1709026544b02900eaf94e9d4emr26090035pln.16.1618877389719; Mon, 19 Apr 2021 17:09:49 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:49 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Satish Kharat , Sesidhar Baddela , Karan Tilak Kumar Subject: [PATCH 050/117] fnic: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:38 -0700 Message-Id: <20210420000845.25873-51-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Satish Kharat Cc: Sesidhar Baddela Cc: Karan Tilak Kumar Signed-off-by: Bart Van Assche --- drivers/scsi/fnic/fnic_scsi.c | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index e619a82f921b..9e7afb827f8e 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -447,7 +447,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ if (!rport) { FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "returning DID_NO_CONNECT for IO as rport is NULL\n"); - sc->result = DID_NO_CONNECT << 16; + sc->status.combined = DID_NO_CONNECT << 16; done(sc); return 0; } @@ -457,7 +457,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "rport is not ready\n"); atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); - sc->result = ret; + sc->status.combined = ret; done(sc); return 0; } @@ -469,7 +469,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ rport->port_id); atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); - sc->result = DID_NO_CONNECT<<16; + sc->status.combined = DID_NO_CONNECT<<16; done(sc); return 0; } @@ -479,7 +479,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ "rport 0x%x in state 0x%x, returning DID_IMM_RETRY\n", rport->port_id, rp->rp_state); - sc->result = DID_IMM_RETRY << 16; + sc->status.combined = DID_IMM_RETRY << 16; done(sc); return 0; } @@ -919,7 +919,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic, switch (hdr_status) { case FCPIO_SUCCESS: - sc->result = (DID_OK << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_OK << 16) | icmnd_cmpl->scsi_status; xfer_len = scsi_bufflen(sc); if (icmnd_cmpl->flags & FCPIO_ICMND_CMPL_RESID_UNDER) { @@ -936,50 +936,50 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic, case FCPIO_TIMEOUT: /* request was timed out */ atomic64_inc(&fnic_stats->misc_stats.fcpio_timeout); - sc->result = (DID_TIME_OUT << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_TIME_OUT << 16) | icmnd_cmpl->scsi_status; break; case FCPIO_ABORTED: /* request was aborted */ atomic64_inc(&fnic_stats->misc_stats.fcpio_aborted); - sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; break; case FCPIO_DATA_CNT_MISMATCH: /* recv/sent more/less data than exp. */ atomic64_inc(&fnic_stats->misc_stats.data_count_mismatch); scsi_set_resid(sc, icmnd_cmpl->residual); - sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; break; case FCPIO_OUT_OF_RESOURCE: /* out of resources to complete request */ atomic64_inc(&fnic_stats->fw_stats.fw_out_of_resources); - sc->result = (DID_REQUEUE << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_REQUEUE << 16) | icmnd_cmpl->scsi_status; break; case FCPIO_IO_NOT_FOUND: /* requested I/O was not found */ atomic64_inc(&fnic_stats->io_stats.io_not_found); - sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; break; case FCPIO_SGL_INVALID: /* request was aborted due to sgl error */ atomic64_inc(&fnic_stats->misc_stats.sgl_invalid); - sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; break; case FCPIO_FW_ERR: /* request was terminated due fw error */ atomic64_inc(&fnic_stats->fw_stats.io_fw_errs); - sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; break; case FCPIO_MSS_INVALID: /* request was aborted due to mss error */ atomic64_inc(&fnic_stats->misc_stats.mss_invalid); - sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; break; case FCPIO_INVALID_HEADER: /* header contains invalid data */ case FCPIO_INVALID_PARAM: /* some parameter in request invalid */ case FCPIO_REQ_NOT_SUPPORTED:/* request type is not supported */ default: - sc->result = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; + sc->status.combined = (DID_ERROR << 16) | icmnd_cmpl->scsi_status; break; } @@ -1188,7 +1188,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "abts cmpl, completing IO\n"); CMD_SP(sc) = NULL; - sc->result = (DID_ERROR << 16); + sc->status.combined = (DID_ERROR << 16); spin_unlock_irqrestore(io_lock, flags); @@ -1418,7 +1418,7 @@ static void fnic_cleanup_io(struct fnic *fnic, int exclude_id) fnic_release_ioreq_buf(fnic, io_req, sc); mempool_free(io_req, fnic->io_req_pool); - sc->result = DID_TRANSPORT_DISRUPTED << 16; + sc->status.combined = DID_TRANSPORT_DISRUPTED << 16; FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "%s: tag:0x%x : sc:0x%p duration = %lu DID_TRANSPORT_DISRUPTED\n", __func__, sc->request->tag, sc, @@ -1494,7 +1494,7 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq, mempool_free(io_req, fnic->io_req_pool); wq_copy_cleanup_scsi_cmd: - sc->result = DID_NO_CONNECT << 16; + sc->status.combined = DID_NO_CONNECT << 16; FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "wq_copy_cleanup_handler:" " DID_NO_CONNECT\n"); @@ -2039,7 +2039,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) if (sc->scsi_done) { /* Call SCSI completion function to complete the IO */ - sc->result = (DID_ABORT << 16); + sc->status.combined = (DID_ABORT << 16); sc->scsi_done(sc); atomic64_dec(&fnic_stats->io_stats.active_ios); if (atomic64_read(&fnic->io_cmpl_skip)) @@ -2272,7 +2272,7 @@ static int fnic_clean_pending_aborts(struct fnic *fnic, */ if (sc->scsi_done) { /* Set result to let upper SCSI layer retry */ - sc->result = DID_RESET << 16; + sc->status.combined = DID_RESET << 16; sc->scsi_done(sc); } } From patchwork Tue Apr 20 00:07:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AC25C43462 for ; Tue, 20 Apr 2021 00:10:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28435613AC for ; Tue, 20 Apr 2021 00:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233803AbhDTAKb (ORCPT ); Mon, 19 Apr 2021 20:10:31 -0400 Received: from mail-pl1-f180.google.com ([209.85.214.180]:45729 "EHLO mail-pl1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233647AbhDTAKW (ORCPT ); Mon, 19 Apr 2021 20:10:22 -0400 Received: by mail-pl1-f180.google.com with SMTP id p16so14718381plf.12 for ; Mon, 19 Apr 2021 17:09:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fPhKCgVRBOhHEvfJlCriskOFqzFG6mYCOiE1s2/iSDY=; b=ovp3UkYKmpWZCQYzey5AQ3nJdlpN2lkUFif1s6p/ZpSK8Ni2Q8p8bsxOHgNoC6T06H XlfzEoTBReReeDCHmQvANmEB5WJeVIk5WU7iFuXwjGQsn1ZNO5sbrxPA0pjU6xqBfxSV tzcOSYcv9YyBGhSCdAvzFATSOKl2Im/IkRujEC78p4mYjOyyJukhvKB8dR3jelUIFX7k VOs8zK2f6pBSS2NvVOM5YBWnfr6MSeEIuhL8dnmjyA0IF6ClYjvmvn4hYzy55VuDkQWG snR3OkDoA8V+0VA0+luU6/Z2oS3RfbhlQsJ9ASTn5xM2t9uT4wgSx0jQXBRzutbKZ2Ea 6P8A== X-Gm-Message-State: AOAM532DfnfaJo0ySPttq1010OR/isrJWIjlnx6gsuytjRs+LxQHqD+Y Of3Y2F/UgQouGYmHdVDJO8o= X-Google-Smtp-Source: ABdhPJz/1tqyo1WJfefPqW2HWWbmJXN9s66O6TItKPDhT9J/VFdnbbqiY5CLNoOB5axO+3V0Pa9mkg== X-Received: by 2002:a17:90a:ce8d:: with SMTP id g13mr1783728pju.85.1618877392021; Mon, 19 Apr 2021 17:09:52 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:51 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 052/117] hptiop: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:40 -0700 Message-Id: <20210420000845.25873-53-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Signed-off-by: Bart Van Assche --- drivers/scsi/hptiop.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index db4c7a7ff4dd..4cb92937164a 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c @@ -735,32 +735,32 @@ static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag, case IOP_RESULT_SUCCESS: scsi_set_resid(scp, scsi_bufflen(scp) - le32_to_cpu(req->dataxfer_length)); - scp->result = (DID_OK<<16); + scp->status.combined = (DID_OK<<16); break; case IOP_RESULT_BAD_TARGET: - scp->result = (DID_BAD_TARGET<<16); + scp->status.combined = (DID_BAD_TARGET<<16); break; case IOP_RESULT_BUSY: - scp->result = (DID_BUS_BUSY<<16); + scp->status.combined = (DID_BUS_BUSY<<16); break; case IOP_RESULT_RESET: - scp->result = (DID_RESET<<16); + scp->status.combined = (DID_RESET<<16); break; case IOP_RESULT_FAIL: - scp->result = (DID_ERROR<<16); + scp->status.combined = (DID_ERROR<<16); break; case IOP_RESULT_INVALID_REQUEST: - scp->result = (DID_ABORT<<16); + scp->status.combined = (DID_ABORT<<16); break; case IOP_RESULT_CHECK_CONDITION: scsi_set_resid(scp, scsi_bufflen(scp) - le32_to_cpu(req->dataxfer_length)); - scp->result = SAM_STAT_CHECK_CONDITION; + scp->status.combined = SAM_STAT_CHECK_CONDITION; memcpy(scp->sense_buffer, &req->sg_list, SCSI_SENSE_BUFFERSIZE); goto skip_resid; default: - scp->result = DRIVER_INVALID << 24 | DID_ABORT << 16; + scp->status.combined = DRIVER_INVALID << 24 | DID_ABORT << 16; break; } @@ -1024,12 +1024,12 @@ static int hptiop_queuecommand_lck(struct scsi_cmnd *scp, cpu_to_be32(((u32 *)scp->cmnd)[3]), _req->index, _req->req_virt); - scp->result = 0; + scp->status.combined = 0; if (scp->device->channel || (scp->device->id > hba->max_devices) || ((scp->device->id == (hba->max_devices-1)) && scp->device->lun)) { - scp->result = DID_BAD_TARGET << 16; + scp->status.combined = DID_BAD_TARGET << 16; free_req(hba, _req); goto cmd_done; } From patchwork Tue Apr 20 00:07:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B8A6C433B4 for ; Tue, 20 Apr 2021 00:10:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61228613AA for ; Tue, 20 Apr 2021 00:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233858AbhDTAKd (ORCPT ); Mon, 19 Apr 2021 20:10:33 -0400 Received: from mail-pf1-f178.google.com ([209.85.210.178]:33286 "EHLO mail-pf1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232986AbhDTAKZ (ORCPT ); Mon, 19 Apr 2021 20:10:25 -0400 Received: by mail-pf1-f178.google.com with SMTP id h11so6669801pfn.0 for ; Mon, 19 Apr 2021 17:09:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5LG988m59sM4vzMUSZJXhnMJeLVHHCu8o8BmdeD5lWs=; b=rMU2TPaVysDpruT8M+/RqolN8gXpBROGYJmozfEIx2mk3DeqRLL9MHJjd2jzAqSE7k lrsaMssj7eH2Gyqf1Nc2Hsl7Yu7KpKzqVxVoCY0c8rxEjdYCw+XScAUAH5U1KC1E71md RsCJVvNHjLrmFGZR5xiKJ38fLMD4cA9n6YFIPw5RO608E5zEavgeHk6PBTyxkRIXKpNA bOkNzGhuMam/4Cly/siXeX+L/+AKtofmaA7gfC61ZkL7WX7PTAj6Q659kXNPi+dDWphE wi8YM3VryP4D8icFPSb0HN2RFK+aDIVsp+RskYjQmmNt6daCDOuV5UTblumHioNUVPua uMmw== X-Gm-Message-State: AOAM533hzFRoGeZjfZGHgLsj0CNKaXERFYzoBT8MXV66D8UbnWksSc4H xPiLkb2GIEn3ZxkJha1aEIXmkE8kDhDrHg== X-Google-Smtp-Source: ABdhPJysCP7/kEdIAuUMTJNfg/mCADxq1VgpND462i2CYS2yhvFzyDF0rGat1Ql1Jfwd8S0xPPRPAg== X-Received: by 2002:a63:f258:: with SMTP id d24mr14117647pgk.174.1618877394360; Mon, 19 Apr 2021 17:09:54 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:53 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Brian King Subject: [PATCH 054/117] ibmvfc: Fix the documentation of the return value of ibmvfc_host_chkready() Date: Mon, 19 Apr 2021 17:07:42 -0700 Message-Id: <20210420000845.25873-55-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Cc: Brian King Fixes: 072b91f9c651 ("[SCSI] ibmvfc: IBM Power Virtual Fibre Channel Adapter Client Driver") Signed-off-by: Bart Van Assche --- drivers/scsi/ibmvscsi/ibmvfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 8f3b783ae08a..1d4bff0f561d 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -1841,7 +1841,7 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt) * @vhost: struct ibmvfc host * * Returns: - * 1 if host can accept command / 0 if not + * 0 if host can accept command; a value != 0 if not **/ static inline int ibmvfc_host_chkready(struct ibmvfc_host *vhost) { From patchwork Tue Apr 20 00:07:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FE31C433B4 for ; Tue, 20 Apr 2021 00:10:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BE03613AC for ; Tue, 20 Apr 2021 00:10:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233575AbhDTAKj (ORCPT ); Mon, 19 Apr 2021 20:10:39 -0400 Received: from mail-pl1-f172.google.com ([209.85.214.172]:43537 "EHLO mail-pl1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233487AbhDTAK1 (ORCPT ); Mon, 19 Apr 2021 20:10:27 -0400 Received: by mail-pl1-f172.google.com with SMTP id u15so10124472plf.10 for ; Mon, 19 Apr 2021 17:09:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z+aNdpW2uze4xifO4gQZ24CQ8UBJ6cuN2qqQyw6LISg=; b=fYrLNnNQbXhHwmQ+TwYPUYim781Z6FzobDBKObb1V5ck9m07J4zFwRFNU7NOOnl9i2 UHI8/3ar1eHOJf8YDh4cYc+B5QoTF8+052ww7HDrva/lIkXB9UWrfzqURCEjAH+AhopX xu3wKiTf9oSdnu6IEl5lJ6bFxRGM959YhLEzVlosvVDylPMH+MGkHe0L1OluGk9Sska9 VO4RU02/+7et/5Iw5A34/uiWhfWH4QZv3/zOPdaW27+hvbWA3xehortsrJIVhgEEQzLz RLzdn1xyss07Hm2zOMVUfXovemg9T14w2vS1aQCCtDaa2LzsK4QaH6+r6MGTfNQZZUH4 aOqw== X-Gm-Message-State: AOAM530GPt8Lt0+mIMhKuykX3PPedrzSfLauLvF0w7omq/aQDo/x+hQR peA01dp5hl0JDa+ZIxBHbTw= X-Google-Smtp-Source: ABdhPJwzoYqEWhEqOeMgK3aQ1S2mCrJrh/usBJTQZpd6/dVWzv3nnn1JTxp52lVNi8eb0tygrT7L9A== X-Received: by 2002:a17:90a:150e:: with SMTP id l14mr1828484pja.208.1618877396689; Mon, 19 Apr 2021 17:09:56 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:56 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Tyrel Datwyler Subject: [PATCH 056/117] ibmvscsi: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:44 -0700 Message-Id: <20210420000845.25873-57-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Tyrel Datwyler Signed-off-by: Bart Van Assche --- drivers/scsi/ibmvscsi/ibmvscsi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index f33f56680c59..1a02dc411f0d 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -793,7 +793,7 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code) spin_unlock_irqrestore(hostdata->host->host_lock, flags); if (evt->cmnd) { - evt->cmnd->result = (error_code << 16); + evt->cmnd->status.combined = (error_code << 16); unmap_cmd_data(&evt->iu.srp.cmd, evt, evt->hostdata->dev); if (evt->cmnd_done) @@ -976,7 +976,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); if (evt_struct->cmnd != NULL) { - evt_struct->cmnd->result = DID_ERROR << 16; + evt_struct->cmnd->status.combined = DID_ERROR << 16; evt_struct->cmnd_done(evt_struct->cmnd); } else if (evt_struct->done) evt_struct->done(evt_struct); @@ -1004,8 +1004,8 @@ static void handle_cmd_rsp(struct srp_event_struct *evt_struct) } if (cmnd) { - cmnd->result |= rsp->status; - if (((cmnd->result >> 1) & 0x1f) == CHECK_CONDITION) + cmnd->status.combined |= rsp->status; + if (((cmnd->status.combined >> 1) & 0x1f) == CHECK_CONDITION) memcpy(cmnd->sense_buffer, rsp->data, be32_to_cpu(rsp->sense_data_len)); @@ -1049,7 +1049,7 @@ static int ibmvscsi_queuecommand_lck(struct scsi_cmnd *cmnd, u16 lun = lun_from_dev(cmnd->device); u8 out_fmt, in_fmt; - cmnd->result = (DID_OK << 16); + cmnd->status.combined = (DID_OK << 16); evt_struct = get_event_struct(&hostdata->pool); if (!evt_struct) return SCSI_MLQUEUE_HOST_BUSY; @@ -1608,7 +1608,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%llx\n", tsk_mgmt->task_tag); - cmd->result = (DID_ABORT << 16); + cmd->status.combined = (DID_ABORT << 16); list_del(&found_evt->list); unmap_cmd_data(&found_evt->iu.srp.cmd, found_evt, found_evt->hostdata->dev); @@ -1713,7 +1713,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) list_for_each_entry_safe(tmp_evt, pos, &hostdata->sent, list) { if ((tmp_evt->cmnd) && (tmp_evt->cmnd->device == cmd->device)) { if (tmp_evt->cmnd) - tmp_evt->cmnd->result = (DID_RESET << 16); + tmp_evt->cmnd->status.combined = (DID_RESET << 16); list_del(&tmp_evt->list); unmap_cmd_data(&tmp_evt->iu.srp.cmd, tmp_evt, tmp_evt->hostdata->dev); @@ -1842,7 +1842,7 @@ static void ibmvscsi_handle_crq(struct viosrp_crq *crq, del_timer(&evt_struct->timer); if ((crq->status != VIOSRP_OK && crq->status != VIOSRP_OK2) && evt_struct->cmnd) - evt_struct->cmnd->result = DID_ERROR << 16; + evt_struct->cmnd->status.combined = DID_ERROR << 16; if (evt_struct->done) evt_struct->done(evt_struct); else From patchwork Tue Apr 20 00:07:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71B5FC433B4 for ; Tue, 20 Apr 2021 00:10:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A7776109E for ; Tue, 20 Apr 2021 00:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234120AbhDTAKp (ORCPT ); Mon, 19 Apr 2021 20:10:45 -0400 Received: from mail-pj1-f46.google.com ([209.85.216.46]:53066 "EHLO mail-pj1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233720AbhDTAK3 (ORCPT ); Mon, 19 Apr 2021 20:10:29 -0400 Received: by mail-pj1-f46.google.com with SMTP id lr7so2720706pjb.2 for ; Mon, 19 Apr 2021 17:09:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jfJ2P62rQrrg/7/aHOa0ytPQGyb23H0tV8yY2Ykjs8M=; b=NVyiCaGoXC7meUqozYCXjnZ0NlWNcmLzHSxJIhV+Kmfi6eNXmkLMJIJjKdLem1JXZh +/fOV0fNiSmo4RsbiHS/YPwkCa2stVeNfzgcu41+45bo9dFDmNKstYJblrezF+4qs2Mz 77BvCXXEQ6Ax4ZZu57qIfiXvFZ/3pKtdeknd3dEFO3Iyx83tkF1SErVWPUFrOzgA+nbc wQp8Hiav/17ojMiduTQ52CfJr0eXTG7zT8RvcAvIq7kUuP6j1DmHPVffwO0p4tbsURVE 93DQfRcyHtAaKPjTZ2xD9cjFi+ai+dwydQ4fZWbRXWNHPd6Jz1bTdFhgH4YGR65wSgrY KM6A== X-Gm-Message-State: AOAM531JgcLP7v33ltAzoR44oYlWpyfpRS6bdjHbCzNpfPY3DtISE6jt +DodcgoY9AD1mElyEV0saUY= X-Google-Smtp-Source: ABdhPJxje7MqQdzNwRHe8N3bwNWlPIQmxeOGKrXkTCbz5yzLdxV34fMuHj7RhrF2JjEMHnCDpOuHjA== X-Received: by 2002:a17:90a:94c4:: with SMTP id j4mr1746469pjw.14.1618877398838; Mon, 19 Apr 2021 17:09:58 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:09:58 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 058/117] imm: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:46 -0700 Message-Id: <20210420000845.25873-59-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Signed-off-by: Bart Van Assche --- drivers/scsi/imm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 862d35a098cf..a425127aa35f 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -158,7 +158,7 @@ imm_fail(imm_struct *dev, int error_code) { /* If we fail a device then we trash status / message bytes */ if (dev->cur_cmd) { - dev->cur_cmd->result = error_code << 16; + dev->cur_cmd->status.combined = error_code << 16; dev->failed = 1; } } @@ -729,7 +729,7 @@ static void imm_interrupt(struct work_struct *work) } /* Command must of completed hence it is safe to let go... */ #if IMM_DEBUG > 0 - switch ((cmd->result >> 16) & 0xff) { + switch ((cmd->status.combined >> 16) & 0xff) { case DID_OK: break; case DID_NO_CONNECT: @@ -758,7 +758,7 @@ static void imm_interrupt(struct work_struct *work) break; default: printk("imm: bad return code (%02x)\n", - (cmd->result >> 16) & 0xff); + (cmd->status.combined >> 16) & 0xff); } #endif @@ -894,7 +894,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) /* Check for optional message byte */ if (imm_wait(dev) == (unsigned char) 0xb8) imm_in(dev, &h, 1); - cmd->result = (DID_OK << 16) | (l & STATUS_MASK); + cmd->status.combined = (DID_OK << 16) | (l & STATUS_MASK); } if ((dev->mode == IMM_NIBBLE) || (dev->mode == IMM_PS2)) { w_ctr(ppb, 0x4); @@ -923,7 +923,7 @@ static int imm_queuecommand_lck(struct scsi_cmnd *cmd, dev->jstart = jiffies; dev->cur_cmd = cmd; cmd->scsi_done = done; - cmd->result = DID_ERROR << 16; /* default return code */ + cmd->status.combined = DID_ERROR << 16; /* default return code */ cmd->SCp.phase = 0; /* bus free */ schedule_delayed_work(&dev->imm_tq, 0); From patchwork Tue Apr 20 00:07:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92008C433ED for ; Tue, 20 Apr 2021 00:10:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7551C613AF for ; Tue, 20 Apr 2021 00:10:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233742AbhDTAKq (ORCPT ); Mon, 19 Apr 2021 20:10:46 -0400 Received: from mail-pl1-f178.google.com ([209.85.214.178]:40925 "EHLO mail-pl1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233783AbhDTAKb (ORCPT ); Mon, 19 Apr 2021 20:10:31 -0400 Received: by mail-pl1-f178.google.com with SMTP id 20so14724029pll.7 for ; Mon, 19 Apr 2021 17:10:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zdAZgY7tEc4FhpnmxMoXKlwIltYlXpVAr9VgyS6ySKY=; b=q5hrBSG5IAriCT8qqgDsKmB2tGtwbut1NFcKdCT+5FNniHNJuxvo/m5SGhx0tabg// pSEq5CI5XQxNivC7P/bM7ROLuCqlT0B1uCsjEEPMFS7UgnqbwE0FoaDOlEDAOcBZXNn0 6NDIsbAsClgRD7cYtL4ttcy3kansVQESvaHfAOEotMJS97i7w8K7lnGMCW9/rcElIo15 kOkZwmjuHQ09nIYjnwpM1URFTm2NIi//rW84E9xfreD9FyMXyx4S8CfGbaiPYOgqMyXi LgZNZIb77fQQCkf2f3k3mxcKf+MjUs104CAf1t67OZdHMCOrfRpyVsRsihtkzYmLMALE IJBA== X-Gm-Message-State: AOAM533kwQix/ZkkkEM0h2LzTsHwprZPD5wHlUKztcClJPpeP/ygoySm xFm3tNUxtgURLQYQWxxiI/k= X-Google-Smtp-Source: ABdhPJwtdqiI768dLMV5oRfQjcV+0x9lldKCnXirXFoCtyK1g+9T0aflNyhu/Hl/wOh1DsfxwXb22g== X-Received: by 2002:a17:902:c407:b029:ec:aeb7:667f with SMTP id k7-20020a170902c407b02900ecaeb7667fmr4663846plk.9.1618877401097; Mon, 19 Apr 2021 17:10:01 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:00 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Brian King Subject: [PATCH 060/117] ipr: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:48 -0700 Message-Id: <20210420000845.25873-61-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Brian King Signed-off-by: Bart Van Assche --- drivers/scsi/ipr.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 30c30a1db5b1..00b4688d3107 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -863,7 +863,7 @@ static void __ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd) { struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; - scsi_cmd->result |= (DID_ERROR << 16); + scsi_cmd->status.combined |= (DID_ERROR << 16); scsi_dma_unmap(ipr_cmd->scsi_cmd); scsi_cmd->scsi_done(scsi_cmd); @@ -6051,7 +6051,7 @@ static void __ipr_erp_done(struct ipr_cmnd *ipr_cmd) u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); if (IPR_IOASC_SENSE_KEY(ioasc) > 0) { - scsi_cmd->result |= (DID_ERROR << 16); + scsi_cmd->status.combined |= (DID_ERROR << 16); scmd_printk(KERN_ERR, scsi_cmd, "Request Sense failed with IOASC: 0x%08X\n", ioasc); } else { @@ -6301,7 +6301,7 @@ static void ipr_gen_sense(struct ipr_cmnd *ipr_cmd) if (ioasc >= IPR_FIRST_DRIVER_IOASC) return; - ipr_cmd->scsi_cmd->result = SAM_STAT_CHECK_CONDITION; + ipr_cmd->scsi_cmd->status.combined = SAM_STAT_CHECK_CONDITION; if (ipr_is_vset_device(res) && ioasc == IPR_IOASC_MED_DO_NOT_REALLOC && @@ -6432,23 +6432,23 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg, switch (masked_ioasc) { case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST: if (ipr_is_naca_model(res)) - scsi_cmd->result |= (DID_ABORT << 16); + scsi_cmd->status.combined |= (DID_ABORT << 16); else - scsi_cmd->result |= (DID_IMM_RETRY << 16); + scsi_cmd->status.combined |= (DID_IMM_RETRY << 16); break; case IPR_IOASC_IR_RESOURCE_HANDLE: case IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA: - scsi_cmd->result |= (DID_NO_CONNECT << 16); + scsi_cmd->status.combined |= (DID_NO_CONNECT << 16); break; case IPR_IOASC_HW_SEL_TIMEOUT: - scsi_cmd->result |= (DID_NO_CONNECT << 16); + scsi_cmd->status.combined |= (DID_NO_CONNECT << 16); if (!ipr_is_naca_model(res)) res->needs_sync_complete = 1; break; case IPR_IOASC_SYNC_REQUIRED: if (!res->in_erp) res->needs_sync_complete = 1; - scsi_cmd->result |= (DID_IMM_RETRY << 16); + scsi_cmd->status.combined |= (DID_IMM_RETRY << 16); break; case IPR_IOASC_MED_DO_NOT_REALLOC: /* prevent retries */ case IPR_IOASA_IR_DUAL_IOA_DISABLED: @@ -6456,8 +6456,8 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg, * exception: do not set DID_PASSTHROUGH on CHECK CONDITION * so SCSI mid-layer and upper layers handle it accordingly. */ - if (scsi_cmd->result != SAM_STAT_CHECK_CONDITION) - scsi_cmd->result |= (DID_PASSTHROUGH << 16); + if (scsi_cmd->status.combined != SAM_STAT_CHECK_CONDITION) + scsi_cmd->status.combined |= (DID_PASSTHROUGH << 16); break; case IPR_IOASC_BUS_WAS_RESET: case IPR_IOASC_BUS_WAS_RESET_BY_OTHER: @@ -6467,12 +6467,12 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg, */ if (!res->resetting_device) scsi_report_bus_reset(ioa_cfg->host, scsi_cmd->device->channel); - scsi_cmd->result |= (DID_ERROR << 16); + scsi_cmd->status.combined |= (DID_ERROR << 16); if (!ipr_is_naca_model(res)) res->needs_sync_complete = 1; break; case IPR_IOASC_HW_DEV_BUS_STATUS: - scsi_cmd->result |= IPR_IOASC_SENSE_STATUS(ioasc); + scsi_cmd->status.combined |= IPR_IOASC_SENSE_STATUS(ioasc); if (IPR_IOASC_SENSE_STATUS(ioasc) == SAM_STAT_CHECK_CONDITION) { if (!ipr_get_autosense(ipr_cmd)) { if (!ipr_is_naca_model(res)) { @@ -6489,13 +6489,13 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg, case IPR_IOASC_IR_NON_OPTIMIZED: if (res->raw_mode) { res->raw_mode = 0; - scsi_cmd->result |= (DID_IMM_RETRY << 16); + scsi_cmd->status.combined |= (DID_IMM_RETRY << 16); } else - scsi_cmd->result |= (DID_ERROR << 16); + scsi_cmd->status.combined |= (DID_ERROR << 16); break; default: if (IPR_IOASC_SENSE_KEY(ioasc) > RECOVERED_ERROR) - scsi_cmd->result |= (DID_ERROR << 16); + scsi_cmd->status.combined |= (DID_ERROR << 16); if (!ipr_is_vset_device(res) && !ipr_is_naca_model(res)) res->needs_sync_complete = 1; break; @@ -6571,7 +6571,7 @@ static int ipr_queuecommand(struct Scsi_Host *shost, ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; - scsi_cmd->result = (DID_OK << 16); + scsi_cmd->status.combined = (DID_OK << 16); res = scsi_cmd->device->hostdata; if (ipr_is_gata(res) && res->sata_port) { @@ -6684,7 +6684,7 @@ static int ipr_queuecommand(struct Scsi_Host *shost, err_nodev: spin_lock_irqsave(hrrq->lock, hrrq_flags); memset(scsi_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); - scsi_cmd->result = (DID_NO_CONNECT << 16); + scsi_cmd->status.combined = (DID_NO_CONNECT << 16); scsi_cmd->scsi_done(scsi_cmd); spin_unlock_irqrestore(hrrq->lock, hrrq_flags); return 0; From patchwork Tue Apr 20 00:07:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57BDCC433B4 for ; Tue, 20 Apr 2021 00:10:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 362CD6109E for ; Tue, 20 Apr 2021 00:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233876AbhDTAKu (ORCPT ); Mon, 19 Apr 2021 20:10:50 -0400 Received: from mail-pl1-f174.google.com ([209.85.214.174]:42711 "EHLO mail-pl1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233875AbhDTAKe (ORCPT ); Mon, 19 Apr 2021 20:10:34 -0400 Received: by mail-pl1-f174.google.com with SMTP id v13so5082833ple.9 for ; Mon, 19 Apr 2021 17:10:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HTguomwyGGvp07rauCYYrFmDbqB59oC0wWZ5Au503FE=; b=d7iwScbtypTT+g+2vgCZlhUJD6md7rcGt5+CLxYYBr6gYFWyKcAiCsUNRazffrz/WY DsMrx/GgAKpRDnEAnBvp9AUR2n1PBX9GvDbesZxZTSA02kQnpvoPWaFqdGepSjew1BRw C28Qb3sw2wI13gUGFrBKnMNuqbqrUJY41bQGz4uJxJ2EPfekIgWisv1FhIwm0VRJwmG6 N6sOM80tywhxqbU7brj5DjmSnz+I2tG6WTDs1jn9+13yJhQyAfYWOssmAP0QGu0OEtiQ H5ET9gQPrSBuP+NpXMdP9Nvevoq+5PZxFBujUlsA4GD5hyp51SRAa5+07d5fKbFI3Gdd 029Q== X-Gm-Message-State: AOAM531+6PeCQt6WtO/F0EYyuayWBRnktCVthCJeXDchsMExMBQWbz7H eF+V3fjIovOyZSEEu9hVPCU= X-Google-Smtp-Source: ABdhPJyIc10y1NVGnScnpE6HVBsNAOgDoB+zhe795Ea9hcHpA++atcfCLif9k+ptyCn+4dclug8kGg== X-Received: by 2002:a17:90b:19ca:: with SMTP id nm10mr1805603pjb.175.1618877403291; Mon, 19 Apr 2021 17:10:03 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:02 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Lee Duncan Subject: [PATCH 062/117] iscsi: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:50 -0700 Message-Id: <20210420000845.25873-63-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Lee Duncan Signed-off-by: Bart Van Assche Reviewed-by: Lee Duncan --- drivers/scsi/libiscsi.c | 46 ++++++++++++++--------------- drivers/scsi/scsi_transport_iscsi.c | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 4b8c9b9cf927..6bd81501fa55 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -616,7 +616,7 @@ static void fail_scsi_task(struct iscsi_task *task, enum host_status err) state = ISCSI_TASK_ABRT_TMF; sc = task->sc; - sc->result = err << 16; + sc->status.combined = err << 16; scsi_set_resid(sc, scsi_bufflen(sc)); iscsi_complete_task(task, state); spin_unlock_bh(&conn->session->back_lock); @@ -814,7 +814,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); conn->exp_statsn = be32_to_cpu(rhdr->statsn) + 1; - sc->result = (DID_OK << 16) | rhdr->cmd_status; + sc->status.combined = (DID_OK << 16) | rhdr->cmd_status; if (task->protected) { sector_t sector; @@ -829,7 +829,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ascq = session->tt->check_protection(task, §or); if (ascq) { - sc->result = DRIVER_SENSE << 24 | + sc->status.combined = DRIVER_SENSE << 24 | SAM_STAT_CHECK_CONDITION; scsi_build_sense_buffer(1, sc->sense_buffer, ILLEGAL_REQUEST, 0x10, ascq); @@ -841,7 +841,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, } if (rhdr->response != ISCSI_STATUS_CMD_COMPLETED) { - sc->result = DID_ERROR << 16; + sc->status.combined = DID_ERROR << 16; goto out; } @@ -853,7 +853,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, iscsi_conn_printk(KERN_ERR, conn, "Got CHECK_CONDITION but invalid data " "buffer size of %d\n", datalen); - sc->result = DID_BAD_TARGET << 16; + sc->status.combined = DID_BAD_TARGET << 16; goto out; } @@ -870,7 +870,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, if (rhdr->flags & (ISCSI_FLAG_CMD_BIDI_UNDERFLOW | ISCSI_FLAG_CMD_BIDI_OVERFLOW)) { - sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; + sc->status.combined = (DID_BAD_TARGET << 16) | rhdr->cmd_status; } if (rhdr->flags & (ISCSI_FLAG_CMD_UNDERFLOW | @@ -883,11 +883,11 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, /* write side for bidi or uni-io set_resid */ scsi_set_resid(sc, res_count); else - sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; + sc->status.combined = (DID_BAD_TARGET << 16) | rhdr->cmd_status; } out: ISCSI_DBG_SESSION(session, "cmd rsp done [sc %p res %d itt 0x%x]\n", - sc, sc->result, task->itt); + sc, sc->status.combined, task->itt); conn->scsirsp_pdus_cnt++; iscsi_complete_task(task, ISCSI_TASK_COMPLETED); } @@ -912,7 +912,7 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, return; iscsi_update_cmdsn(conn->session, (struct iscsi_nopin *)hdr); - sc->result = (DID_OK << 16) | rhdr->cmd_status; + sc->status.combined = (DID_OK << 16) | rhdr->cmd_status; conn->exp_statsn = be32_to_cpu(rhdr->statsn) + 1; if (rhdr->flags & (ISCSI_FLAG_DATA_UNDERFLOW | ISCSI_FLAG_DATA_OVERFLOW)) { @@ -923,12 +923,12 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, res_count <= sc->sdb.length)) scsi_set_resid(sc, res_count); else - sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; + sc->status.combined = (DID_BAD_TARGET << 16) | rhdr->cmd_status; } ISCSI_DBG_SESSION(conn->session, "data in with status done " "[sc %p res %d itt 0x%x]\n", - sc, sc->result, task->itt); + sc, sc->status.combined, task->itt); conn->scsirsp_pdus_cnt++; iscsi_complete_task(task, ISCSI_TASK_COMPLETED); } @@ -1678,7 +1678,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) struct iscsi_conn *conn; struct iscsi_task *task = NULL; - sc->result = 0; + sc->status.combined = 0; sc->SCp.ptr = NULL; ihost = shost_priv(host); @@ -1689,7 +1689,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) reason = iscsi_session_chkready(cls_session); if (reason) { - sc->result = reason; + sc->status.combined = reason; goto fault; } @@ -1708,29 +1708,29 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) */ if (unlikely(system_state != SYSTEM_RUNNING)) { reason = FAILURE_SESSION_FAILED; - sc->result = DID_NO_CONNECT << 16; + sc->status.combined = DID_NO_CONNECT << 16; break; } fallthrough; case ISCSI_STATE_IN_RECOVERY: reason = FAILURE_SESSION_IN_RECOVERY; - sc->result = DID_IMM_RETRY << 16; + sc->status.combined = DID_IMM_RETRY << 16; break; case ISCSI_STATE_LOGGING_OUT: reason = FAILURE_SESSION_LOGGING_OUT; - sc->result = DID_IMM_RETRY << 16; + sc->status.combined = DID_IMM_RETRY << 16; break; case ISCSI_STATE_RECOVERY_FAILED: reason = FAILURE_SESSION_RECOVERY_TIMEOUT; - sc->result = DID_TRANSPORT_FAILFAST << 16; + sc->status.combined = DID_TRANSPORT_FAILFAST << 16; break; case ISCSI_STATE_TERMINATE: reason = FAILURE_SESSION_TERMINATE; - sc->result = DID_NO_CONNECT << 16; + sc->status.combined = DID_NO_CONNECT << 16; break; default: reason = FAILURE_SESSION_FREED; - sc->result = DID_NO_CONNECT << 16; + sc->status.combined = DID_NO_CONNECT << 16; } goto fault; } @@ -1738,13 +1738,13 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) conn = session->leadconn; if (!conn) { reason = FAILURE_SESSION_FREED; - sc->result = DID_NO_CONNECT << 16; + sc->status.combined = DID_NO_CONNECT << 16; goto fault; } if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { reason = FAILURE_SESSION_IN_RECOVERY; - sc->result = DID_REQUEUE << 16; + sc->status.combined = DID_REQUEUE << 16; goto fault; } @@ -1766,7 +1766,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) reason = FAILURE_OOM; goto prepd_reject; } else { - sc->result = DID_ABORT << 16; + sc->status.combined = DID_ABORT << 16; goto prepd_fault; } } @@ -2017,7 +2017,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) * upper layer to deal with the result. */ if (unlikely(system_state != SYSTEM_RUNNING)) { - sc->result = DID_NO_CONNECT << 16; + sc->status.combined = DID_NO_CONNECT << 16; ISCSI_DBG_EH(session, "sc on shutdown, handled\n"); rc = BLK_EH_DONE; goto done; diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 4f821118ea23..b34155d285be 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1534,7 +1534,7 @@ static int iscsi_bsg_host_dispatch(struct bsg_job *job) /* return the errno failure code as the only status */ BUG_ON(job->reply_len < sizeof(uint32_t)); reply->reply_payload_rcv_len = 0; - reply->result = ret; + reply->status.combined = ret; job->reply_len = sizeof(uint32_t); bsg_job_done(job, ret, 0); return 0; From patchwork Tue Apr 20 00:07:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E11DAC433B4 for ; Tue, 20 Apr 2021 00:10:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEF846109E for ; Tue, 20 Apr 2021 00:10:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234136AbhDTAKx (ORCPT ); Mon, 19 Apr 2021 20:10:53 -0400 Received: from mail-pj1-f52.google.com ([209.85.216.52]:45646 "EHLO mail-pj1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233950AbhDTAKh (ORCPT ); Mon, 19 Apr 2021 20:10:37 -0400 Received: by mail-pj1-f52.google.com with SMTP id nm3-20020a17090b19c3b029014e1bbf6c60so15266798pjb.4 for ; Mon, 19 Apr 2021 17:10:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tDv2Pt5GfFmpgE06V3b0Lu85dw/Q4yR+fT581QmRIEo=; b=o/ewW9jUroN5eudNqYg4rE0BxLoLiRziZFSnuIIVKPAhFEzOt3xySn5iZNnakoom7w EGnEJvYlv5I7QRg/HhmCqS3sqVQQQHc4jfkqAxlRjlgp3cYXLLNTfnNza5lAVOu7ULeB 6x2qNQHDex62eurI/4Na/wIWzrlrRlZe/yLaay2zM2xF+RoMtdt+QS2zzOAnQzQwo08S AcKgaqCKSmAFNN5glA4YIh61EstbKoybZGNzG71px33PkdbkypjvAI4EYKA6GXbJBWH2 WQUKZEGYRDIxlJ5kOQKdKpakMpLQydfS1DX0uW2Aa4LTq6333LXmKALzpbD4GE4g0+9l diaQ== X-Gm-Message-State: AOAM5306I+RODyw2FOXmzlaVRCSTwI4dnerIhdetTLXxugQvQViwz7Wz sMh8eG7BM+DBCTsmWzeKtCM= X-Google-Smtp-Source: ABdhPJzVQbyFEt/A7MV3HZDppza6d8ZGSS2ey0wJ0JmeTsLf3XhTJhseC30IdHqTaEKw7aFMbOpDUQ== X-Received: by 2002:a17:90b:60a:: with SMTP id gb10mr1817316pjb.71.1618877405640; Mon, 19 Apr 2021 17:10:05 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:05 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , John Garry Subject: [PATCH 064/117] sas: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:52 -0700 Message-Id: <20210420000845.25873-65-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: John Garry Signed-off-by: Bart Van Assche --- drivers/scsi/libsas/sas_scsi_host.c | 8 ++++---- drivers/scsi/scsi_transport_sas.c | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 0be979caf7e3..efa0ef958ed3 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -94,7 +94,7 @@ static void sas_end_task(struct scsi_cmnd *sc, struct sas_task *task) } } - sc->result = (hs << 16) | stat; + sc->status.combined = (hs << 16) | stat; ASSIGN_SAS_TASK(sc, NULL); sas_free_task(task); } @@ -170,7 +170,7 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) /* If the device fell off, no sense in issuing commands */ if (test_bit(SAS_DEV_GONE, &dev->state)) { - cmd->result = DID_BAD_TARGET << 16; + cmd->status.combined = DID_BAD_TARGET << 16; goto out_done; } @@ -195,9 +195,9 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) ASSIGN_SAS_TASK(cmd, NULL); sas_free_task(task); if (res == -SAS_QUEUE_FULL) - cmd->result = DID_SOFT_ERROR << 16; /* retry */ + cmd->status.combined = DID_SOFT_ERROR << 16; /* retry */ else - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; out_done: cmd->scsi_done(cmd); return 0; diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index c9abed8429c9..2caa1393cf94 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -1229,13 +1229,14 @@ int sas_read_port_mode_page(struct scsi_device *sdev) char *buffer = kzalloc(BUF_SIZE, GFP_KERNEL), *msdata; struct sas_end_device *rdev = sas_sdev_to_rdev(sdev); struct scsi_mode_data mode_data; - int res, error; + union scsi_status res; + int error; if (!buffer) return -ENOMEM; - res = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, 3, - &mode_data, NULL); + res.combined = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, + 3, &mode_data, NULL); error = -EINVAL; if (!scsi_status_is_good(res)) From patchwork Tue Apr 20 00:07:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B034C433ED for ; Tue, 20 Apr 2021 00:10:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBC30613AA for ; Tue, 20 Apr 2021 00:10:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234042AbhDTAK5 (ORCPT ); Mon, 19 Apr 2021 20:10:57 -0400 Received: from mail-pl1-f177.google.com ([209.85.214.177]:43548 "EHLO mail-pl1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbhDTAKi (ORCPT ); Mon, 19 Apr 2021 20:10:38 -0400 Received: by mail-pl1-f177.google.com with SMTP id u15so10124682plf.10 for ; Mon, 19 Apr 2021 17:10:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0msCEhu9ZIztDcdafSO2QdXWUwmOBmuTseKPHJT+qWM=; b=XYbiXfiXr+MaPR7s2U+up4OdariDUUDCGW2TW5tdBbkuWxzTzbPLprldjbwV/iQQ60 1KuWnph6IL+U2VlR/XxjEwTFp3IuXvItittVeBnZsyx5DQ6TofqmQOaD/qmdw41KckhE KlKuHYxDwcZeSURp9/z1APg8Ver8SvXaJES3Nu7b5hcC63sitTEVAKxg1WdowlU5fJML tTP62DKFRIhRvfZiT78ZjxIAnXUEkt77aZkRHEOfQaejRkQtE2+yNY7fHaN37GIWMK6+ YeALwLZK2cF0tfOyUODBWuoWCfyiYCNqoBf0KpCG+ih3DWSRgpYedMkwTq9w9pTVhAop YJjg== X-Gm-Message-State: AOAM530+HubWOJV6yfsLV++Aj/A3bKWkuL9R1iLgljYOPcqyyyFzUhIR v5s+FS285j1NoSiO9sNdang= X-Google-Smtp-Source: ABdhPJz2KaOYyBixLEFN+R1KSovVO99GBJi2VMXp3fYxtp4ZXImKufmasyDGubln4/Dvk+SUdbYahg== X-Received: by 2002:a17:902:ee8a:b029:eb:6d3:1431 with SMTP id a10-20020a170902ee8ab02900eb06d31431mr25962718pld.60.1618877406855; Mon, 19 Apr 2021 17:10:06 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:06 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , James Smart Subject: [PATCH 065/117] lpfc: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:53 -0700 Message-Id: <20210420000845.25873-66-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: James Smart Signed-off-by: Bart Van Assche Reviewed-by: James Smart --- drivers/scsi/lpfc/lpfc_bsg.c | 114 +++++++++++++++++----------------- drivers/scsi/lpfc/lpfc_scsi.c | 66 ++++++++++---------- 2 files changed, 90 insertions(+), 90 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index c2776b88d493..965fa8a1c344 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c @@ -373,8 +373,8 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba, /* Complete the job if the job is still active */ if (job) { - bsg_reply->result = rc; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = rc; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } return; @@ -545,7 +545,7 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job) kfree(dd_data); no_dd_data: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; job->dd_data = NULL; return rc; } @@ -643,8 +643,8 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba, /* Complete the job if the job is still active */ if (job) { - bsg_reply->result = rc; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = rc; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } return; @@ -782,7 +782,7 @@ lpfc_bsg_rport_els(struct bsg_job *job) no_dd_data: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; job->dd_data = NULL; return rc; } @@ -1113,11 +1113,11 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, bsg_reply = job->reply; bsg_reply->reply_payload_rcv_len = size; /* make error code available to userspace */ - bsg_reply->result = 0; + bsg_reply->status.combined = 0; job->dd_data = NULL; /* complete the job back to userspace */ spin_unlock_irqrestore(&phba->ct_ev_lock, flags); - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); spin_lock_irqsave(&phba->ct_ev_lock, flags); } @@ -1340,14 +1340,14 @@ lpfc_bsg_hba_get_event(struct bsg_job *job) lpfc_bsg_event_unref(evt); spin_unlock_irqrestore(&phba->ct_ev_lock, flags); job->dd_data = NULL; - bsg_reply->result = 0; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = 0; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return 0; job_error: job->dd_data = NULL; - bsg_reply->result = rc; + bsg_reply->status.combined = rc; return rc; } @@ -1438,8 +1438,8 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba, /* Complete the job if the job is still active */ if (job) { - bsg_reply->result = rc; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = rc; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } return; @@ -1670,7 +1670,7 @@ lpfc_bsg_send_mgmt_rsp(struct bsg_job *job) kfree(bmp); send_mgmt_rsp_exit: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; job->dd_data = NULL; return rc; } @@ -1878,10 +1878,10 @@ lpfc_sli3_bsg_diag_loopback_mode(struct lpfc_hba *phba, struct bsg_job *job) job_error: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; /* complete the job back to userspace if no error */ if (rc == 0) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; } @@ -2243,10 +2243,10 @@ lpfc_sli4_bsg_diag_loopback_mode(struct lpfc_hba *phba, struct bsg_job *job) job_done: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; /* complete the job back to userspace if no error */ if (rc == 0) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; } @@ -2358,10 +2358,10 @@ lpfc_sli4_bsg_diag_mode_end(struct bsg_job *job) loopback_mode_end_exit: /* make return code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; /* complete the job back to userspace if no error */ if (rc == 0) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; } @@ -2507,10 +2507,10 @@ lpfc_sli4_bsg_link_diag_test(struct bsg_job *job) /* make error code available to userspace */ if (rc1 && !rc) rc = rc1; - bsg_reply->result = rc; + bsg_reply->status.combined = rc; /* complete the job back to userspace if no error */ if (rc == 0) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; } @@ -3369,11 +3369,11 @@ lpfc_bsg_diag_loopback_run(struct bsg_job *job) loopback_test_exit: kfree(dataout); /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; job->dd_data = NULL; /* complete the job back to userspace if no error */ if (rc == IOCB_SUCCESS) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; } @@ -3414,9 +3414,9 @@ lpfc_bsg_get_dfc_rev(struct bsg_job *job) event_reply->info.a_Major = MANAGEMENT_MAJOR_REV; event_reply->info.a_Minor = MANAGEMENT_MINOR_REV; job_error: - bsg_reply->result = rc; + bsg_reply->status.combined = rc; if (rc == 0) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; } @@ -3481,8 +3481,8 @@ lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) /* Complete the job if the job is still active */ if (job) { - bsg_reply->result = 0; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = 0; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } return; @@ -3671,7 +3671,7 @@ lpfc_bsg_issue_mbox_ext_handle_job(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) pmb_buf, size); /* result for successful */ - bsg_reply->result = 0; + bsg_reply->status.combined = 0; lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2937 SLI_CONFIG ext-buffer mailbox command " @@ -3732,7 +3732,7 @@ lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) /* if the job is still active, call job done */ if (job) { bsg_reply = job->reply; - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } return; @@ -3770,7 +3770,7 @@ lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) /* if the job is still active, call job done */ if (job) { bsg_reply = job->reply; - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } @@ -4213,8 +4213,8 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, /* wait for additional external buffers */ - bsg_reply->result = 0; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = 0; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return SLI_CONFIG_HANDLED; @@ -4441,8 +4441,8 @@ lpfc_bsg_read_ebuf_get(struct lpfc_hba *phba, struct bsg_job *job) lpfc_bsg_mbox_ext_session_reset(phba); } - bsg_reply->result = 0; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = 0; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return SLI_CONFIG_HANDLED; @@ -4560,8 +4560,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, } /* wait for additional external buffers */ - bsg_reply->result = 0; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = 0; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return SLI_CONFIG_HANDLED; @@ -5030,16 +5030,16 @@ lpfc_bsg_mbox_cmd(struct bsg_job *job) if (rc == 0) { /* job done */ - bsg_reply->result = 0; + bsg_reply->status.combined = 0; job->dd_data = NULL; - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } else if (rc == 1) /* job submitted, will complete later*/ rc = 0; /* return zero, no error */ else { /* some error occurred */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; job->dd_data = NULL; } @@ -5142,8 +5142,8 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba, /* Complete the job if active */ if (job) { - bsg_reply->result = rc; - bsg_job_done(job, bsg_reply->result, + bsg_reply->status.combined = rc; + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } @@ -5318,7 +5318,7 @@ lpfc_menlo_cmd(struct bsg_job *job) kfree(dd_data); no_dd_data: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; job->dd_data = NULL; return rc; } @@ -5358,9 +5358,9 @@ lpfc_forced_link_speed(struct bsg_job *job) ? LPFC_FORCED_LINK_SPEED_SUPPORTED : LPFC_FORCED_LINK_SPEED_NOT_SUPPORTED; job_error: - bsg_reply->result = rc; + bsg_reply->status.combined = rc; if (rc == 0) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; } @@ -5434,11 +5434,11 @@ lpfc_bsg_get_ras_config(struct bsg_job *job) ras_job_error: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; /* complete the job back to userspace */ if (!rc) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; } @@ -5520,11 +5520,11 @@ lpfc_bsg_set_ras_config(struct bsg_job *job) } ras_job_error: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; /* complete the job back to userspace */ if (!rc) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; @@ -5582,11 +5582,11 @@ lpfc_bsg_get_ras_lwpd(struct bsg_job *job) ras_job_error: /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; /* complete the job back to userspace */ if (!rc) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; @@ -5671,9 +5671,9 @@ lpfc_bsg_get_ras_fwlog(struct bsg_job *job) vfree(fwlog_buff); ras_job_error: - bsg_reply->result = rc; + bsg_reply->status.combined = rc; if (!rc) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; @@ -5743,9 +5743,9 @@ lpfc_get_trunk_info(struct bsg_job *job) event_reply->logical_speed = phba->sli4_hba.link_state.logical_speed / 1000; job_error: - bsg_reply->result = rc; + bsg_reply->status.combined = rc; if (!rc) - bsg_job_done(job, bsg_reply->result, + bsg_job_done(job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return rc; @@ -5817,7 +5817,7 @@ lpfc_bsg_hst_vendor(struct bsg_job *job) rc = -EINVAL; bsg_reply->reply_payload_rcv_len = 0; /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; break; } @@ -5851,7 +5851,7 @@ lpfc_bsg_request(struct bsg_job *job) rc = -EINVAL; bsg_reply->reply_payload_rcv_len = 0; /* make error code available to userspace */ - bsg_reply->result = rc; + bsg_reply->status.combined = rc; break; } diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 81455b53ef3e..cc356463956f 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -156,7 +156,7 @@ lpfc_update_stats(struct lpfc_vport *vport, struct lpfc_io_buf *lpfc_cmd) if (!vport->stat_data_enabled || vport->stat_data_blocked || - (cmd->result)) + (cmd->status.combined)) return; latency = jiffies_to_msecs((long)jiffies - (long)lpfc_cmd->start_time); @@ -2871,7 +2871,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) if (err_type == BGS_GUARD_ERR_MASK) { scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x1); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_guard_err_cnt++; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, @@ -2882,7 +2882,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) } else if (err_type == BGS_REFTAG_ERR_MASK) { scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x3); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_reftag_err_cnt++; @@ -2894,7 +2894,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) } else if (err_type == BGS_APPTAG_ERR_MASK) { scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x2); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_apptag_err_cnt++; @@ -2956,7 +2956,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x1); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_guard_err_cnt++; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, @@ -2972,7 +2972,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x3); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_reftag_err_cnt++; @@ -2989,7 +2989,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x2); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_apptag_err_cnt++; @@ -3074,7 +3074,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, uint64_t failing_sector = 0; if (lpfc_bgs_get_invalid_prof(bgstat)) { - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, "9072 BLKGRD: Invalid BG Profile in cmd " "0x%x reftag 0x%x blk cnt 0x%x " @@ -3086,7 +3086,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, } if (lpfc_bgs_get_uninit_dif_block(bgstat)) { - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, "9073 BLKGRD: Invalid BG PDIF Block in cmd " "0x%x reftag 0x%x blk cnt 0x%x " @@ -3102,7 +3102,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x1); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_guard_err_cnt++; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, @@ -3118,7 +3118,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x3); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_reftag_err_cnt++; @@ -3135,7 +3135,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 0x10, 0x2); - cmd->result = DRIVER_SENSE << 24 | DID_ABORT << 16 | + cmd->status.combined = DRIVER_SENSE << 24 | DID_ABORT << 16 | SAM_STAT_CHECK_CONDITION; phba->bg_apptag_err_cnt++; @@ -3741,15 +3741,15 @@ lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, return; /* If there is queuefull or busy condition send a scsi event */ - if ((cmnd->result == SAM_STAT_TASK_SET_FULL) || - (cmnd->result == SAM_STAT_BUSY)) { + if ((cmnd->status.combined == SAM_STAT_TASK_SET_FULL) || + (cmnd->status.combined == SAM_STAT_BUSY)) { fast_path_evt = lpfc_alloc_fast_evt(phba); if (!fast_path_evt) return; fast_path_evt->un.scsi_evt.event_type = FC_REG_SCSI_EVENT; fast_path_evt->un.scsi_evt.subcategory = - (cmnd->result == SAM_STAT_TASK_SET_FULL) ? + (cmnd->status.combined == SAM_STAT_TASK_SET_FULL) ? LPFC_EVENT_QFULL : LPFC_EVENT_DEVBSY; fast_path_evt->un.scsi_evt.lun = cmnd->device->lun; memcpy(&fast_path_evt->un.scsi_evt.wwpn, @@ -4015,7 +4015,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_io_buf *lpfc_cmd, } out: - cmnd->result = host_status << 16 | scsi_status; + cmnd->status.combined = host_status << 16 | scsi_status; lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, fcpi_parm); } @@ -4161,7 +4161,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, switch (lpfc_cmd->status) { case IOSTAT_SUCCESS: - cmd->result = DID_OK << 16; + cmd->status.combined = DID_OK << 16; break; case IOSTAT_FCP_RSP_ERROR: lpfc_handle_fcp_err(vport, lpfc_cmd, @@ -4170,7 +4170,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, break; case IOSTAT_NPORT_BSY: case IOSTAT_FABRIC_BSY: - cmd->result = DID_TRANSPORT_DISRUPTED << 16; + cmd->status.combined = DID_TRANSPORT_DISRUPTED << 16; fast_path_evt = lpfc_alloc_fast_evt(phba); if (!fast_path_evt) break; @@ -4230,14 +4230,14 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, lpfc_cmd->result == IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR || lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_ERROR || lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_COMPARE_ERROR) { - cmd->result = DID_NO_CONNECT << 16; + cmd->status.combined = DID_NO_CONNECT << 16; break; } if (lpfc_cmd->result == IOERR_INVALID_RPI || lpfc_cmd->result == IOERR_NO_RESOURCES || lpfc_cmd->result == IOERR_ABORT_REQUESTED || lpfc_cmd->result == IOERR_SLER_CMD_RCV_FAILURE) { - cmd->result = DID_REQUEUE << 16; + cmd->status.combined = DID_REQUEUE << 16; break; } if ((lpfc_cmd->result == IOERR_RX_DMA_FAILED || @@ -4276,7 +4276,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, default: if (lpfc_cmd->status >= IOSTAT_CNT) lpfc_cmd->status = IOSTAT_DEFAULT; - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR, "9037 FCP Completion Error: xri %x " "status x%x result x%x [x%x] " @@ -4286,14 +4286,14 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, wcqe->parameter, wcqe->total_data_placed); } - if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) { + if (cmd->status.combined || lpfc_cmd->fcp_rsp->rspSnsLen) { u32 *lp = (u32 *)cmd->sense_buffer; lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, "9039 Iodone <%d/%llu> cmd x%px, error " "x%x SNS x%x x%x Data: x%x x%x\n", cmd->device->id, cmd->device->lun, cmd, - cmd->result, *lp, *(lp + 3), cmd->retries, + cmd->status.combined, *lp, *(lp + 3), cmd->retries, scsi_get_resid(cmd)); } @@ -4471,7 +4471,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, break; case IOSTAT_NPORT_BSY: case IOSTAT_FABRIC_BSY: - cmd->result = DID_TRANSPORT_DISRUPTED << 16; + cmd->status.combined = DID_TRANSPORT_DISRUPTED << 16; fast_path_evt = lpfc_alloc_fast_evt(phba); if (!fast_path_evt) break; @@ -4503,14 +4503,14 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, lpfc_cmd->result == IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR || lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_ERROR || lpfc_cmd->result == IOERR_ELXSEC_CRYPTO_COMPARE_ERROR) { - cmd->result = DID_NO_CONNECT << 16; + cmd->status.combined = DID_NO_CONNECT << 16; break; } if (lpfc_cmd->result == IOERR_INVALID_RPI || lpfc_cmd->result == IOERR_NO_RESOURCES || lpfc_cmd->result == IOERR_ABORT_REQUESTED || lpfc_cmd->result == IOERR_SLER_CMD_RCV_FAILURE) { - cmd->result = DID_REQUEUE << 16; + cmd->status.combined = DID_REQUEUE << 16; break; } if ((lpfc_cmd->result == IOERR_RX_DMA_FAILED || @@ -4544,24 +4544,24 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, } fallthrough; default: - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; break; } if (!pnode || (pnode->nlp_state != NLP_STE_MAPPED_NODE)) - cmd->result = DID_TRANSPORT_DISRUPTED << 16 | + cmd->status.combined = DID_TRANSPORT_DISRUPTED << 16 | SAM_STAT_BUSY; } else - cmd->result = DID_OK << 16; + cmd->status.combined = DID_OK << 16; - if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) { + if (cmd->status.combined || lpfc_cmd->fcp_rsp->rspSnsLen) { uint32_t *lp = (uint32_t *)cmd->sense_buffer; lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, "0710 Iodone <%d/%llu> cmd x%px, error " "x%x SNS x%x x%x Data: x%x x%x\n", cmd->device->id, cmd->device->lun, cmd, - cmd->result, *lp, *(lp + 3), cmd->retries, + cmd->status.combined, *lp, *(lp + 3), cmd->retries, scsi_get_resid(cmd)); } @@ -5179,7 +5179,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) err = fc_remote_port_chkready(rport); if (err) { - cmnd->result = err; + cmnd->status.combined = err; goto out_fail_command; } ndlp = rdata->pnode; @@ -5286,7 +5286,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) if (unlikely(err)) { if (err == 2) { - cmnd->result = DID_ERROR << 16; + cmnd->status.combined = DID_ERROR << 16; goto out_fail_command_release_buf; } goto out_host_busy_free_buf; From patchwork Tue Apr 20 00:07:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFDCCC43460 for ; Tue, 20 Apr 2021 00:10:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8DF23613AA for ; Tue, 20 Apr 2021 00:10:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234090AbhDTAK6 (ORCPT ); Mon, 19 Apr 2021 20:10:58 -0400 Received: from mail-pl1-f182.google.com ([209.85.214.182]:40935 "EHLO mail-pl1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234074AbhDTAKm (ORCPT ); Mon, 19 Apr 2021 20:10:42 -0400 Received: by mail-pl1-f182.google.com with SMTP id 20so14724219pll.7 for ; Mon, 19 Apr 2021 17:10:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vQtfbEqwvZ8pTEbd3UWaphlrD+FFD1Z3NGjpzfK5gAo=; b=Na4yCFzqc6K/3SpWetIuv1ZcmdEweO4EyTdik+e/I0lCBCfvd8OmbS0VGptsZgS6fI ipbm4YPXb9fq5/8YjBNjQyoW1t7s3CukN2rFXt2RtwXcr5zro2NbFdc9lhmfHgNq827K a9DO63BS7PPO2UYJL8eDYCxpwaS1B35eZYP5Q5DYSoCaZ37UmTLVSlJmzoWcit2OISsL MSn/59xx09zZHKLpuoWF5TPX2j2Pab5IT1lgbT+tBkhmQUaf/LZurU3EFR6Qs6tm1BQb 0Jk8Rn0W0MMv24TO2mwWh3fSsVx4G4HM02ro7Vw8BYe+MIlD6GeQct420RCXWhGqRFTb DK1A== X-Gm-Message-State: AOAM532/MYPLkYIxqu2FJPlmncm66c/G2b0RgqYclm44Il8R5nu2OBk6 fi3uSqR2LjKExmS3IPTFSnQ= X-Google-Smtp-Source: ABdhPJxt5NTH46PwYBILk5G3YsenQYmFOlfy109Fq4cJK/esVjZQo3Yj7+j9wbhHX57SCVElGtX0Vg== X-Received: by 2002:a17:903:304b:b029:eb:4cf:8321 with SMTP id u11-20020a170903304bb02900eb04cf8321mr25975897pla.40.1618877410212; Mon, 19 Apr 2021 17:10:10 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:09 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 068/117] mesh: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:56 -0700 Message-Id: <20210420000845.25873-69-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Signed-off-by: Bart Van Assche --- drivers/scsi/mesh.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index 0a9f4e44ab2c..1d01913cac55 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c @@ -595,12 +595,12 @@ static void mesh_done(struct mesh_state *ms, int start_next) ms->current_req = NULL; tp->current_req = NULL; if (cmd) { - cmd->result = (ms->stat << 16) | cmd->SCp.Status; + cmd->status.combined = (ms->stat << 16) | cmd->SCp.Status; if (ms->stat == DID_OK) - cmd->result |= cmd->SCp.Message << 8; + cmd->status.combined |= cmd->SCp.Message << 8; if (DEBUG_TARGET(cmd)) { printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n", - cmd->result, ms->data_ptr, scsi_bufflen(cmd)); + cmd->status.combined, ms->data_ptr, scsi_bufflen(cmd)); #if 0 /* needs to use sg? */ if ((cmd->cmnd[0] == 0 || cmd->cmnd[0] == 0x12 || cmd->cmnd[0] == 3) @@ -993,7 +993,7 @@ static void handle_reset(struct mesh_state *ms) for (tgt = 0; tgt < 8; ++tgt) { tp = &ms->tgts[tgt]; if ((cmd = tp->current_req) != NULL) { - cmd->result = DID_RESET << 16; + cmd->status.combined = DID_RESET << 16; tp->current_req = NULL; mesh_completed(ms, cmd); } @@ -1003,7 +1003,7 @@ static void handle_reset(struct mesh_state *ms) ms->current_req = NULL; while ((cmd = ms->request_q) != NULL) { ms->request_q = (struct scsi_cmnd *) cmd->host_scribble; - cmd->result = DID_RESET << 16; + cmd->status.combined = DID_RESET << 16; mesh_completed(ms, cmd); } ms->phase = idle; From patchwork Tue Apr 20 00:07:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424922 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17E03C43461 for ; Tue, 20 Apr 2021 00:10:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C874F6109E for ; Tue, 20 Apr 2021 00:10:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234084AbhDTAK7 (ORCPT ); Mon, 19 Apr 2021 20:10:59 -0400 Received: from mail-pl1-f173.google.com ([209.85.214.173]:39872 "EHLO mail-pl1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234102AbhDTAKn (ORCPT ); Mon, 19 Apr 2021 20:10:43 -0400 Received: by mail-pl1-f173.google.com with SMTP id u7so16864395plr.6 for ; Mon, 19 Apr 2021 17:10:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rH8H2f5lvxFiCIxcYnckQRop0TsGlHUa4BrzydtYUEk=; b=nkst0XSopXIya88s2iQEq6oodUkWYtJWSGLqLomSZzJOGN7yNNLFmEZC99pU7XCgf7 cyd56iJtNX+SZu2a1K+rBUKTmRm0NYOGGal6EQzLT2m6w7I8+AFZOZr3Gd4wTpjsThSd vveOhZuR00rRMXrWKfIaAIks0UCUDybcO2z4Br/R+senyyROg+IwYmEJ6pKjMOE2V0w/ 5pytDntWtZOd6QP4sfihzSmSiU3HLbTJsFRINEh4Let6us9emFqzszyjuUtHC5Qeoo7u BCiCejX7MC+fml2vPp5G3Wx0sJG2ft616y/Y7jEp0nLPKGu2zJnLSQxuuquPv9NIvAjv QuWw== X-Gm-Message-State: AOAM533Vu8jXoNgG67HozlYvBxVZC+siIOA2kIgi9ZKzVE0h0BpIIKca vAr2vHzVxZ1RospC8ogCKT/mU79mZ7feXw== X-Google-Smtp-Source: ABdhPJyjtAbckUvxcKTaEP3CVAamK3vT0POctAAAnougnTCCh2KqoUCedtaiW8PxJcXfIIw8m/QHaw== X-Received: by 2002:a17:90a:46c4:: with SMTP id x4mr1886549pjg.8.1618877412637; Mon, 19 Apr 2021 17:10:12 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:12 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani Subject: [PATCH 070/117] mpt3sas: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:07:58 -0700 Message-Id: <20210420000845.25873-71-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Sathya Prakash Cc: Sreekanth Reddy Cc: Suganath Prabu Subramani Signed-off-by: Bart Van Assche --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 78 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index d00aca3c77ce..a03534741afc 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -3311,7 +3311,7 @@ scsih_abort(struct scsi_cmnd *scmd) ioc->remove_host) { sdev_printk(KERN_INFO, scmd->device, "device been deleted! scmd(0x%p)\n", scmd); - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; scmd->scsi_done(scmd); r = SUCCESS; goto out; @@ -3321,7 +3321,7 @@ scsih_abort(struct scsi_cmnd *scmd) if (st == NULL || st->cb_idx == 0xFF) { sdev_printk(KERN_INFO, scmd->device, "No reference found at " "driver, assuming scmd(0x%p) might have completed\n", scmd); - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; r = SUCCESS; goto out; } @@ -3330,7 +3330,7 @@ scsih_abort(struct scsi_cmnd *scmd) if (sas_device_priv_data->sas_target->flags & MPT_TARGET_FLAGS_RAID_COMPONENT || sas_device_priv_data->sas_target->flags & MPT_TARGET_FLAGS_VOLUME) { - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; r = FAILED; goto out; } @@ -3387,7 +3387,7 @@ scsih_dev_reset(struct scsi_cmnd *scmd) ioc->remove_host) { sdev_printk(KERN_INFO, scmd->device, "device been deleted! scmd(0x%p)\n", scmd); - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; scmd->scsi_done(scmd); r = SUCCESS; goto out; @@ -3405,7 +3405,7 @@ scsih_dev_reset(struct scsi_cmnd *scmd) handle = sas_device_priv_data->sas_target->handle; if (!handle) { - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; r = FAILED; goto out; } @@ -3467,7 +3467,7 @@ scsih_target_reset(struct scsi_cmnd *scmd) ioc->remove_host) { starget_printk(KERN_INFO, starget, "target been deleted! scmd(0x%p)\n", scmd); - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; scmd->scsi_done(scmd); r = SUCCESS; goto out; @@ -3485,7 +3485,7 @@ scsih_target_reset(struct scsi_cmnd *scmd) handle = sas_device_priv_data->sas_target->handle; if (!handle) { - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; r = FAILED; goto out; } @@ -4984,9 +4984,9 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) mpt3sas_base_clear_st(ioc, st); scsi_dma_unmap(scmd); if (ioc->pci_error_recovery || ioc->remove_host) - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; else - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; scmd->scsi_done(scmd); } dtmprintk(ioc, ioc_info(ioc, "completing %d cmds\n", count)); @@ -5079,7 +5079,7 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status) } scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, 0x10, ascq); - scmd->result = DRIVER_SENSE << 24 | (DID_ABORT << 16) | + scmd->status.combined = DRIVER_SENSE << 24 | (DID_ABORT << 16) | SAM_STAT_CHECK_CONDITION; } @@ -5114,13 +5114,13 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) sas_device_priv_data = scmd->device->hostdata; if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; scmd->scsi_done(scmd); return 0; } if (!(_scsih_allow_scmd_to_device(ioc, scmd))) { - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; scmd->scsi_done(scmd); return 0; } @@ -5130,7 +5130,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) /* invalid device handle */ handle = sas_target_priv_data->handle; if (handle == MPT3SAS_INVALID_DEVICE_HANDLE) { - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; scmd->scsi_done(scmd); return 0; } @@ -5141,7 +5141,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) return SCSI_MLQUEUE_HOST_BUSY; } else if (sas_target_priv_data->deleted) { /* device has been deleted */ - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; scmd->scsi_done(scmd); return 0; } else if (sas_target_priv_data->tm_busy || @@ -5460,7 +5460,7 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, scsi_bufflen(scmd), scmd->underflow, scsi_get_resid(scmd)); ioc_warn(ioc, "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n", le16_to_cpu(mpi_reply->TaskTag), - le32_to_cpu(mpi_reply->TransferCount), scmd->result); + le32_to_cpu(mpi_reply->TransferCount), scmd->status.combined); ioc_warn(ioc, "\tscsi_status(%s)(0x%02x), scsi_state(%s)(0x%02x)\n", desc_scsi_status, scsi_status, desc_scsi_state, scsi_state); @@ -5688,14 +5688,14 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); if (mpi_reply == NULL) { - scmd->result = DID_OK << 16; + scmd->status.combined = DID_OK << 16; goto out; } sas_device_priv_data = scmd->device->hostdata; if (!sas_device_priv_data || !sas_device_priv_data->sas_target || sas_device_priv_data->sas_target->deleted) { - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; goto out; } ioc_status = le16_to_cpu(mpi_reply->IOCStatus); @@ -5773,71 +5773,71 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) switch (ioc_status) { case MPI2_IOCSTATUS_BUSY: case MPI2_IOCSTATUS_INSUFFICIENT_RESOURCES: - scmd->result = SAM_STAT_BUSY; + scmd->status.combined = SAM_STAT_BUSY; break; case MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE: - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; break; case MPI2_IOCSTATUS_SCSI_IOC_TERMINATED: if (sas_device_priv_data->block) { - scmd->result = DID_TRANSPORT_DISRUPTED << 16; + scmd->status.combined = DID_TRANSPORT_DISRUPTED << 16; goto out; } if (log_info == 0x31110630) { if (scmd->retries > 2) { - scmd->result = DID_NO_CONNECT << 16; + scmd->status.combined = DID_NO_CONNECT << 16; scsi_device_set_state(scmd->device, SDEV_OFFLINE); } else { - scmd->result = DID_SOFT_ERROR << 16; + scmd->status.combined = DID_SOFT_ERROR << 16; scmd->device->expecting_cc_ua = 1; } break; } else if (log_info == VIRTUAL_IO_FAILED_RETRY) { - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; break; } else if ((scmd->device->channel == RAID_CHANNEL) && (scsi_state == (MPI2_SCSI_STATE_TERMINATED | MPI2_SCSI_STATE_NO_SCSI_STATUS))) { - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; break; } - scmd->result = DID_SOFT_ERROR << 16; + scmd->status.combined = DID_SOFT_ERROR << 16; break; case MPI2_IOCSTATUS_SCSI_TASK_TERMINATED: case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED: - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; break; case MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: if ((xfer_cnt == 0) || (scmd->underflow > xfer_cnt)) - scmd->result = DID_SOFT_ERROR << 16; + scmd->status.combined = DID_SOFT_ERROR << 16; else - scmd->result = (DID_OK << 16) | scsi_status; + scmd->status.combined = (DID_OK << 16) | scsi_status; break; case MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN: - scmd->result = (DID_OK << 16) | scsi_status; + scmd->status.combined = (DID_OK << 16) | scsi_status; if ((scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID)) break; if (xfer_cnt < scmd->underflow) { if (scsi_status == SAM_STAT_BUSY) - scmd->result = SAM_STAT_BUSY; + scmd->status.combined = SAM_STAT_BUSY; else - scmd->result = DID_SOFT_ERROR << 16; + scmd->status.combined = DID_SOFT_ERROR << 16; } else if (scsi_state & (MPI2_SCSI_STATE_AUTOSENSE_FAILED | MPI2_SCSI_STATE_NO_SCSI_STATUS)) - scmd->result = DID_SOFT_ERROR << 16; + scmd->status.combined = DID_SOFT_ERROR << 16; else if (scsi_state & MPI2_SCSI_STATE_TERMINATED) - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; else if (!xfer_cnt && scmd->cmnd[0] == REPORT_LUNS) { mpi_reply->SCSIState = MPI2_SCSI_STATE_AUTOSENSE_VALID; mpi_reply->SCSIStatus = SAM_STAT_CHECK_CONDITION; - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; scmd->sense_buffer[0] = 0x70; scmd->sense_buffer[2] = ILLEGAL_REQUEST; @@ -5851,14 +5851,14 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) fallthrough; case MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR: case MPI2_IOCSTATUS_SUCCESS: - scmd->result = (DID_OK << 16) | scsi_status; + scmd->status.combined = (DID_OK << 16) | scsi_status; if (response_code == MPI2_SCSITASKMGMT_RSP_INVALID_FRAME || (scsi_state & (MPI2_SCSI_STATE_AUTOSENSE_FAILED | MPI2_SCSI_STATE_NO_SCSI_STATUS))) - scmd->result = DID_SOFT_ERROR << 16; + scmd->status.combined = DID_SOFT_ERROR << 16; else if (scsi_state & MPI2_SCSI_STATE_TERMINATED) - scmd->result = DID_RESET << 16; + scmd->status.combined = DID_RESET << 16; break; case MPI2_IOCSTATUS_EEDP_GUARD_ERROR: @@ -5877,12 +5877,12 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) case MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED: case MPI2_IOCSTATUS_INSUFFICIENT_POWER: default: - scmd->result = DID_SOFT_ERROR << 16; + scmd->status.combined = DID_SOFT_ERROR << 16; break; } - if (scmd->result && (ioc->logging_level & MPT_DEBUG_REPLY)) + if (scmd->status.combined && (ioc->logging_level & MPT_DEBUG_REPLY)) _scsih_scsi_ioc_info(ioc , scmd, mpi_reply, smid); out: From patchwork Tue Apr 20 00:08:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E32A9C433B4 for ; Tue, 20 Apr 2021 00:10:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C347B6109E for ; Tue, 20 Apr 2021 00:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234332AbhDTALE (ORCPT ); Mon, 19 Apr 2021 20:11:04 -0400 Received: from mail-pj1-f48.google.com ([209.85.216.48]:51914 "EHLO mail-pj1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233679AbhDTAKp (ORCPT ); Mon, 19 Apr 2021 20:10:45 -0400 Received: by mail-pj1-f48.google.com with SMTP id lt13so10010654pjb.1 for ; Mon, 19 Apr 2021 17:10:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AKuCJw4hvxbOEZYMOymCke3KW1R+kZZU80rjRoEIlLY=; b=oxTmp6aRDItoXXeeSezcYZEmoGbSc6ntdzhdNJVf3JgryKGaK9TXXNSrqy3dpS2i2j YFTpsUE3fRYHxybwfOZMy656zidny16yQpb0cSqbDMyVQC/d5TyhnJMzYCQj81PMlV0l 5sWFXQwO7RbZFVntAm1083BAgy7n0EI/n18mIoEFnWxrWdOxylzyJPTcSXznhFGrvt3U ZPHfZ6HXqygwKe5kWpG+QgO73WKT4QYmzYmMvY/4HqGWouKZ5YQaT0pJU8XPuR2LZTQM nZUsoYTrXRHqsCgA3bExOTebuvU66OVaUe2/P9UVvb3e/56zAQp8wRZsVG5Wj+iD2np+ eKCQ== X-Gm-Message-State: AOAM533pfPspgt2JJzF+yMLMTfR1+TKc2QZlQ6gMFZPrWOE8aOHXV7UL 3V4TOKq6WwP7cO0MxknXmVk= X-Google-Smtp-Source: ABdhPJw/zvZnK0rZamBFbZxR5jCzjdaiM7bP33OFWW1YGPH+9/gw971Db71UA4crNvWE4aqe9nlNbA== X-Received: by 2002:a17:90b:388c:: with SMTP id mu12mr1798953pjb.51.1618877414886; Mon, 19 Apr 2021 17:10:14 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:14 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Hannes Reinecke Subject: [PATCH 072/117] myrb: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:00 -0700 Message-Id: <20210420000845.25873-73-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/scsi/myrb.c | 48 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c index d9c82e211ae7..ecd6af832c94 100644 --- a/drivers/scsi/myrb.c +++ b/drivers/scsi/myrb.c @@ -1280,7 +1280,7 @@ static int myrb_pthru_queuecommand(struct Scsi_Host *shost, nsge = scsi_dma_map(scmd); if (nsge > 1) { dma_pool_free(cb->dcdb_pool, dcdb, dcdb_addr); - scmd->result = (DID_ERROR << 16); + scmd->status.combined = (DID_ERROR << 16); scmd->scsi_done(scmd); return 0; } @@ -1435,13 +1435,13 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, ldev_info->state != MYRB_DEVICE_WO) { dev_dbg(&shost->shost_gendev, "ldev %u in state %x, skip\n", sdev->id, ldev_info ? ldev_info->state : 0xff); - scmd->result = (DID_BAD_TARGET << 16); + scmd->status.combined = (DID_BAD_TARGET << 16); scmd->scsi_done(scmd); return 0; } switch (scmd->cmnd[0]) { case TEST_UNIT_READY: - scmd->result = (DID_OK << 16); + scmd->status.combined = (DID_OK << 16); scmd->scsi_done(scmd); return 0; case INQUIRY: @@ -1449,16 +1449,16 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, /* Illegal request, invalid field in CDB */ scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, 0x24, 0); - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; } else { myrb_inquiry(cb, scmd); - scmd->result = (DID_OK << 16); + scmd->status.combined = (DID_OK << 16); } scmd->scsi_done(scmd); return 0; case SYNCHRONIZE_CACHE: - scmd->result = (DID_OK << 16); + scmd->status.combined = (DID_OK << 16); scmd->scsi_done(scmd); return 0; case MODE_SENSE: @@ -1467,11 +1467,11 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, /* Illegal request, invalid field in CDB */ scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, 0x24, 0); - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; } else { myrb_mode_sense(cb, scmd, ldev_info); - scmd->result = (DID_OK << 16); + scmd->status.combined = (DID_OK << 16); } scmd->scsi_done(scmd); return 0; @@ -1481,7 +1481,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, /* Illegal request, invalid field in CDB */ scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, 0x24, 0); - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; scmd->scsi_done(scmd); return 0; @@ -1491,7 +1491,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, /* Illegal request, invalid field in CDB */ scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, 0x24, 0); - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; scmd->scsi_done(scmd); return 0; @@ -1501,18 +1501,18 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, return 0; case REQUEST_SENSE: myrb_request_sense(cb, scmd); - scmd->result = (DID_OK << 16); + scmd->status.combined = (DID_OK << 16); return 0; case SEND_DIAGNOSTIC: if (scmd->cmnd[1] != 0x04) { /* Illegal request, invalid field in CDB */ scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, 0x24, 0); - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; } else { /* Assume good status */ - scmd->result = (DID_OK << 16); + scmd->status.combined = (DID_OK << 16); } scmd->scsi_done(scmd); return 0; @@ -1521,7 +1521,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, /* Data protect, attempt to read invalid data */ scsi_build_sense_buffer(0, scmd->sense_buffer, DATA_PROTECT, 0x21, 0x06); - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; scmd->scsi_done(scmd); return 0; @@ -1538,7 +1538,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, /* Data protect, attempt to read invalid data */ scsi_build_sense_buffer(0, scmd->sense_buffer, DATA_PROTECT, 0x21, 0x06); - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; scmd->scsi_done(scmd); return 0; @@ -1555,7 +1555,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, /* Data protect, attempt to read invalid data */ scsi_build_sense_buffer(0, scmd->sense_buffer, DATA_PROTECT, 0x21, 0x06); - scmd->result = (DRIVER_SENSE << 24) | + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; scmd->scsi_done(scmd); return 0; @@ -1571,7 +1571,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost, /* Illegal request, invalid opcode */ scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, 0x20, 0); - scmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; + scmd->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; scmd->scsi_done(scmd); return 0; } @@ -1635,7 +1635,7 @@ static int myrb_queuecommand(struct Scsi_Host *shost, struct scsi_device *sdev = scmd->device; if (sdev->channel > myrb_logical_channel(shost)) { - scmd->result = (DID_BAD_TARGET << 16); + scmd->status.combined = (DID_BAD_TARGET << 16); scmd->scsi_done(scmd); return 0; } @@ -2345,7 +2345,7 @@ static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk, switch (status) { case MYRB_STATUS_SUCCESS: case MYRB_STATUS_DEVICE_BUSY: - scmd->result = (DID_OK << 16) | status; + scmd->status.combined = (DID_OK << 16) | status; break; case MYRB_STATUS_BAD_DATA: dev_dbg(&scmd->device->sdev_gendev, @@ -2358,7 +2358,7 @@ static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk, /* Write error */ scsi_build_sense_buffer(0, scmd->sense_buffer, MEDIUM_ERROR, 0x0C, 0); - scmd->result = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; + scmd->status.combined = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; break; case MYRB_STATUS_IRRECOVERABLE_DATA_ERROR: scmd_printk(KERN_ERR, scmd, "Irrecoverable Data Error\n"); @@ -2370,12 +2370,12 @@ static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk, /* Write error, auto-reallocation failed */ scsi_build_sense_buffer(0, scmd->sense_buffer, MEDIUM_ERROR, 0x0C, 0x02); - scmd->result = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; + scmd->status.combined = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION; break; case MYRB_STATUS_LDRV_NONEXISTENT_OR_OFFLINE: dev_dbg(&scmd->device->sdev_gendev, "Logical Drive Nonexistent or Offline"); - scmd->result = (DID_BAD_TARGET << 16); + scmd->status.combined = (DID_BAD_TARGET << 16); break; case MYRB_STATUS_ACCESS_BEYOND_END_OF_LDRV: dev_dbg(&scmd->device->sdev_gendev, @@ -2386,12 +2386,12 @@ static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk, break; case MYRB_STATUS_DEVICE_NONRESPONSIVE: dev_dbg(&scmd->device->sdev_gendev, "Device nonresponsive\n"); - scmd->result = (DID_BAD_TARGET << 16); + scmd->status.combined = (DID_BAD_TARGET << 16); break; default: scmd_printk(KERN_ERR, scmd, "Unexpected Error Status %04X", status); - scmd->result = (DID_ERROR << 16); + scmd->status.combined = (DID_ERROR << 16); break; } scmd->scsi_done(scmd); From patchwork Tue Apr 20 00:08:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32EA3C433ED for ; Tue, 20 Apr 2021 00:10:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02F306109E for ; Tue, 20 Apr 2021 00:10:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234421AbhDTALK (ORCPT ); Mon, 19 Apr 2021 20:11:10 -0400 Received: from mail-pg1-f178.google.com ([209.85.215.178]:42794 "EHLO mail-pg1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233851AbhDTAKs (ORCPT ); Mon, 19 Apr 2021 20:10:48 -0400 Received: by mail-pg1-f178.google.com with SMTP id m12so4674243pgr.9 for ; Mon, 19 Apr 2021 17:10:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2QORMlNMRmxZXDVL9hEp4j3rJkvY4FFvn7mnywr/Juk=; b=qnuP3KpI/gxJ4n2jXaKPlEspjhwoFzn4o8wgal3aDsRvNe+AJpZwpmo9Mt+GiCpxYy qUXAYY3OixPVQOORSaUz7/qI6AKrMyNL1BeuBgpzX8SjQtFxZU7h6bt+S3brWk+mmnmO ZAkV54F/iNRNVgyypkW/DSnc7g/loBESZ07A9TV1ToOmeZzCFG0ffD5gIsK2MiFgJyLT eDC60VlJnUcSWP4Vydf/Uudy3ztRVu1ZqjWNjD2zITSpLj3Q3s6WKT7YSvKUfsQe9o+Y vO7mG57FCsqGkR3Ygdr75tfN9OhnuuzLi3xvCZgR/vG3x0dCZEVXN499geVPbLjwH2TG BKKQ== X-Gm-Message-State: AOAM5336qIlu04ZBVirHN6iTlBecKf4zNjPhjpJEY9bjn7/tQL6rZpqR TS6LZmpQAfNK+pXMJdfr+uY= X-Google-Smtp-Source: ABdhPJwjc6q9hj2uPfe7Dj5VkrgA6vownyfki0tqvn/ad317dR6C7mFA5jZbOKjnvm+k5s43oO2IhA== X-Received: by 2002:a65:45c3:: with SMTP id m3mr14086000pgr.179.1618877417216; Mon, 19 Apr 2021 17:10:17 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:16 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Finn Thain , Michael Schmitz Subject: [PATCH 074/117] ncr53c8xx: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:02 -0700 Message-Id: <20210420000845.25873-75-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Finn Thain Cc: Michael Schmitz Signed-off-by: Bart Van Assche --- drivers/scsi/ncr53c8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index c76e9f05d042..352df5f9ca77 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c @@ -4909,7 +4909,7 @@ void ncr_complete (struct ncb *np, struct ccb *cp) /* ** Check the status. */ - cmd->result = 0; + cmd->status.combined = 0; if ( (cp->host_status == HS_COMPLETE) && (cp->scsi_status == SAM_STAT_GOOD || cp->scsi_status == SAM_STAT_CONDITION_MET)) { From patchwork Tue Apr 20 00:08:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5B83C433B4 for ; Tue, 20 Apr 2021 00:10:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 871A36109E for ; Tue, 20 Apr 2021 00:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233920AbhDTALL (ORCPT ); Mon, 19 Apr 2021 20:11:11 -0400 Received: from mail-pf1-f176.google.com ([209.85.210.176]:42627 "EHLO mail-pf1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbhDTAKt (ORCPT ); Mon, 19 Apr 2021 20:10:49 -0400 Received: by mail-pf1-f176.google.com with SMTP id w8so20843136pfn.9 for ; Mon, 19 Apr 2021 17:10:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4YyCNLq3Ebz+eM6Zgd93gOYMLNVX+6xJQogiuxpj63Q=; b=mwf470l7LRIdm1NwsrMu30njykeXrHUmv+N3aOIrPmLfChT6uXozg/Pdec8PBaKPwg wlvKn9NLFRXbKh+jaOPotbkIrsf6eMek6y5tYbmCCtDJM4PyrX9Zid12su+/mVB+pIdH pXUirlE4QOzFXVnfGgfRRIvnxGauYiSE3WNAGK4OCzCQtj81MQvgP3w40iANHhronAod U861J+FPJedMYs4VPkE698j+GBosWiFq3w5Jjw3O+BsCSjBefT728IBfk/NTLRLvo6YS nfS5H/wSApY/scwSiFKssJeLdeWzVr+2yQ8f0sdcTsbx8obSSJJiMYC3Egy5LwskVZKL 4Lww== X-Gm-Message-State: AOAM533CKThzmzslrapft7q7Ngc60CkXTn9sUpHGnhPxDXJX4dHTieSj roGTwduxqqxrwr08CuDuwQE= X-Google-Smtp-Source: ABdhPJzEaYiHV9R2WHpzHk25PMec5luo4PFOo5MtPiAJOiHEAz/tDHCBhbF0rJcdWoVwmWqaOn3rbw== X-Received: by 2002:aa7:87d5:0:b029:25a:b5f8:15ab with SMTP id i21-20020aa787d50000b029025ab5f815abmr15858533pfo.22.1618877418374; Mon, 19 Apr 2021 17:10:18 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:17 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "J. Bruce Fields" , Chuck Lever Subject: [PATCH 075/117] nfsd: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:03 -0700 Message-Id: <20210420000845.25873-76-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: "J. Bruce Fields" Cc: Chuck Lever Signed-off-by: Bart Van Assche --- fs/nfsd/blocklayout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c index 1058659a8d31..f10f559684a6 100644 --- a/fs/nfsd/blocklayout.c +++ b/fs/nfsd/blocklayout.c @@ -255,9 +255,9 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev, req->cmd_len = COMMAND_SIZE(INQUIRY); blk_execute_rq(NULL, rq, 1); - if (req->result) { + if (req->status.combined) { pr_err("pNFS: INQUIRY 0x83 failed with: %x\n", - req->result); + req->status.combined); error = -EIO; goto out_put_request; } From patchwork Tue Apr 20 00:08:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8E39C43460 for ; Tue, 20 Apr 2021 00:10:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 767A56109E for ; Tue, 20 Apr 2021 00:10:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234128AbhDTALM (ORCPT ); Mon, 19 Apr 2021 20:11:12 -0400 Received: from mail-pj1-f52.google.com ([209.85.216.52]:40835 "EHLO mail-pj1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232986AbhDTAKv (ORCPT ); Mon, 19 Apr 2021 20:10:51 -0400 Received: by mail-pj1-f52.google.com with SMTP id g1-20020a17090adac1b0290150d07f9402so792299pjx.5 for ; Mon, 19 Apr 2021 17:10:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CO3cYPeHIOlh/nyDG0GmXcKCokYOcCzUhMQaLcm5MIM=; b=IJ6VG2k8cJXsxoR0veoPEh56+zS+Ku9vP1d4+QV1QKyvhf2LjEKRQ6fhVvvsidGm17 a2clr67I7FyZmC/f/7ekaGncHXplZLMDVzLKcVFIwgBPKTE6eP5mu74pYCqhAb0YaPFB QleDaNI44+CPdQ3gFf1lkVBG1Ml7ML20kPbhfkMEpr0sAwAKaSal6tdGwVmnm/K8Awpu kwTZN5x/dYJUgeC+PaNl5tq2MQBG5uwj1zWVz5hQW6qBTof6z6LcpWeYsIt4qxwQuOzK 63ZhnFRG6yMf1yp6c1EgQ3Y8ohEmIc1rXpSp72QLSx4adb16Wu3FMAWP0EGjJppoVTPD Na1Q== X-Gm-Message-State: AOAM532PC9mLHYLFzKcSyFRcalt7KmLn6qQVWAcVV/Tuv4WAWWYmFcvS UZe9VjRLcwQacveyRFQr/as= X-Google-Smtp-Source: ABdhPJysP9tIi98NcqbZx5Y67RjVYhjcvPmowfHBOYIkGacPmc2ndEhnrHU0v2Sxmiurr2k1ZzY98Q== X-Received: by 2002:a17:902:ea0c:b029:eb:7b6:13ba with SMTP id s12-20020a170902ea0cb02900eb07b613bamr25550934plg.25.1618877420729; Mon, 19 Apr 2021 17:10:20 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:20 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , YOKOTA Hiroshi , Dominik Brodowski Subject: [PATCH 077/117] pcmcia: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:05 -0700 Message-Id: <20210420000845.25873-78-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: YOKOTA Hiroshi Cc: Dominik Brodowski Signed-off-by: Bart Van Assche --- drivers/scsi/pcmcia/nsp_cs.c | 18 ++++++++++-------- drivers/scsi/pcmcia/sym53c500_cs.c | 12 ++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 5d5f50d6a02d..8c3642b6a02e 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -202,7 +202,7 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt, if (data->CurrentSC != NULL) { nsp_msg(KERN_DEBUG, "CurrentSC!=NULL this can't be happen"); - SCpnt->result = DID_BAD_TARGET << 16; + SCpnt->status.combined = DID_BAD_TARGET << 16; nsp_scsi_done(SCpnt); return 0; } @@ -249,7 +249,7 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt, if (nsphw_start_selection(SCpnt) == FALSE) { nsp_dbg(NSP_DEBUG_QUEUECOMMAND, "selection fail"); - SCpnt->result = DID_BUS_BUSY << 16; + SCpnt->status.combined = DID_BUS_BUSY << 16; nsp_scsi_done(SCpnt); return 0; } @@ -1034,7 +1034,8 @@ static irqreturn_t nspintr(int irq, void *dev_id) if(data->CurrentSC != NULL) { tmpSC = data->CurrentSC; - tmpSC->result = (DID_RESET << 16) | + tmpSC->status.combined = + (DID_RESET << 16) | ((tmpSC->SCp.Message & 0xff) << 8) | ((tmpSC->SCp.Status & 0xff) << 0); nsp_scsi_done(tmpSC); @@ -1083,7 +1084,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) data->SelectionTimeOut = 0; nsp_index_write(base, SCSIBUSCTRL, 0); - tmpSC->result = DID_TIME_OUT << 16; + tmpSC->status.combined = DID_TIME_OUT << 16; nsp_scsi_done(tmpSC); return IRQ_HANDLED; @@ -1107,7 +1108,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) // *sync_neg = SYNC_NOT_YET; if ((phase & BUSMON_PHASE_MASK) != BUSPHASE_MESSAGE_IN) { - tmpSC->result = DID_ABORT << 16; + tmpSC->status.combined = DID_ABORT << 16; nsp_scsi_done(tmpSC); return IRQ_HANDLED; } @@ -1133,10 +1134,11 @@ static irqreturn_t nspintr(int irq, void *dev_id) /* all command complete and return status */ if (tmpSC->SCp.Message == COMMAND_COMPLETE) { - tmpSC->result = (DID_OK << 16) | + tmpSC->status.combined = + (DID_OK << 16) | ((tmpSC->SCp.Message & 0xff) << 8) | ((tmpSC->SCp.Status & 0xff) << 0); - nsp_dbg(NSP_DEBUG_INTR, "command complete result=0x%x", tmpSC->result); + nsp_dbg(NSP_DEBUG_INTR, "command complete result=0x%x", tmpSC->status.combined); nsp_scsi_done(tmpSC); return IRQ_HANDLED; @@ -1151,7 +1153,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) nsp_msg(KERN_DEBUG, "unexpected bus free. irq_status=0x%x, phase=0x%x, irq_phase=0x%x", irq_status, phase, irq_phase); *sync_neg = SYNC_NG; - tmpSC->result = DID_ERROR << 16; + tmpSC->status.combined = DID_ERROR << 16; nsp_scsi_done(tmpSC); return IRQ_HANDLED; } diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index a366ff1a3959..2f115b51669a 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -373,34 +373,34 @@ SYM53C500_intr(int irq, void *dev_id) if (int_reg & 0x80) { /* SCSI reset intr */ DEB(printk("SYM53C500: reset intr received\n")); - curSC->result = DID_RESET << 16; + curSC->status.combined = DID_RESET << 16; goto idle_out; } if (pio_status & 0x80) { printk("SYM53C500: Warning: PIO error!\n"); - curSC->result = DID_ERROR << 16; + curSC->status.combined = DID_ERROR << 16; goto idle_out; } if (status & 0x20) { /* Parity error */ printk("SYM53C500: Warning: parity error!\n"); - curSC->result = DID_PARITY << 16; + curSC->status.combined = DID_PARITY << 16; goto idle_out; } if (status & 0x40) { /* Gross error */ printk("SYM53C500: Warning: gross error!\n"); - curSC->result = DID_ERROR << 16; + curSC->status.combined = DID_ERROR << 16; goto idle_out; } if (int_reg & 0x20) { /* Disconnect */ DEB(printk("SYM53C500: disconnect intr received\n")); if (curSC->SCp.phase != message_in) { /* Unexpected disconnect */ - curSC->result = DID_NO_CONNECT << 16; + curSC->status.combined = DID_NO_CONNECT << 16; } else { /* Command complete, return status and message */ - curSC->result = (curSC->SCp.Status & 0xff) + curSC->status.combined = (curSC->SCp.Status & 0xff) | ((curSC->SCp.Message & 0xff) << 8) | (DID_OK << 16); } goto idle_out; From patchwork Tue Apr 20 00:08:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83FE0C433B4 for ; Tue, 20 Apr 2021 00:10:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 477B061363 for ; Tue, 20 Apr 2021 00:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234546AbhDTALT (ORCPT ); Mon, 19 Apr 2021 20:11:19 -0400 Received: from mail-pf1-f179.google.com ([209.85.210.179]:35514 "EHLO mail-pf1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233950AbhDTAKz (ORCPT ); Mon, 19 Apr 2021 20:10:55 -0400 Received: by mail-pf1-f179.google.com with SMTP id h15so6629092pfv.2 for ; Mon, 19 Apr 2021 17:10:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DUfvHdsajaZVu35LKcKGz0ETJBRszLXKGnaU5jF/o8A=; b=PNrOpOFrw7AxPbAoK03xth6f3qDNl2U02ycHXuZDMEfi1elxoL0JXv+e4V/5hK6HpV TuMMZuQtbp5yrzpyq4IA75kz38LFiE9OEQFEYlUl/lLUgDwsVucgmc1I49NAL7/WLIJx TFw2DLVBg79t3AMajgXa+0zVhR/XMi59NINuLwKZ/UrwF7aFtRWf6MoFx8i3rn4WLWMq dSfrqw32gblhhmaA0rs0CErpYp7WpYArkaLfL8w+OQBxytz4jJEoEaQ+4pnbgU2BWqJQ xA3iy1myfHoqu/EVf1vkiMLFPM+VeFEVTJBH2AZP6LB+svX4dFpb7UhOG/eh5i/jqjzC JSgg== X-Gm-Message-State: AOAM530BAar9m4uZWEXFoGq9FWNhY7ynydHwBxH05jzR+Mx470ApShVY DOut/064rqlfG2eUQr3v/AM= X-Google-Smtp-Source: ABdhPJx913ApOsh9Y0fnNqSoicrH9drTz0V2p36sXfQRmHvcggD6l35KG+ab76GcIhv3HC7mHILQ3A== X-Received: by 2002:a05:6a00:d4a:b029:262:3d64:3cf1 with SMTP id n10-20020a056a000d4ab02902623d643cf1mr3507314pfv.14.1618877425236; Mon, 19 Apr 2021 17:10:25 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:24 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Geoff Levand Subject: [PATCH 081/117] ps3rom: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:09 -0700 Message-Id: <20210420000845.25873-82-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Geoff Levand Signed-off-by: Bart Van Assche --- drivers/scsi/ps3rom.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index ccb5771f1cb7..0721a989d3de 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c @@ -235,7 +235,7 @@ static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd, if (res) { memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); - cmd->result = res; + cmd->status.combined = res; cmd->sense_buffer[0] = 0x70; cmd->sense_buffer[2] = ILLEGAL_REQUEST; priv->curr_cmd = NULL; @@ -302,7 +302,7 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data) scsi_set_resid(cmd, scsi_bufflen(cmd) - len); } - cmd->result = DID_OK << 16; + cmd->status.combined = DID_OK << 16; goto done; } @@ -310,17 +310,17 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data) /* SCSI spec says request sense should never get error */ dev_err(&dev->sbd.core, "%s:%u: end error without autosense\n", __func__, __LINE__); - cmd->result = DID_ERROR << 16 | SAM_STAT_CHECK_CONDITION; + cmd->status.combined = DID_ERROR << 16 | SAM_STAT_CHECK_CONDITION; goto done; } if (decode_lv1_status(status, &sense_key, &asc, &ascq)) { - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; goto done; } scsi_build_sense_buffer(0, cmd->sense_buffer, sense_key, asc, ascq); - cmd->result = SAM_STAT_CHECK_CONDITION; + cmd->status.combined = SAM_STAT_CHECK_CONDITION; done: priv->curr_cmd = NULL; From patchwork Tue Apr 20 00:08:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8FEBC433B4 for ; Tue, 20 Apr 2021 00:10:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A997E61363 for ; Tue, 20 Apr 2021 00:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234098AbhDTALY (ORCPT ); Mon, 19 Apr 2021 20:11:24 -0400 Received: from mail-pj1-f41.google.com ([209.85.216.41]:42937 "EHLO mail-pj1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234073AbhDTAK5 (ORCPT ); Mon, 19 Apr 2021 20:10:57 -0400 Received: by mail-pj1-f41.google.com with SMTP id j6-20020a17090adc86b02900cbfe6f2c96so19465391pjv.1 for ; Mon, 19 Apr 2021 17:10:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UtlmJJI5MORHp23o76O3idYuBPuvZL4faGy6iwNmgrk=; b=JPGJ9OAERYoBG8numyU4ENcSlLlkRjXGJWOgAV6K0KfVanyxGWpblIPhBCLNhPxCZ0 pq1VWLmcV9w/Dg5mvBhM74I4+9tyr2EXe60spzP+j4gtRUJ1dBCwj3woFIlQuGpA1Yyv Gp0D5dtjve7esLbTQcYygwjmAqSHYh5F+7+FTsjy1fBI80yp2Iu08pG2spqAIqKy4kM9 H0rmPyBQDXKDl9Q7reiwJez0coGbsx/AP4wP6O9avEC0PYVeb5Z2zyceK7K/VEs8SULd O+XiFPnjms2jiFxpsycTpAN2u6uB0+pUZIn2AptJnx9w6/ZGzIEsd5K8WRoTLCxQCbcV In8g== X-Gm-Message-State: AOAM530igUA9k6qpwzaXLt7Ghjqp4xo+DhQFiRYTwM14jZU5dEI/hS6h bwANc2xGILaez98Qy47trWY= X-Google-Smtp-Source: ABdhPJwbIeR3t6dCMYr9gwE4b2MPFDwf6NtZeD/vxGAO7LXDirYl5zo0rwNU5OUsNVfvpz2HJ2PVJA== X-Received: by 2002:a17:90a:df10:: with SMTP id gp16mr1740740pjb.209.1618877426407; Mon, 19 Apr 2021 17:10:26 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:25 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Saurav Kashyap , Javed Hasan , GR-QLogic-Storage-Upstream@marvell.com Subject: [PATCH 082/117] qedf: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:10 -0700 Message-Id: <20210420000845.25873-83-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Saurav Kashyap Cc: Javed Hasan Cc: GR-QLogic-Storage-Upstream@marvell.com Signed-off-by: Bart Van Assche --- drivers/scsi/qedf/qedf_io.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 4869ef813dc4..8312a75fdd2e 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -825,7 +825,7 @@ static void qedf_trace_io(struct qedf_rport *fcport, struct qedf_ioreq *io_req, io_log->lba[3] = sc_cmd->cmnd[5]; io_log->bufflen = scsi_bufflen(sc_cmd); io_log->sg_count = scsi_sg_count(sc_cmd); - io_log->result = sc_cmd->result; + io_log->result = sc_cmd->status.combined; io_log->jiffies = jiffies; io_log->refcount = kref_read(&io_req->refcount); @@ -951,7 +951,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd) QEDF_ERR(&qedf->dbg_ctx, "Number of SG elements %d exceeds what hardware limitation of %d.\n", num_sgs, QEDF_MAX_BDS_PER_CMD); - sc_cmd->result = DID_ERROR; + sc_cmd->status.combined = DID_ERROR; sc_cmd->scsi_done(sc_cmd); return 0; } @@ -961,7 +961,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd) QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Returning DNC as unloading or stop io, flags 0x%lx.\n", qedf->flags); - sc_cmd->result = DID_NO_CONNECT << 16; + sc_cmd->status.combined = DID_NO_CONNECT << 16; sc_cmd->scsi_done(sc_cmd); return 0; } @@ -970,7 +970,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd) QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "Completing sc_cmd=%p DID_NO_CONNECT as MSI-X is not enabled.\n", sc_cmd); - sc_cmd->result = DID_NO_CONNECT << 16; + sc_cmd->status.combined = DID_NO_CONNECT << 16; sc_cmd->scsi_done(sc_cmd); return 0; } @@ -980,7 +980,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd) QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "fc_remote_port_chkready failed=0x%x for port_id=0x%06x.\n", rval, rport->port_id); - sc_cmd->result = rval; + sc_cmd->status.combined = rval; sc_cmd->scsi_done(sc_cmd); return 0; } @@ -1204,7 +1204,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, "FCP I/O protocol failure xid=0x%x fcp_rsp_len=%d " "fcp_rsp_code=%d.\n", io_req->xid, io_req->fcp_rsp_len, io_req->fcp_rsp_code); - sc_cmd->result = DID_BUS_BUSY << 16; + sc_cmd->status.combined = DID_BUS_BUSY << 16; goto out; } @@ -1219,9 +1219,9 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, sc_cmd->cmnd[3], sc_cmd->cmnd[4], sc_cmd->cmnd[5]); if (io_req->cdb_status == 0) - sc_cmd->result = (DID_ERROR << 16) | io_req->cdb_status; + sc_cmd->status.combined = (DID_ERROR << 16) | io_req->cdb_status; else - sc_cmd->result = (DID_OK << 16) | io_req->cdb_status; + sc_cmd->status.combined = (DID_OK << 16) | io_req->cdb_status; /* * Set resid to the whole buffer length so we won't try to resue @@ -1235,7 +1235,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, case FC_GOOD: if (io_req->cdb_status == 0) { /* Good I/O completion */ - sc_cmd->result = DID_OK << 16; + sc_cmd->status.combined = DID_OK << 16; } else { refcount = kref_read(&io_req->refcount); QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, @@ -1248,7 +1248,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, sc_cmd->cmnd[4], sc_cmd->cmnd[5], io_req->cdb_status, io_req->fcp_resid, refcount); - sc_cmd->result = (DID_OK << 16) | io_req->cdb_status; + sc_cmd->status.combined = (DID_OK << 16) | io_req->cdb_status; if (io_req->cdb_status == SAM_STAT_TASK_SET_FULL || io_req->cdb_status == SAM_STAT_BUSY) { @@ -1406,13 +1406,13 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, qedf_unmap_sg_list(qedf, io_req); - sc_cmd->result = result << 16; + sc_cmd->status.combined = result << 16; refcount = kref_read(&io_req->refcount); QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "%d:0:%d:%lld: Completing " "sc_cmd=%p result=0x%08x op=0x%02x lba=0x%02x%02x%02x%02x, " "allowed=%d retries=%d refcount=%d.\n", qedf->lport->host->host_no, sc_cmd->device->id, - sc_cmd->device->lun, sc_cmd, sc_cmd->result, sc_cmd->cmnd[0], + sc_cmd->device->lun, sc_cmd, sc_cmd->status.combined, sc_cmd->cmnd[0], sc_cmd->cmnd[2], sc_cmd->cmnd[3], sc_cmd->cmnd[4], sc_cmd->cmnd[5], sc_cmd->allowed, sc_cmd->retries, refcount); From patchwork Tue Apr 20 00:08:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0284C433ED for ; Tue, 20 Apr 2021 00:11:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 824326109E for ; Tue, 20 Apr 2021 00:11:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234207AbhDTAL3 (ORCPT ); Mon, 19 Apr 2021 20:11:29 -0400 Received: from mail-pj1-f51.google.com ([209.85.216.51]:41494 "EHLO mail-pj1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbhDTAK7 (ORCPT ); Mon, 19 Apr 2021 20:10:59 -0400 Received: by mail-pj1-f51.google.com with SMTP id y22-20020a17090a8b16b0290150ae1a6d2bso2542606pjn.0 for ; Mon, 19 Apr 2021 17:10:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a1mbA4xYoz6KhuSx0c9jJANBu7PZGogQik2iAzb61ZU=; b=AB5/Jo43c0rX4XB8njqrn/fWIIusNsaYuDE7f2PXJacV2EtbeGacvmQI3whPLl3C0D rE0ulRV7rIZ6by8XOd4PrHEuFA9ToTGvo5lWTygrCiGJYWrlvknX+nbvLPwV2sXSE/bg Fhb70ufUsOMmLUZAkRodCYP/5/lgFLTp57m8Ai6/ZyMi+uWQOowth0yFzoXoe4fEqRML fV2QqUaMxhlB6Ou/2rxSdrgm4zjgByLouT9uZe1qqdxfAfYzTgYAxB3fT3zQkxPIhCgV 9fGUB2zAHWs+p5/CvXE+NE1gxN7jFfkCp9X1Fuy2giD/zDkIX0gg8hRfErkBrpNNn89+ pX6w== X-Gm-Message-State: AOAM533p9bg3Uz2nf8PIynr8qI7CwiCv8wJDjtJu3li/6TrB2zm/IUPK XDZ9gb8BButXWoTLRNjGOLY= X-Google-Smtp-Source: ABdhPJzdt6Oh5o3THA8TCTbtm+DAFvL4Bm6bCffQe1mVti5kxDn/qsegadm1bRilOAohsj0UNDdcMA== X-Received: by 2002:a17:90a:1190:: with SMTP id e16mr1821043pja.110.1618877428686; Mon, 19 Apr 2021 17:10:28 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:28 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Michael Reed Subject: [PATCH 084/117] qla1280: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:12 -0700 Message-Id: <20210420000845.25873-85-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Michael Reed Signed-off-by: Bart Van Assche --- drivers/scsi/qla1280.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 8f35174a1f9a..fbfb67e28038 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c @@ -488,7 +488,7 @@ __setup("qla1280=", qla1280_setup); #define CMD_CDBP(Cmnd) Cmnd->cmnd #define CMD_SNSP(Cmnd) Cmnd->sense_buffer #define CMD_SNSLEN(Cmnd) SCSI_SENSE_BUFFERSIZE -#define CMD_RESULT(Cmnd) Cmnd->result +#define CMD_RESULT(Cmnd) Cmnd->status.combined #define CMD_HANDLE(Cmnd) Cmnd->host_scribble #define CMD_REQUEST(Cmnd) Cmnd->request->cmd From patchwork Tue Apr 20 00:08:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424914 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 457EFC433B4 for ; Tue, 20 Apr 2021 00:11:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 184EF613AA for ; Tue, 20 Apr 2021 00:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234623AbhDTALe (ORCPT ); Mon, 19 Apr 2021 20:11:34 -0400 Received: from mail-pg1-f176.google.com ([209.85.215.176]:44623 "EHLO mail-pg1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234261AbhDTALB (ORCPT ); Mon, 19 Apr 2021 20:11:01 -0400 Received: by mail-pg1-f176.google.com with SMTP id y32so25382947pga.11 for ; Mon, 19 Apr 2021 17:10:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CfLglHRzR42uzEc4wX3Es6j6ZdkaLSNj18LAjvhQXwg=; b=W/o+uPL52WoDvcmmgtbEc36NT6cOLOdhPrCiZxPoQ2B08jsiq3/+pAN6cYL491NhSs u7M6PKEYYLE2RZyRErngmoU+6WyqAfzOrL5GZ2w7IBevFOuwI4kpN4aAHF8JPBRj2uDD M4LazLUlO12Kh6P1yDG1KQsNUZ3bDxPChqoZsNme2Gj/TilgYk7soOZWFypCsvWow6J/ 8UOau9ZaBAwlrIQIieaFUqxEtcQcbK2zq8xzdp8WeUcz0pCL/cpPV9j5DUQ2UCXYY7z1 0voS+i/97sqsPuVAU+B+j3ssP3pE7Tc1FT9hK57gsj8E7jRs8nPNvbng7XK5TmTvjCIQ OCcg== X-Gm-Message-State: AOAM532hCu2OhO3DBU/ZEhQ4Fo55Gdka9bbsdsQVAHux/2PXm2vXgGLA X58pHu29xwThiFfNWPV32Rw= X-Google-Smtp-Source: ABdhPJzNM9oRXzfCLSRAW6ei9cvcLiUPdLeJ4JoaLZFUBKZxdMlS8naxCEAFS21UYvsSRX88D21cRA== X-Received: by 2002:a65:4889:: with SMTP id n9mr14100454pgs.91.1618877431130; Mon, 19 Apr 2021 17:10:31 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:30 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Nilesh Javali , Manish Rangankar , GR-QLogic-Storage-Upstream@marvell.com Subject: [PATCH 086/117] qla4xxx: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:14 -0700 Message-Id: <20210420000845.25873-87-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Nilesh Javali Cc: Manish Rangankar Cc: GR-QLogic-Storage-Upstream@marvell.com Signed-off-by: Bart Van Assche --- drivers/scsi/qla4xxx/ql4_bsg.c | 76 +++++++++++++++++----------------- drivers/scsi/qla4xxx/ql4_isr.c | 32 +++++++------- drivers/scsi/qla4xxx/ql4_os.c | 14 +++---- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/drivers/scsi/qla4xxx/ql4_bsg.c b/drivers/scsi/qla4xxx/ql4_bsg.c index c447a9d598a1..8f1c8879a6e9 100644 --- a/drivers/scsi/qla4xxx/ql4_bsg.c +++ b/drivers/scsi/qla4xxx/ql4_bsg.c @@ -55,17 +55,17 @@ qla4xxx_read_flash(struct bsg_job *bsg_job) rval = qla4xxx_get_flash(ha, flash_dma, offset, length); if (rval) { ql4_printk(KERN_ERR, ha, "%s: get flash failed\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; rval = -EIO; } else { bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, flash, length); - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; } - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); dma_free_coherent(&ha->pdev->dev, length, flash, flash_dma); leave: @@ -125,12 +125,12 @@ qla4xxx_update_flash(struct bsg_job *bsg_job) rval = qla4xxx_set_flash(ha, flash_dma, offset, length, options); if (rval) { ql4_printk(KERN_ERR, ha, "%s: set flash failed\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; rval = -EIO; } else - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); dma_free_coherent(&ha->pdev->dev, length, flash, flash_dma); leave: @@ -179,17 +179,17 @@ qla4xxx_get_acb_state(struct bsg_job *bsg_job) if (rval) { ql4_printk(KERN_ERR, ha, "%s: get ip state failed\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; rval = -EIO; } else { bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, status, sizeof(status)); - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; } - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); leave: return rval; @@ -250,17 +250,17 @@ qla4xxx_read_nvram(struct bsg_job *bsg_job) rval = qla4xxx_get_nvram(ha, nvram_dma, offset, len); if (rval) { ql4_printk(KERN_ERR, ha, "%s: get nvram failed\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; rval = -EIO; } else { bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, nvram, len); - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; } - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); dma_free_coherent(&ha->pdev->dev, len, nvram, nvram_dma); leave: @@ -324,12 +324,12 @@ qla4xxx_update_nvram(struct bsg_job *bsg_job) rval = qla4xxx_set_nvram(ha, nvram_dma, offset, len); if (rval) { ql4_printk(KERN_ERR, ha, "%s: set nvram failed\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; rval = -EIO; } else - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); dma_free_coherent(&ha->pdev->dev, len, nvram, nvram_dma); leave: @@ -369,12 +369,12 @@ qla4xxx_restore_defaults(struct bsg_job *bsg_job) rval = qla4xxx_restore_factory_defaults(ha, region, field0, field1); if (rval) { ql4_printk(KERN_ERR, ha, "%s: set nvram failed\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; rval = -EIO; } else - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); leave: return rval; @@ -428,17 +428,17 @@ qla4xxx_bsg_get_acb(struct bsg_job *bsg_job) rval = qla4xxx_get_acb(ha, acb_dma, acb_type, len); if (rval) { ql4_printk(KERN_ERR, ha, "%s: get acb failed\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; rval = -EIO; } else { bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, acb, len); - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; } - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); dma_free_coherent(&ha->pdev->dev, len, acb, acb_dma); leave: @@ -461,7 +461,7 @@ static void ql4xxx_execute_diag_cmd(struct bsg_job *bsg_job) if (test_bit(DPC_RESET_HA, &ha->dpc_flags)) { ql4_printk(KERN_INFO, ha, "%s: Adapter reset in progress. Invalid Request\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; goto exit_diag_mem_test; } @@ -485,9 +485,9 @@ static void ql4xxx_execute_diag_cmd(struct bsg_job *bsg_job) mbox_sts[7])); if (status == QLA_SUCCESS) - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; else - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; /* Send mbox_sts to application */ bsg_job->reply_len = sizeof(struct iscsi_bsg_reply) + sizeof(mbox_sts); @@ -497,9 +497,9 @@ static void ql4xxx_execute_diag_cmd(struct bsg_job *bsg_job) exit_diag_mem_test: DEBUG2(ql4_printk(KERN_INFO, ha, "%s: bsg_reply->result = x%x, status = %s\n", - __func__, bsg_reply->result, STATUS(status))); + __func__, bsg_reply->status.combined, STATUS(status))); - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } @@ -668,14 +668,14 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job) if (test_bit(AF_LOOPBACK, &ha->flags)) { ql4_printk(KERN_INFO, ha, "%s: Loopback Diagnostics already in progress. Invalid Request\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; goto exit_loopback_cmd; } if (test_bit(DPC_RESET_HA, &ha->dpc_flags)) { ql4_printk(KERN_INFO, ha, "%s: Adapter reset in progress. Invalid Request\n", __func__); - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; goto exit_loopback_cmd; } @@ -685,14 +685,14 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job) if (is_qla8032(ha) || is_qla8042(ha)) { status = qla4_83xx_pre_loopback_config(ha, mbox_cmd); if (status != QLA_SUCCESS) { - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; goto exit_loopback_cmd; } status = qla4_83xx_wait_for_loopback_config_comp(ha, wait_for_link); if (status != QLA_SUCCESS) { - bsg_reply->result = DID_TIME_OUT << 16; + bsg_reply->status.combined = DID_TIME_OUT << 16; goto restore; } } @@ -707,9 +707,9 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job) &mbox_sts[0]); if (status == QLA_SUCCESS) - bsg_reply->result = DID_OK << 16; + bsg_reply->status.combined = DID_OK << 16; else - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; DEBUG2(ql4_printk(KERN_INFO, ha, "%s: mbox_sts: %08X %08X %08X %08X %08X %08X %08X %08X\n", @@ -725,7 +725,7 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job) if (is_qla8032(ha) || is_qla8042(ha)) { status = qla4_83xx_post_loopback_config(ha, mbox_cmd); if (status != QLA_SUCCESS) { - bsg_reply->result = DID_ERROR << 16; + bsg_reply->status.combined = DID_ERROR << 16; goto exit_loopback_cmd; } @@ -737,15 +737,15 @@ static void qla4xxx_execute_diag_loopback_cmd(struct bsg_job *bsg_job) status = qla4_83xx_wait_for_loopback_config_comp(ha, wait_for_link); if (status != QLA_SUCCESS) { - bsg_reply->result = DID_TIME_OUT << 16; + bsg_reply->status.combined = DID_TIME_OUT << 16; goto exit_loopback_cmd; } } exit_loopback_cmd: DEBUG2(ql4_printk(KERN_INFO, ha, "%s: bsg_reply->result = x%x, status = %s\n", - __func__, bsg_reply->result, STATUS(status))); - bsg_job_done(bsg_job, bsg_reply->result, + __func__, bsg_reply->status.combined, STATUS(status))); + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); } @@ -841,9 +841,9 @@ int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job) default: ql4_printk(KERN_ERR, ha, "%s: invalid BSG vendor command: " "0x%x\n", __func__, bsg_req->msgcode); - bsg_reply->result = (DID_ERROR << 16); + bsg_reply->status.combined = (DID_ERROR << 16); bsg_reply->reply_payload_rcv_len = 0; - bsg_job_done(bsg_job, bsg_reply->result, + bsg_job_done(bsg_job, bsg_reply->status.combined, bsg_reply->reply_payload_rcv_len); return -ENOSYS; } diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c index 6f0e77dc2a34..d31b7dcb6be4 100644 --- a/drivers/scsi/qla4xxx/ql4_isr.c +++ b/drivers/scsi/qla4xxx/ql4_isr.c @@ -145,7 +145,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, ddb_entry = srb->ddb; if (ddb_entry == NULL) { - cmd->result = DID_NO_CONNECT << 16; + cmd->status.combined = DID_NO_CONNECT << 16; goto status_entry_exit; } @@ -157,7 +157,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, case SCS_COMPLETE: if (sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_OVER) { - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; break; } @@ -166,7 +166,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, if (!scsi_status && ((scsi_bufflen(cmd) - residual) < cmd->underflow)) { - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; DEBUG2(printk("scsi%ld:%d:%d:%llu: %s: " "Mid-layer Data underrun0, " @@ -180,7 +180,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, } } - cmd->result = DID_OK << 16 | scsi_status; + cmd->status.combined = DID_OK << 16 | scsi_status; if (scsi_status != SAM_STAT_CHECK_CONDITION) break; @@ -192,7 +192,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, case SCS_INCOMPLETE: /* Always set the status to DID_ERROR, since * all conditions result in that status anyway */ - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; break; case SCS_RESET_OCCURRED: @@ -200,7 +200,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, ha->host_no, cmd->device->channel, cmd->device->id, cmd->device->lun, __func__)); - cmd->result = DID_RESET << 16; + cmd->status.combined = DID_RESET << 16; break; case SCS_ABORTED: @@ -208,7 +208,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, ha->host_no, cmd->device->channel, cmd->device->id, cmd->device->lun, __func__)); - cmd->result = DID_RESET << 16; + cmd->status.combined = DID_RESET << 16; break; case SCS_TIMEOUT: @@ -216,7 +216,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, ha->host_no, cmd->device->channel, cmd->device->id, cmd->device->lun)); - cmd->result = DID_TRANSPORT_DISRUPTED << 16; + cmd->status.combined = DID_TRANSPORT_DISRUPTED << 16; /* * Mark device missing so that we won't continue to send @@ -236,7 +236,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, cmd->device->channel, cmd->device->id, cmd->device->lun, __func__)); - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; break; } @@ -266,7 +266,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, scsi_bufflen(cmd), residual)); - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; break; } @@ -298,11 +298,11 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, residual, scsi_bufflen(cmd))); - cmd->result = DID_ERROR << 16 | scsi_status; + cmd->status.combined = DID_ERROR << 16 | scsi_status; goto check_scsi_status; } - cmd->result = DID_OK << 16 | scsi_status; + cmd->status.combined = DID_OK << 16 | scsi_status; check_scsi_status: if (scsi_status == SAM_STAT_CHECK_CONDITION) @@ -324,14 +324,14 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, if (iscsi_is_session_online(ddb_entry->sess)) qla4xxx_mark_device_missing(ddb_entry->sess); - cmd->result = DID_TRANSPORT_DISRUPTED << 16; + cmd->status.combined = DID_TRANSPORT_DISRUPTED << 16; break; case SCS_QUEUE_FULL: /* * SCSI Mid-Layer handles device queue full */ - cmd->result = DID_OK << 16 | sts_entry->scsiStatus; + cmd->status.combined = DID_OK << 16 | sts_entry->scsiStatus; DEBUG2(printk("scsi%ld:%d:%llu: %s: QUEUE FULL detected " "compl=%02x, scsi=%02x, state=%02x, iFlags=%02x," " iResp=%02x\n", ha->host_no, cmd->device->id, @@ -343,7 +343,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, break; default: - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; break; } @@ -529,7 +529,7 @@ void qla4xxx_process_response_queue(struct scsi_qla_host *ha) /* ETRY normally by sending it back with * DID_BUS_BUSY */ - srb->cmd->result = DID_BUS_BUSY << 16; + srb->cmd->status.combined = DID_BUS_BUSY << 16; kref_put(&srb->srb_ref, qla4xxx_srb_compl); break; diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index ad3afe30f617..5746c16dfc48 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -4106,20 +4106,20 @@ static int qla4xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) if (test_bit(AF_EEH_BUSY, &ha->flags)) { if (test_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags)) - cmd->result = DID_NO_CONNECT << 16; + cmd->status.combined = DID_NO_CONNECT << 16; else - cmd->result = DID_REQUEUE << 16; + cmd->status.combined = DID_REQUEUE << 16; goto qc_fail_command; } if (!sess) { - cmd->result = DID_IMM_RETRY << 16; + cmd->status.combined = DID_IMM_RETRY << 16; goto qc_fail_command; } rval = iscsi_session_chkready(sess); if (rval) { - cmd->result = rval; + cmd->status.combined = rval; goto qc_fail_command; } @@ -4802,7 +4802,7 @@ static void qla4xxx_abort_active_cmds(struct scsi_qla_host *ha, int res) for (i = 0; i < ha->host->can_queue; i++) { srb = qla4xxx_del_from_active_array(ha, i); if (srb != NULL) { - srb->cmd->result = res; + srb->cmd->status.combined = res; kref_put(&srb->srb_ref, qla4xxx_srb_compl); } } @@ -9283,7 +9283,7 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd) "scsi%ld: DEVICE_RESET cmd=%p jiffies = 0x%lx, to=%x," "dpc_flags=%lx, status=%x allowed=%d\n", ha->host_no, cmd, jiffies, cmd->request->timeout / HZ, - ha->dpc_flags, cmd->result, cmd->allowed)); + ha->dpc_flags, cmd->status.combined, cmd->allowed)); rval = qla4xxx_isp_check_reg(ha); if (rval != QLA_SUCCESS) { @@ -9350,7 +9350,7 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd) "scsi%ld: TARGET_DEVICE_RESET cmd=%p jiffies = 0x%lx, " "to=%x,dpc_flags=%lx, status=%x allowed=%d\n", ha->host_no, cmd, jiffies, cmd->request->timeout / HZ, - ha->dpc_flags, cmd->result, cmd->allowed)); + ha->dpc_flags, cmd->status.combined, cmd->allowed)); rval = qla4xxx_isp_check_reg(ha); if (rval != QLA_SUCCESS) { From patchwork Tue Apr 20 00:08:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA4F9C433B4 for ; Tue, 20 Apr 2021 00:11:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7FFB6109E for ; Tue, 20 Apr 2021 00:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234630AbhDTALo (ORCPT ); Mon, 19 Apr 2021 20:11:44 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:38688 "EHLO mail-pf1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234302AbhDTALE (ORCPT ); Mon, 19 Apr 2021 20:11:04 -0400 Received: by mail-pf1-f180.google.com with SMTP id g16so11017337pfq.5 for ; Mon, 19 Apr 2021 17:10:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=13Z5prKfPZbyA8SZjiVEQIObHKOl5ga5b7LyLQpdpPY=; b=flMrdtN9vUTfagSxo3bj1TL3RH7Bdg67jNQ3Ci1rdkuqxgeQjB/xWfRYN7fl6xQAtP 4cx7a5AESAIT5aFFWpcphw21xrBOamaGz+sl3rnkFr1pwHpJyApmAE5LnMJ5wcHP9jNd JGuVCzOWoghsusmc/fcu/eA2NhjN4rTY81w9vbgsEUYKCriiGEapwwtZ8fRaWPbHrGa5 +ooVackREGVw+koXdL50p1D10QKu57AdyvwqOkj1LslJ757Ga0LP2iSu8esYVOMvTOQE u27pNVlhqYSMNEB32R9u6gWRHJyLhiCQSCLXO1F7m+oblWbKbDNX17BnY2DHczP6UBUQ ktQQ== X-Gm-Message-State: AOAM532IWOcBNXhPkBWK5Hi/vjLUydO5OnzyW6xFsjVT6nETN3HX2bO7 4eNP+yeSMzHefHhV8odUOPTnKI43D1dStA== X-Google-Smtp-Source: ABdhPJzNG2nbMsO2mSU0QodSf7BbQNeAG0GOWu/qKuJHCDJdCu3IYzOxKaWa1kPbGJipFSrnYbsnSg== X-Received: by 2002:a63:7842:: with SMTP id t63mr4440352pgc.233.1618877433334; Mon, 19 Apr 2021 17:10:33 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:32 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , GR-QLogic-Storage-Upstream@marvell.com Subject: [PATCH 088/117] qlogicpti: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:16 -0700 Message-Id: <20210420000845.25873-89-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: GR-QLogic-Storage-Upstream@marvell.com Signed-off-by: Bart Van Assche --- drivers/scsi/qlogicpti.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index d84e218d32cb..31d070a7f138 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -1057,7 +1057,7 @@ static int qlogicpti_queuecommand_lck(struct scsi_cmnd *Cmnd, void (*done)(struc * we don't, the midlayer will ignore the return value, * which is insane. We pick up the pieces like this. */ - Cmnd->result = DID_BUS_BUSY; + Cmnd->status.combined = DID_BUS_BUSY; done(Cmnd); return 1; } @@ -1180,10 +1180,10 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) SCSI_SENSE_BUFFERSIZE); if (sts->hdr.entry_type == ENTRY_STATUS) - Cmnd->result = + Cmnd->status.combined = qlogicpti_return_status(sts, qpti->qpti_id); else - Cmnd->result = DID_ERROR << 16; + Cmnd->status.combined = DID_ERROR << 16; if (scsi_bufflen(Cmnd)) dma_unmap_sg(&qpti->op->dev, From patchwork Tue Apr 20 00:08:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C40B4C43460 for ; Tue, 20 Apr 2021 00:11:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 937816109E for ; Tue, 20 Apr 2021 00:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234322AbhDTALt (ORCPT ); Mon, 19 Apr 2021 20:11:49 -0400 Received: from mail-pl1-f169.google.com ([209.85.214.169]:36384 "EHLO mail-pl1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234340AbhDTALG (ORCPT ); Mon, 19 Apr 2021 20:11:06 -0400 Received: by mail-pl1-f169.google.com with SMTP id g16so1822396plq.3 for ; Mon, 19 Apr 2021 17:10:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o9MOQF56pRR74SORwC9yfTAfR6HFmUWE31VmpD+WiHU=; b=B3PBalh1JpXQb4sD0pslKgX7fcixgfASmErmFUduZ6jY6UIPN6cnSQlJlI6m4rWkPq iImZ0ly9c5sl7S3Lmetvr5Ie8ExHb5O9juw1Uc1QQ64l0A84v6ERQXjqze360pJsOE4w zb6vb+7OZIpqE1TEbn2lK5NQSOfPMqzg45yqLfpre2464QeHS6tIE4n9l3Jx5gKLdd1+ 34yI0PvHX3LVQbQRSX01fu4swLKwR2ZCuVePgs7m+wtASdZMZCf4tW78bWNoeZ2KzvMe lKQ6a2MZ0hcslGOG+D+O3GDxCCWO0u/EUNLoxWAdH3sLwHmLXOxKAw+fZZq6GyoMoEVB 6DsA== X-Gm-Message-State: AOAM533YoOL9AQ3e3/8lF2ysxrQ96bmA8mJoCnF0P6eZyBx3qHhH/5Xl ZX8hRCwEb4y6DzATaBaVOPBni7qF4MB+lw== X-Google-Smtp-Source: ABdhPJzQq7etywuGvXkyQSwLJgPa9VIl0PuLAZZKFu+39U3Q8c4WcvDJLoMrUmkOsbXxPe8y5Kqr/g== X-Received: by 2002:a17:90b:1646:: with SMTP id il6mr1827267pjb.27.1618877435983; Mon, 19 Apr 2021 17:10:35 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id 33sm14006787pgq.21.2021.04.19.17.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 17:10:35 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Douglas Gilbert Subject: [PATCH 090/117] scsi_debug: Convert to the scsi_status union Date: Mon, 19 Apr 2021 17:08:18 -0700 Message-Id: <20210420000845.25873-91-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Douglas Gilbert Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_debug.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 70165be10f00..819d872ee8ea 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5458,24 +5458,24 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, ns_from_boot = ktime_get_boottime_ns(); /* one of the resp_*() response functions is called here */ - cmnd->result = pfp ? pfp(cmnd, devip) : 0; - if (cmnd->result & SDEG_RES_IMMED_MASK) { - cmnd->result &= ~SDEG_RES_IMMED_MASK; + cmnd->status.combined = pfp ? pfp(cmnd, devip) : 0; + if (cmnd->status.combined & SDEG_RES_IMMED_MASK) { + cmnd->status.combined &= ~SDEG_RES_IMMED_MASK; delta_jiff = ndelay = 0; } - if (cmnd->result == 0 && scsi_result != 0) - cmnd->result = scsi_result; - if (cmnd->result == 0 && unlikely(sdebug_opts & SDEBUG_OPT_TRANSPORT_ERR)) { + if (cmnd->status.combined == 0 && scsi_result != 0) + cmnd->status.combined = scsi_result; + if (cmnd->status.combined == 0 && unlikely(sdebug_opts & SDEBUG_OPT_TRANSPORT_ERR)) { if (atomic_read(&sdeb_inject_pending)) { mk_sense_buffer(cmnd, ABORTED_COMMAND, TRANSPORT_PROBLEM, ACK_NAK_TO); atomic_set(&sdeb_inject_pending, 0); - cmnd->result = check_condition_result; + cmnd->status.combined = check_condition_result; } } - if (unlikely(sdebug_verbose && cmnd->result)) + if (unlikely(sdebug_verbose && cmnd->status.combined)) sdev_printk(KERN_INFO, sdp, "%s: non-zero result=0x%x\n", - __func__, cmnd->result); + __func__, cmnd->status.combined); if (delta_jiff > 0 || ndelay > 0) { ktime_t kt; @@ -5582,10 +5582,10 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, return 0; respond_in_thread: /* call back to mid-layer using invocation thread */ - cmnd->result = pfp != NULL ? pfp(cmnd, devip) : 0; - cmnd->result &= ~SDEG_RES_IMMED_MASK; - if (cmnd->result == 0 && scsi_result != 0) - cmnd->result = scsi_result; + cmnd->status.combined = pfp != NULL ? pfp(cmnd, devip) : 0; + cmnd->status.combined &= ~SDEG_RES_IMMED_MASK; + if (cmnd->status.combined == 0 && scsi_result != 0) + cmnd->status.combined = scsi_result; cmnd->scsi_done(cmnd); return 0; } From patchwork Tue Apr 20 02:13:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2818C433B4 for ; Tue, 20 Apr 2021 02:14:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4D94613AB for ; Tue, 20 Apr 2021 02:14:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231140AbhDTCOk (ORCPT ); Mon, 19 Apr 2021 22:14:40 -0400 Received: from mail-pg1-f179.google.com ([209.85.215.179]:34793 "EHLO mail-pg1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbhDTCOk (ORCPT ); Mon, 19 Apr 2021 22:14:40 -0400 Received: by mail-pg1-f179.google.com with SMTP id z16so25557191pga.1 for ; Mon, 19 Apr 2021 19:14:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zFbN8saB6T93YtUOIUueNaMRZiAEDaBUE7y0+opFg+g=; b=SnRe0x2InUX8P5rG07WF7Y0mKdhUx6OCBpGA38Mlpqqgux9FKuYnCB6kovrwiBKL1n 2cnrrd9OI6LshaSlrYf4sb0Z8kh3GagaunhOVOYt5qUROM2pnIyD4P7i3LkL2bUfhZOR McYALc81ukQdzTONaymHIK3xqM6wlrw8EnqvIEXkqPdKqs6PrcoDTtfpLtbQcsF+4WuJ PlRNCD0w/l6CzeXIZZgrPluezhybsxdjgA6yOp/lsVeCwmRXMj3M/2Ocsf6GLR7QXBBo spY84doylKdjXNIN1Yow/7FuhP/7FA+bUBd7VCueSwJTnTWAf9Z7Exjtzn1u/JkEAKlH a0WA== X-Gm-Message-State: AOAM530btDFCHkJJPD4aIu4h/3TfP9+xEDax3wRfS8cbb0TO89bBXyB3 DPPlrAntTbwhT9D9S+J3rb0= X-Google-Smtp-Source: ABdhPJz+9U7AAtH1CbPGkK5NwU7rXkp2s9/TfXplKEyDCSUYmVv2/Xr6Lz86yTjqQ8uNtDBe51xSYg== X-Received: by 2002:a62:878d:0:b029:257:ba2e:b6b2 with SMTP id i135-20020a62878d0000b0290257ba2eb6b2mr21797717pfe.11.1618884849528; Mon, 19 Apr 2021 19:14:09 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:08 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace Subject: [PATCH 091/117] smartpqi: Convert to the scsi_status union Date: Mon, 19 Apr 2021 19:13:36 -0700 Message-Id: <20210420021402.27678-1-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Don Brace Signed-off-by: Bart Van Assche --- drivers/scsi/smartpqi/smartpqi_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 25c0409e98df..55bdc2c180a8 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -3001,7 +3001,7 @@ static void pqi_process_raid_io_error(struct pqi_io_request *io_request) sense_data_length); } - scmd->result = scsi_status; + scmd->status.combined = scsi_status; set_host_byte(scmd, host_byte); } @@ -3091,7 +3091,7 @@ static void pqi_process_aio_io_error(struct pqi_io_request *io_request) scsi_build_sense_buffer(0, scmd->sense_buffer, HARDWARE_ERROR, 0x3e, 0x1); - scmd->result = scsi_status; + scmd->status.combined = scsi_status; set_host_byte(scmd, host_byte); } @@ -3188,7 +3188,7 @@ static int pqi_process_io_intr(struct pqi_ctrl_info *ctrl_info, struct pqi_queue case PQI_RESPONSE_IU_RAID_PATH_IO_SUCCESS: case PQI_RESPONSE_IU_AIO_PATH_IO_SUCCESS: if (io_request->scmd) - io_request->scmd->result = 0; + io_request->scmd->status.combined = 0; fallthrough; case PQI_RESPONSE_IU_GENERAL_MANAGEMENT: break; @@ -5333,9 +5333,9 @@ static bool pqi_raid_bypass_retry_needed(struct pqi_io_request *io_request) return false; scmd = io_request->scmd; - if ((scmd->result & 0xff) == SAM_STAT_GOOD) + if ((scmd->status.combined & 0xff) == SAM_STAT_GOOD) return false; - if (host_byte(scmd->result) == DID_NO_CONNECT) + if (host_byte(scmd->status) == DID_NO_CONNECT) return false; device = scmd->device->hostdata; @@ -5719,7 +5719,7 @@ static int pqi_scsi_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scm * This is necessary because the SML doesn't zero out this field during * error recovery. */ - scmd->result = 0; + scmd->status.combined = 0; hw_queue = pqi_get_hw_queue(ctrl_info, scmd); queue_group = &ctrl_info->queue_groups[hw_queue]; From patchwork Tue Apr 20 02:13:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F04D2C433B4 for ; Tue, 20 Apr 2021 02:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8876611EE for ; Tue, 20 Apr 2021 02:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233430AbhDTCOo (ORCPT ); Mon, 19 Apr 2021 22:14:44 -0400 Received: from mail-pl1-f172.google.com ([209.85.214.172]:35527 "EHLO mail-pl1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231693AbhDTCOm (ORCPT ); Mon, 19 Apr 2021 22:14:42 -0400 Received: by mail-pl1-f172.google.com with SMTP id e9so1836562plj.2 for ; Mon, 19 Apr 2021 19:14:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FRvAzcibd8eNyJOlNByQi/0ebIXSgfv3RMgPMs8ZpsQ=; b=cO4q9HC7NJNxdvXi7y4JUqcrIJLagylFC6aJTConmifyealqdwwzE0sKenwXbtrFP8 f+Y4NWBks6WrsezFXCJm9Z0idaBUO7zSne8pw4N6HsjHc5UG0FSTdu7U5u9t21xoTYF1 iJXauOa+nNoVoRYlgIpLFIBgVyNti0rQ2GUa88m2+Gn7LqYUm4BxxxD2zWy2EpUTB+Py ZdkDX+cyVZMlaPsW/Z00cigb5va6VS2o0rnoZZHoGA9Znp0d7WIWKHCuoCliWnIMYE7O ycCo0jv0pXF80xfMEVs2rFWQ4BNts4mfPNQ5SYA1Xbb6iM6BZq0oAy4L1Y7WmO+N+mNr bykA== X-Gm-Message-State: AOAM5333cFlTLPaqHr/zP42ZREvHaBnncNLe2jPuRFNvKK4cm7yB3q5y leetegOSVAOI3h0Zw0FHdg6MpoRdXsixYA== X-Google-Smtp-Source: ABdhPJzk2cMJhM8cnkGmErz7qN2NZSzyOlyDpPai3mIHP31tq4q1hVtLwM9HdtzlfaqeTLNdpIus8g== X-Received: by 2002:a17:90a:1c02:: with SMTP id s2mr2219537pjs.17.1618884851835; Mon, 19 Apr 2021 19:14:11 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:11 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Greg Kroah-Hartman Subject: [PATCH 093/117] staging: Convert to the scsi_status union Date: Mon, 19 Apr 2021 19:13:38 -0700 Message-Id: <20210420021402.27678-3-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Greg Kroah-Hartman Signed-off-by: Bart Van Assche --- drivers/staging/rts5208/rtsx.c | 14 +++++++------- drivers/staging/rts5208/rtsx_transport.c | 8 ++++---- drivers/staging/unisys/include/iochannel.h | 3 ++- drivers/staging/unisys/visorhba/visorhba_main.c | 12 ++++++------ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c index 898add4d1fc8..5e97fee2fa16 100644 --- a/drivers/staging/rts5208/rtsx.c +++ b/drivers/staging/rts5208/rtsx.c @@ -134,7 +134,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb, /* fail the command if we are disconnecting */ if (rtsx_chk_stat(chip, RTSX_STAT_DISCONNECT)) { dev_info(&dev->pci->dev, "Fail command during disconnect\n"); - srb->result = DID_NO_CONNECT << 16; + srb->status.combined = DID_NO_CONNECT << 16; done(srb); return 0; } @@ -377,7 +377,7 @@ static int rtsx_control_thread(void *__dev) /* has the command aborted ? */ if (rtsx_chk_stat(chip, RTSX_STAT_ABORT)) { - chip->srb->result = DID_ABORT << 16; + chip->srb->status.combined = DID_ABORT << 16; goto skip_for_abort; } @@ -388,7 +388,7 @@ static int rtsx_control_thread(void *__dev) */ if (chip->srb->sc_data_direction == DMA_BIDIRECTIONAL) { dev_err(&dev->pci->dev, "UNKNOWN data direction\n"); - chip->srb->result = DID_ERROR << 16; + chip->srb->status.combined = DID_ERROR << 16; } /* reject if target != 0 or if LUN is higher than @@ -398,14 +398,14 @@ static int rtsx_control_thread(void *__dev) dev_err(&dev->pci->dev, "Bad target number (%d:%d)\n", chip->srb->device->id, (u8)chip->srb->device->lun); - chip->srb->result = DID_BAD_TARGET << 16; + chip->srb->status.combined = DID_BAD_TARGET << 16; } else if (chip->srb->device->lun > chip->max_lun) { dev_err(&dev->pci->dev, "Bad LUN (%d:%d)\n", chip->srb->device->id, (u8)chip->srb->device->lun); - chip->srb->result = DID_BAD_TARGET << 16; + chip->srb->status.combined = DID_BAD_TARGET << 16; } /* we've got a command, let's do it! */ @@ -422,7 +422,7 @@ static int rtsx_control_thread(void *__dev) ; /* nothing to do */ /* indicate that the command is done */ - else if (chip->srb->result != DID_ABORT << 16) { + else if (chip->srb->status.combined != DID_ABORT << 16) { chip->srb->scsi_done(chip->srb); } else { skip_for_abort: @@ -633,7 +633,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev) */ mutex_lock(&dev->dev_mutex); if (chip->srb) { - chip->srb->result = DID_NO_CONNECT << 16; + chip->srb->status.combined = DID_NO_CONNECT << 16; scsi_lock(host); chip->srb->scsi_done(dev->chip->srb); chip->srb = NULL; diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index 909a3e663ef6..1c8a0bda8e25 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -160,18 +160,18 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip) */ if (rtsx_chk_stat(chip, RTSX_STAT_ABORT)) { dev_dbg(rtsx_dev(chip), "-- command was aborted\n"); - srb->result = DID_ABORT << 16; + srb->status.combined = DID_ABORT << 16; goto handle_errors; } /* if there is a transport error, reset and don't auto-sense */ if (result == TRANSPORT_ERROR) { dev_dbg(rtsx_dev(chip), "-- transport indicates error, resetting\n"); - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; goto handle_errors; } - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; /* * If we have a failure, we're going to do a REQUEST_SENSE @@ -180,7 +180,7 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip) */ if (result == TRANSPORT_FAILED) { /* set the result so the higher layers expect this data */ - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; memcpy(srb->sense_buffer, (unsigned char *)&chip->sense_buffer[SCSI_LUN(srb)], sizeof(struct sense_data_t)); diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 9ef812c0bc42..810548f469b2 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -34,6 +34,7 @@ #include #include #include +#include /* * Must increment these whenever you insert or delete fields within this channel @@ -217,7 +218,7 @@ struct uiscmdrsp_scsi { u32 data_dir; struct uisscsi_dest vdest; /* Needed to queue the rsp back to cmd originator. */ - int linuxstat; + union scsi_status linuxstat; u8 scsistat; u8 addlstat; #define ADDL_SEL_TIMEOUT 4 diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 4455d26f7c96..895bd33a96d6 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -343,7 +343,7 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd) atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD); rtn = forward_taskmgmt_command(TASK_MGMT_ABORT_TASK, scsidev); if (rtn == SUCCESS) { - scsicmd->result = DID_ABORT << 16; + scsicmd->status.combined = DID_ABORT << 16; scsicmd->scsi_done(scsicmd); } return rtn; @@ -370,7 +370,7 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd) atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD); rtn = forward_taskmgmt_command(TASK_MGMT_LUN_RESET, scsidev); if (rtn == SUCCESS) { - scsicmd->result = DID_RESET << 16; + scsicmd->status.combined = DID_RESET << 16; scsicmd->scsi_done(scsicmd); } return rtn; @@ -399,7 +399,7 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd) } rtn = forward_taskmgmt_command(TASK_MGMT_BUS_RESET, scsidev); if (rtn == SUCCESS) { - scsicmd->result = DID_RESET << 16; + scsicmd->status.combined = DID_RESET << 16; scsicmd->scsi_done(scsicmd); } return rtn; @@ -702,7 +702,7 @@ static void visorhba_serverdown_complete(struct visorhba_devdata *devdata) switch (pendingdel->cmdtype) { case CMD_SCSI_TYPE: scsicmd = pendingdel->sent; - scsicmd->result = DID_RESET << 16; + scsicmd->status.combined = DID_RESET << 16; if (scsicmd->scsi_done) scsicmd->scsi_done(scsicmd); break; @@ -864,8 +864,8 @@ static void complete_scsi_command(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) { /* take what we need out of cmdrsp and complete the scsicmd */ - scsicmd->result = cmdrsp->scsi.linuxstat; - if (cmdrsp->scsi.linuxstat) + scsicmd->status = cmdrsp->scsi.linuxstat; + if (cmdrsp->scsi.linuxstat.combined) do_scsi_linuxstat(cmdrsp, scsicmd); else do_scsi_nolinuxstat(cmdrsp, scsicmd); From patchwork Tue Apr 20 02:13:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABD14C433B4 for ; Tue, 20 Apr 2021 02:14:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F50D61107 for ; Tue, 20 Apr 2021 02:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233438AbhDTCOv (ORCPT ); Mon, 19 Apr 2021 22:14:51 -0400 Received: from mail-pj1-f50.google.com ([209.85.216.50]:36583 "EHLO mail-pj1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231693AbhDTCOp (ORCPT ); Mon, 19 Apr 2021 22:14:45 -0400 Received: by mail-pj1-f50.google.com with SMTP id f2-20020a17090a4a82b02900c67bf8dc69so21499219pjh.1 for ; Mon, 19 Apr 2021 19:14:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1anv0wQUuXOURRkQt1L0vphtgMt7lXBytSr/6odvRMk=; b=AsG9RAsKm4Q59BOFLscS0vvCgmmGEf5BVjmDxMvimVTGAhJqgsKTtUKsuRxYv7Bdc3 AQFLKIyG0T8x795idSgEh4Rkuq++4exZypROybgCv7/3E6at7cU++E7kMuq8En7rShCk nizc+KFFxRChorXkQ0e3rrs/dCvoa2zcAlxg8nysWrBulVbtnFIfgeg2uL+H5DEV2kou 8OKeyEw0Rf6E3sV1ZYpNmbYcI+ruOmih9tng5Ey+0V49CsLJxSloEX+eTDNhihaq8vAN J1PRfgxTBZqcq6uEWpU0lo98/oDEdxKLMfMxLDspOr7mw88kcDO8Fb2IWMDlyRZHWbuq dVhw== X-Gm-Message-State: AOAM531sJTek85b/jq6RbCCWf0JBkPt6k18lcd+hVXNknUx4SKsJk9Ic Aoa0v5PLMGvBePsacmk/hg8= X-Google-Smtp-Source: ABdhPJya13hFTTngzyLPij713mRoAL+zoIltX0yvB/T6MyDYrBf555NSI+y/nKEwFMVPr+FRxJLJtw== X-Received: by 2002:a17:90a:bd8c:: with SMTP id z12mr2313222pjr.83.1618884854237; Mon, 19 Apr 2021 19:14:14 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:13 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu Subject: [PATCH 095/117] storvsc: Convert to the scsi_status union Date: Mon, 19 Apr 2021 19:13:40 -0700 Message-Id: <20210420021402.27678-5-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Wei Liu Signed-off-by: Bart Van Assche Acked-by: Wei Liu --- drivers/scsi/storvsc_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index e6718a74e5da..69918c924825 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1096,9 +1096,9 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request, vm_srb = &cmd_request->vstor_packet.vm_srb; data_transfer_length = vm_srb->data_transfer_length; - scmnd->result = vm_srb->scsi_status; + scmnd->status.combined = vm_srb->scsi_status; - if (scmnd->result) { + if (scmnd->status.combined) { if (scsi_normalize_sense(scmnd->sense_buffer, SCSI_SENSE_BUFFERSIZE, &sense_hdr) && !(sense_hdr.sense_key == NOT_READY && @@ -1675,7 +1675,7 @@ static bool storvsc_scsi_cmd_ok(struct scsi_cmnd *scmnd) * this. So, don't send it. */ case SET_WINDOW: - scmnd->result = DID_ERROR << 16; + scmnd->status.combined = DID_ERROR << 16; allowed = false; break; default: From patchwork Tue Apr 20 02:13:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424908 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF49EC433ED for ; Tue, 20 Apr 2021 02:14:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACE8461107 for ; Tue, 20 Apr 2021 02:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233580AbhDTCOx (ORCPT ); Mon, 19 Apr 2021 22:14:53 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:38784 "EHLO mail-pf1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233354AbhDTCOr (ORCPT ); Mon, 19 Apr 2021 22:14:47 -0400 Received: by mail-pf1-f180.google.com with SMTP id g16so11190562pfq.5 for ; Mon, 19 Apr 2021 19:14:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fb1r8SYMSROeCi7Ay8yJ2wnRS/0/wthWehKMGFFGyLM=; b=cmXHkAZ1iubEQEsWVPQg5arJN7Fxw9JDVrsjuZOJOI5KwSYEYwmPB/+iJFfvUmPAjc iFAKXLZ2a0bSBqqp/fKb9uWCcdno2I1AE+mtle+b2t8Z4l6WRYe8kWjohuD3Tcn+hMJd FGHqoqVDFVF5pSOjJuV2F+IR6GJ/Prfd6DqR4Ze8tJ8c38zSJa/RaZ+sRYh7GEAld5Hb bF9ciRTE0jXLJzvih2u9vfbb84TgGtovvKBaIYd418x2q8IoHNUdvyFRv4OHEEldnraF KIFe3B6JHreaMB7MUgozJ/E/K9eRgnwuALKG9d3uF76YIoeCAC+DdVNzKAxUrQ0eOkaa GTMg== X-Gm-Message-State: AOAM532ZaSciPYHQTzx8C1AqzCZc603E36ebGRBgfmTYKzgz8nMAA1qC 8iw2FVSVTf+O9l/HGfL05gc= X-Google-Smtp-Source: ABdhPJyr8lrzvZC7vIS+eD7He5hTuS1dS4ewyEBdHg7EUCZtSaAYvuKDE629/gtSEe/DxQeK3Mq/7w== X-Received: by 2002:a62:2742:0:b029:222:b711:3324 with SMTP id n63-20020a6227420000b0290222b7113324mr22487949pfn.7.1618884856575; Mon, 19 Apr 2021 19:14:16 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:16 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Mike Christie Subject: [PATCH 097/117] target: Convert to the scsi_status union Date: Mon, 19 Apr 2021 19:13:42 -0700 Message-Id: <20210420021402.27678-7-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Mike Christie Signed-off-by: Bart Van Assche --- drivers/target/loopback/tcm_loop.c | 4 ++-- drivers/target/target_core_pscsi.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 66ea91c52175..2206495f908c 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -565,10 +565,10 @@ static int tcm_loop_queue_data_or_status(const char *func, memcpy(sc->sense_buffer, se_cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); - sc->result = SAM_STAT_CHECK_CONDITION; + sc->status.combined = SAM_STAT_CHECK_CONDITION; set_driver_byte(sc, DRIVER_SENSE); } else - sc->result = scsi_status; + sc->status.combined = scsi_status; set_host_byte(sc, DID_OK); if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index fd617bc4113e..5b562dbd4f11 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -1043,13 +1043,13 @@ static void pscsi_req_done(struct request *req, blk_status_t status) { struct se_cmd *cmd = req->end_io_data; struct pscsi_plugin_task *pt = cmd->priv; - int result = scsi_req(req)->result; + union scsi_status result = scsi_req(req)->status; enum sam_status scsi_status = status_byte(result) << 1; if (scsi_status != SAM_STAT_GOOD) { pr_debug("PSCSI Status Byte exception at cmd: %p CDB:" " 0x%02x Result: 0x%08x\n", cmd, pt->pscsi_cdb[0], - result); + result.combined); } pscsi_complete_cmd(cmd, scsi_status, scsi_req(req)->sense); @@ -1062,7 +1062,7 @@ static void pscsi_req_done(struct request *req, blk_status_t status) default: pr_debug("PSCSI Host Byte exception at cmd: %p CDB:" " 0x%02x Result: 0x%08x\n", cmd, pt->pscsi_cdb[0], - result); + result.combined); target_complete_cmd(cmd, SAM_STAT_CHECK_CONDITION); break; } From patchwork Tue Apr 20 02:13:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8EE9C43462 for ; Tue, 20 Apr 2021 02:14:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93736611EE for ; Tue, 20 Apr 2021 02:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233632AbhDTCOy (ORCPT ); Mon, 19 Apr 2021 22:14:54 -0400 Received: from mail-pj1-f50.google.com ([209.85.216.50]:33567 "EHLO mail-pj1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbhDTCOv (ORCPT ); Mon, 19 Apr 2021 22:14:51 -0400 Received: by mail-pj1-f50.google.com with SMTP id kb13-20020a17090ae7cdb02901503d67f0beso532239pjb.0 for ; Mon, 19 Apr 2021 19:14:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3aiYG+G6Ye8wEt9nZzloD+04WXy2NZuywmnXRKf8/Uc=; b=PJnUq3GTaGc07L8p/2XOq5OaCK4e80vLeKZNf/AHFtym4ukA16mhcRdKQCeZFQyb3c ETH1NkTOOBYrTJA2au2qWCmASJjtfnp2ADGDmmDNmKiU6QX6HKANRCzmsLq+jBoVVN1S e0zli5+AsJd5007p1sfUeuKo6JguAg5GOwoAwqVsyFVotMbsW2g2fenOaCdEbh14f4MZ MDFwo4zpGsLfZ0qVf51uYRUj9/gNUhaT619GpJHcZIEwFVpwpyBmFUyIHFPw6xZpOAkj xGMcReSkBNYbyx9xinHj2E8M2m13NzgUEL+f1/teVAjrqbqcNufI5hbPYV+HA5Rl40Aq bdNA== X-Gm-Message-State: AOAM531FV7FIFggdTQ0jJYppH2xAhDLFHePCOhr5QKO3psTEs+DkJHQ4 5Cg4i286SMJob6RseyuuaPE= X-Google-Smtp-Source: ABdhPJx9Fwpk/k7BsOVgViID4xrsXihcgquC1xtRaFXjXgp8uKXtphRxkORbUg3gWIw+j/rfp7UIRg== X-Received: by 2002:a17:90a:7e98:: with SMTP id j24mr2349697pjl.75.1618884860387; Mon, 19 Apr 2021 19:14:20 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:19 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Can Guo , Avri Altman , Bean Huo , Alim Akhtar , Asutosh Das Subject: [PATCH 100/117] ufs: Use enum sam_status where appropriate Date: Mon, 19 Apr 2021 19:13:45 -0700 Message-Id: <20210420021402.27678-10-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make it explicit that the second ufshcd_scsi_cmd_status() argument is a SAM status code. Cc: Can Guo Cc: Avri Altman Cc: Bean Huo Cc: Alim Akhtar Cc: Asutosh Das Signed-off-by: Bart Van Assche Reviewed-by: Can Guo Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 0c2c18f2acf3..391947e4db72 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4898,7 +4898,7 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev) * Returns value base on SCSI command status */ static inline int -ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, int scsi_status) +ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, enum sam_status scsi_status) { int result = 0; From patchwork Tue Apr 20 02:13:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29E53C433B4 for ; Tue, 20 Apr 2021 02:14:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9BE861107 for ; Tue, 20 Apr 2021 02:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233654AbhDTCO4 (ORCPT ); Mon, 19 Apr 2021 22:14:56 -0400 Received: from mail-pl1-f176.google.com ([209.85.214.176]:46705 "EHLO mail-pl1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233440AbhDTCOw (ORCPT ); Mon, 19 Apr 2021 22:14:52 -0400 Received: by mail-pl1-f176.google.com with SMTP id s20so2978671plr.13 for ; Mon, 19 Apr 2021 19:14:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xk1FpKs112NytXlibF664zMKsa9DTinPFfFXh+2BhGQ=; b=rFRH0SRoGp4ff3UNKIJo42c3wcGGK1cEP5w0ylHuWJH6SloZ7wXs3AZrWigkHKPHuC snEk0vlqcei8jIt8qC2GRrohJDpS/iH8oVL6z3zc8XgGfmBfU8lWbqJcX+zl7f6A7yCk WLy7x3IRzyo/xLgor/hoi3//hoeKvst1QuM8NQkDe8k+Wfe4nkCfIDSImcHv2LwxbT8o 1jExzR2sg/gCaekCU//kS+WfqcX//+QDxqwmfjB1KkKTsaenvB8pKysFUqsCWMMptOoI QS5kQ1iYlA5lhSwQgdXyR69O8LR4F58tttWu73k1Z/E/hVxZRuKaZA7ZErCfRf3VzJVU D+Tg== X-Gm-Message-State: AOAM533MBJoJrZ4s9qUS+ZipYcDP9r271YgfB9Edcl/LNUdqaI9DyXEh 4+3PJapVu9qQoUPNgJQ3K4g= X-Google-Smtp-Source: ABdhPJwnrDC3LcTnszxL5SSS4IBy8LIeJSFQ0P7BLs1eDy+7TPz3Y8QLWOxm43on9F4l+kfG9cUqMw== X-Received: by 2002:a17:90a:f303:: with SMTP id ca3mr2253557pjb.145.1618884861650; Mon, 19 Apr 2021 19:14:21 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:21 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Can Guo , Avri Altman , Bean Huo , Alim Akhtar , Asutosh Das Subject: [PATCH 101/117] ufs: Remove an assignment from ufshcd_transfer_rsp_status() Date: Mon, 19 Apr 2021 19:13:46 -0700 Message-Id: <20210420021402.27678-11-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since a later patch will change the type of the 'result' variable, use this variable only for one purpose. Cc: Can Guo Cc: Avri Altman Cc: Bean Huo Cc: Alim Akhtar Cc: Asutosh Das Signed-off-by: Bart Van Assche Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 391947e4db72..d966d80838fb 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4947,9 +4947,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) switch (ocs) { case OCS_SUCCESS: - result = ufshcd_get_req_rsp(lrbp->ucd_rsp_ptr); hba->ufs_stats.last_hibern8_exit_tstamp = ktime_set(0, 0); - switch (result) { + switch (ufshcd_get_req_rsp(lrbp->ucd_rsp_ptr)) { case UPIU_TRANSACTION_RESPONSE: /* Propagate the SCSI status to the SCSI midlayer. */ result = ufshcd_scsi_cmd_status(lrbp, From patchwork Tue Apr 20 02:13:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 361ABC43460 for ; Tue, 20 Apr 2021 02:14:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09DCC613AB for ; Tue, 20 Apr 2021 02:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233661AbhDTCO5 (ORCPT ); Mon, 19 Apr 2021 22:14:57 -0400 Received: from mail-pj1-f50.google.com ([209.85.216.50]:37543 "EHLO mail-pj1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233645AbhDTCOz (ORCPT ); Mon, 19 Apr 2021 22:14:55 -0400 Received: by mail-pj1-f50.google.com with SMTP id e8-20020a17090a7288b029014e51f5a6baso14473999pjg.2 for ; Mon, 19 Apr 2021 19:14:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nfApnvmw4OEwvll2zTfFPKz4sd3PVzwuvV6C8tfF2fA=; b=DE1q5ODy305bdZmkR1hRCQVzraVeI7FXjpN2f1TDgUOzz5lWwr9+7CZ1DfxRHpQNN4 ngW1NImcjgPjrvRQctrjSQR3usnU2VVFt/DLnxu10GPTBXh3CQTvLIzmdOJ9vBX2Zz8l lWJ/0el9OU3m3DeV2IDEZa4eDn4qReT4411CTiSrl2cyaaye8UJvQDQK/0s12V9Hv67N RhVWMtscdo1IYID6+vDC/GfjGv97sTI58OpZ/TaNT5+r9kWH4sKC1nGe4bf3+A8lymiQ VJYeS8TKXHLcITqWDeYJkKjpneGF7Ujiox05JWqeEir/FvB5m0jH7wKvdxRwSkAYCPzw RslA== X-Gm-Message-State: AOAM530si+Zv8HGPPlraXx0e83vVk5RHPlXrCpvtsyQtD3zd2Eqf95R+ 7HLONy38KU4SGGci6DxtRliV3k8tnDznTw== X-Google-Smtp-Source: ABdhPJwf9T9Afb3D+240nAU4vYgK4Uy20csBfvxp/tzCQjQ9WPAHrJ4lDklg+KqYUPvUVzWN749O6g== X-Received: by 2002:a17:902:ed52:b029:ec:824a:404a with SMTP id y18-20020a170902ed52b02900ec824a404amr18205527plb.73.1618884864141; Mon, 19 Apr 2021 19:14:24 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:23 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Alan Stern Subject: [PATCH 103/117] usb: Convert to the scsi_status union Date: Mon, 19 Apr 2021 19:13:48 -0700 Message-Id: <20210420021402.27678-13-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Alan Stern Signed-off-by: Bart Van Assche --- drivers/usb/image/microtek.c | 4 ++-- drivers/usb/storage/cypress_atacb.c | 12 +++++----- drivers/usb/storage/datafab.c | 4 ++-- drivers/usb/storage/isd200.c | 34 ++++++++++++++--------------- drivers/usb/storage/jumpshot.c | 4 ++-- drivers/usb/storage/realtek_cr.c | 10 ++++----- drivers/usb/storage/scsiglue.c | 4 ++-- drivers/usb/storage/transport.c | 30 ++++++++++++------------- drivers/usb/storage/uas.c | 8 +++---- drivers/usb/storage/usb.c | 14 ++++++------ 10 files changed, 62 insertions(+), 62 deletions(-) diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 59b02a539963..1e864ad1da8e 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -408,8 +408,8 @@ static void mts_transfer_done( struct urb *transfer ) { MTS_INT_INIT(); - context->srb->result &= MTS_SCSI_ERR_MASK; - context->srb->result |= (unsigned)(*context->scsi_status)<<1; + context->srb->status.combined &= MTS_SCSI_ERR_MASK; + context->srb->status.combined |= (unsigned)(*context->scsi_status)<<1; mts_transfer_cleanup(transfer); } diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c index a6f3267bbef6..1d0449443759 100644 --- a/drivers/usb/storage/cypress_atacb.c +++ b/drivers/usb/storage/cypress_atacb.c @@ -148,7 +148,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) usb_stor_transparent_scsi_command(srb, us); /* if the device doesn't support ATACB */ - if (srb->result == SAM_STAT_CHECK_CONDITION && + if (srb->status.combined == SAM_STAT_CHECK_CONDITION && memcmp(srb->sense_buffer, usb_stor_sense_invalidCDB, sizeof(usb_stor_sense_invalidCDB)) == 0) { usb_stor_dbg(us, "cypress atacb not supported ???\n"); @@ -159,8 +159,8 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) * if ck_cond flags is set, and there wasn't critical error, * build the special sense */ - if ((srb->result != (DID_ERROR << 16) && - srb->result != (DID_ABORT << 16)) && + if ((srb->status.combined != (DID_ERROR << 16) && + srb->status.combined != (DID_ABORT << 16)) && save_cmnd[2] & 0x20) { struct scsi_eh_save ses; unsigned char regs[8]; @@ -182,7 +182,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) usb_stor_transparent_scsi_command(srb, us); memcpy(regs, srb->sense_buffer, sizeof(regs)); - tmp_result = srb->result; + tmp_result = srb->status.combined; scsi_eh_restore_cmnd(srb, &ses); /* we fail to get registers, report invalid command */ if (tmp_result != SAM_STAT_GOOD) @@ -221,11 +221,11 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) desc[12] = regs[6]; /* device */ desc[13] = regs[7]; /* command */ - srb->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; + srb->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; } goto end; invalid_fld: - srb->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; + srb->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB, diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index 588818483f4b..fc3c0305cad3 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c @@ -702,10 +702,10 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) rc = datafab_id_device(us, info); if (rc == USB_STOR_TRANSPORT_GOOD) { info->sense_key = NO_SENSE; - srb->result = SUCCESS; + srb->status.combined = SUCCESS; } else { info->sense_key = UNIT_ATTENTION; - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; } return rc; } diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 3c76336e43bb..11b1ad6fa5f0 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c @@ -630,12 +630,12 @@ static void isd200_invoke_transport( struct us_data *us, case USB_STOR_TRANSPORT_GOOD: /* Indicate a good result */ - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; break; case USB_STOR_TRANSPORT_NO_SENSE: usb_stor_dbg(us, "-- transport indicates protocol failure\n"); - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; return; case USB_STOR_TRANSPORT_FAILED: @@ -645,13 +645,13 @@ static void isd200_invoke_transport( struct us_data *us, case USB_STOR_TRANSPORT_ERROR: usb_stor_dbg(us, "-- transport indicates transport error\n"); - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; /* Need reset here */ return; default: usb_stor_dbg(us, "-- transport indicates unknown error\n"); - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; /* Need reset here */ return; } @@ -674,13 +674,13 @@ static void isd200_invoke_transport( struct us_data *us, } if (result == ISD200_GOOD) { isd200_build_sense(us, srb); - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; /* If things are really okay, then let's show that */ if ((srb->sense_buffer[2] & 0xf) == 0x0) - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; } else { - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; /* Need reset here */ } } @@ -690,7 +690,7 @@ static void isd200_invoke_transport( struct us_data *us, * condition, show that in the result code */ if (transferStatus == USB_STOR_TRANSPORT_FAILED) - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; return; /* @@ -698,7 +698,7 @@ static void isd200_invoke_transport( struct us_data *us, * following an abort */ Handle_Abort: - srb->result = DID_ABORT << 16; + srb->status.combined = DID_ABORT << 16; /* permit the reset transfer to take place */ clear_bit(US_FLIDX_ABORTING, &us->dflags); @@ -1238,7 +1238,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, /* copy InquiryData */ usb_stor_set_xfer_buf((unsigned char *) &info->InquiryData, sizeof(info->InquiryData), srb); - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; sendToTransport = 0; break; @@ -1258,7 +1258,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, isd200_srb_set_bufflen(srb, 0); } else { usb_stor_dbg(us, " Media Status not supported, just report okay\n"); - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; sendToTransport = 0; } break; @@ -1276,7 +1276,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, isd200_srb_set_bufflen(srb, 0); } else { usb_stor_dbg(us, " Media Status not supported, just report okay\n"); - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; sendToTransport = 0; } break; @@ -1299,7 +1299,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, usb_stor_set_xfer_buf((unsigned char *) &readCapacityData, sizeof(readCapacityData), srb); - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; sendToTransport = 0; } break; @@ -1384,7 +1384,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, isd200_srb_set_bufflen(srb, 0); } else { usb_stor_dbg(us, " Not removable media, just report okay\n"); - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; sendToTransport = 0; } break; @@ -1410,7 +1410,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, isd200_srb_set_bufflen(srb, 0); } else { usb_stor_dbg(us, " Nothing to do, just report okay\n"); - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; sendToTransport = 0; } break; @@ -1418,7 +1418,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, default: usb_stor_dbg(us, "Unsupported SCSI command - 0x%X\n", srb->cmnd[0]); - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; sendToTransport = 0; break; } @@ -1519,7 +1519,7 @@ static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) if (us->extra == NULL) { usb_stor_dbg(us, "ERROR Driver not initialized\n"); - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; return; } diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 229bf0c1afc9..7f512aa09f1c 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c @@ -627,10 +627,10 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) rc = jumpshot_id_device(us, info); if (rc == USB_STOR_TRANSPORT_GOOD) { info->sense_key = NO_SENSE; - srb->result = SUCCESS; + srb->status.combined = SUCCESS; } else { info->sense_key = UNIT_ATTENTION; - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; } return rc; } diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 3789698d9d3c..4e6d8070b3d2 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c @@ -822,9 +822,9 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) if ((srb->cmnd[0] == TEST_UNIT_READY) && (chip->pwr_state == US_SUSPEND)) { if (TST_LUN_READY(chip, srb->device->lun)) { - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; } else { - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; memcpy(srb->sense_buffer, media_not_present, US_SENSE_SIZE); @@ -835,12 +835,12 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) { int prevent = srb->cmnd[4] & 0x1; if (prevent) { - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; memcpy(srb->sense_buffer, invalid_cmd_field, US_SENSE_SIZE); } else { - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; } usb_stor_dbg(us, "ALLOW_MEDIUM_REMOVAL\n"); goto out; @@ -850,7 +850,7 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) chip->proto_handler_backup(srb, us); /* Check whether card is plugged in */ if (srb->cmnd[0] == TEST_UNIT_READY) { - if (srb->result == SAM_STAT_GOOD) { + if (srb->status.combined == SAM_STAT_GOOD) { SET_LUN_READY(chip, srb->device->lun); if (card_first_show) { card_first_show = 0; diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index e5a971b83e3f..1e7be15c2604 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -378,7 +378,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb, /* fail the command if we are disconnecting */ if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { usb_stor_dbg(us, "Fail command during disconnect\n"); - srb->result = DID_NO_CONNECT << 16; + srb->status.combined = DID_NO_CONNECT << 16; done(srb); return 0; } @@ -387,7 +387,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb, (srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) { memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB, sizeof(usb_stor_sense_invalidCDB)); - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; done(srb); return 0; } diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 5eb895b19c55..eeab940db880 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -560,7 +560,7 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb) if (sector + 1 != sdkp->capacity) goto done; - if (srb->result == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) { + if (srb->status.combined == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) { /* * The command succeeded. We know this device doesn't @@ -580,7 +580,7 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb) */ if (++us->last_sector_retries < 3) return; - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; memcpy(srb->sense_buffer, record_not_found, sizeof(record_not_found)); } @@ -616,25 +616,25 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) */ if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { usb_stor_dbg(us, "-- command was aborted\n"); - srb->result = DID_ABORT << 16; + srb->status.combined = DID_ABORT << 16; goto Handle_Errors; } /* if there is a transport error, reset and don't auto-sense */ if (result == USB_STOR_TRANSPORT_ERROR) { usb_stor_dbg(us, "-- transport indicates error, resetting\n"); - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; goto Handle_Errors; } /* if the transport provided its own sense data, don't auto-sense */ if (result == USB_STOR_TRANSPORT_NO_SENSE) { - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; last_sector_hacks(us, srb); return; } - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; /* * Determine if we need to auto-sense @@ -727,7 +727,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { usb_stor_dbg(us, "-- auto-sense aborted\n"); - srb->result = DID_ABORT << 16; + srb->status.combined = DID_ABORT << 16; /* If SANE_SENSE caused this problem, disable it */ if (sense_size != US_SENSE_SIZE) { @@ -761,7 +761,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) * multi-target device, since failure of an * auto-sense is perfectly valid */ - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; if (!(us->fflags & US_FL_SCM_MULT_TARG)) goto Handle_Errors; return; @@ -802,7 +802,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) #endif /* set the result so the higher layers expect this data */ - srb->result = SAM_STAT_CHECK_CONDITION; + srb->status.combined = SAM_STAT_CHECK_CONDITION; scdd = scsi_sense_desc_find(srb->sense_buffer, SCSI_SENSE_BUFFERSIZE, 4); @@ -821,7 +821,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) * won't realize we did an unsolicited auto-sense. */ if (result == USB_STOR_TRANSPORT_GOOD) { - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; srb->sense_buffer[0] = 0x0; } @@ -842,7 +842,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) * entering an infinite retry loop. */ else { - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; if ((sshdr.response_code & 0x72) == 0x72) srb->sense_buffer[1] = HARDWARE_ERROR; else @@ -861,7 +861,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) */ if (unlikely((us->fflags & US_FL_INITIAL_READ10) && srb->cmnd[0] == READ_10)) { - if (srb->result == SAM_STAT_GOOD) { + if (srb->status.combined == SAM_STAT_GOOD) { set_bit(US_FLIDX_READ10_WORKED, &us->dflags); } else if (test_bit(US_FLIDX_READ10_WORKED, &us->dflags)) { clear_bit(US_FLIDX_READ10_WORKED, &us->dflags); @@ -875,15 +875,15 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) */ if (test_bit(US_FLIDX_REDO_READ10, &us->dflags)) { clear_bit(US_FLIDX_REDO_READ10, &us->dflags); - srb->result = DID_IMM_RETRY << 16; + srb->status.combined = DID_IMM_RETRY << 16; srb->sense_buffer[0] = 0; } } /* Did we transfer less than the minimum amount required? */ - if ((srb->result == SAM_STAT_GOOD || srb->sense_buffer[2] == 0) && + if ((srb->status.combined == SAM_STAT_GOOD || srb->sense_buffer[2] == 0) && scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow) - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; last_sector_hacks(us, srb); return; diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index bef89c6bd1d7..3e67c56fcfd8 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -167,7 +167,7 @@ static void uas_zap_pending(struct uas_dev_info *devinfo, int result) uas_log_cmd_state(cmnd, __func__, 0); /* Sense urbs were killed, clear COMMAND_INFLIGHT manually */ cmdinfo->state &= ~COMMAND_INFLIGHT; - cmnd->result = result << 16; + cmnd->status.combined = result << 16; err = uas_try_complete(cmnd, __func__); WARN_ON(err != 0); } @@ -194,7 +194,7 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd) memcpy(cmnd->sense_buffer, sense_iu->sense, len); } - cmnd->result = sense_iu->status; + cmnd->status.combined = sense_iu->status; } static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, @@ -339,7 +339,7 @@ static void uas_stat_cmplt(struct urb *urb) switch (iu->iu_id) { case IU_ID_STATUS: uas_sense(urb, cmnd); - if (cmnd->result != 0) { + if (cmnd->status.combined != 0) { /* cancel data transfers on error */ data_in_urb = usb_get_urb(cmdinfo->data_in_urb); data_out_urb = usb_get_urb(cmdinfo->data_out_urb); @@ -652,7 +652,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, (cmnd->cmnd[0] == ATA_12 || cmnd->cmnd[0] == ATA_16)) { memcpy(cmnd->sense_buffer, usb_stor_sense_invalidCDB, sizeof(usb_stor_sense_invalidCDB)); - cmnd->result = SAM_STAT_CHECK_CONDITION; + cmnd->status.combined = SAM_STAT_CHECK_CONDITION; cmnd->scsi_done(cmnd); return 0; } diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 90aa9c12ffac..88afbfa79f70 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -325,7 +325,7 @@ static int usb_stor_control_thread(void * __us) /* has the command timed out *already* ? */ if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { - srb->result = DID_ABORT << 16; + srb->status.combined = DID_ABORT << 16; goto SkipForAbort; } @@ -337,7 +337,7 @@ static int usb_stor_control_thread(void * __us) */ if (srb->sc_data_direction == DMA_BIDIRECTIONAL) { usb_stor_dbg(us, "UNKNOWN data direction\n"); - srb->result = DID_ERROR << 16; + srb->status.combined = DID_ERROR << 16; } /* @@ -349,14 +349,14 @@ static int usb_stor_control_thread(void * __us) usb_stor_dbg(us, "Bad target number (%d:%llu)\n", srb->device->id, srb->device->lun); - srb->result = DID_BAD_TARGET << 16; + srb->status.combined = DID_BAD_TARGET << 16; } else if (srb->device->lun > us->max_lun) { usb_stor_dbg(us, "Bad LUN (%d:%llu)\n", srb->device->id, srb->device->lun); - srb->result = DID_BAD_TARGET << 16; + srb->status.combined = DID_BAD_TARGET << 16; } /* @@ -371,7 +371,7 @@ static int usb_stor_control_thread(void * __us) usb_stor_dbg(us, "Faking INQUIRY command\n"); fill_inquiry_response(us, data_ptr, 36); - srb->result = SAM_STAT_GOOD; + srb->status.combined = SAM_STAT_GOOD; } /* we've got a command, let's do it! */ @@ -385,7 +385,7 @@ static int usb_stor_control_thread(void * __us) scsi_lock(host); /* was the command aborted? */ - if (srb->result == DID_ABORT << 16) { + if (srb->status.combined == DID_ABORT << 16) { SkipForAbort: usb_stor_dbg(us, "scsi command aborted\n"); srb = NULL; /* Don't call srb->scsi_done() */ @@ -416,7 +416,7 @@ static int usb_stor_control_thread(void * __us) /* now that the locks are released, notify the SCSI core */ if (srb) { usb_stor_dbg(us, "scsi cmd done, result=0x%x\n", - srb->result); + srb->status.combined); srb->scsi_done(srb); } } /* for (;;) */ From patchwork Tue Apr 20 02:13:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424904 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E420C433B4 for ; Tue, 20 Apr 2021 02:14:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3A8861107 for ; Tue, 20 Apr 2021 02:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233679AbhDTCPB (ORCPT ); Mon, 19 Apr 2021 22:15:01 -0400 Received: from mail-pj1-f44.google.com ([209.85.216.44]:34401 "EHLO mail-pj1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233635AbhDTCO5 (ORCPT ); Mon, 19 Apr 2021 22:14:57 -0400 Received: by mail-pj1-f44.google.com with SMTP id em21-20020a17090b0155b029014e204a81e6so509812pjb.1 for ; Mon, 19 Apr 2021 19:14:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=usuHqcxIWUx4j+Tz4TJvO8lNGPhlAbmAsEpFsh44+Hc=; b=KRrAkDtHVwY3C5Hv5/3U5RABWM38zvE3cusVpn2UXOvuSDVzh0aeakfqCDiNwhgKIF UEO9KRPgRqDY16fjKEC94+7KrEXmmbjr33Ddjy73nnvi/wOpQkFPUm8rAfRSoe2WKk9c miVoJMNbrZIGpqRfSX94ybob0Rx26qoh80UiVF2bZCMWVyLnu/R6ODTrNFgFVBBAZOQi qP4pNmuHZ5Bc80wGrByuxAK8DRpCGw1clTVZQGOqCCkozjnswjy9dXSSOECNWm81jR9k RcTCzlZyrRjipa0FcngbsgZqqxENODIFxRnkgh4PSZgnI/Kzr50RW68cS9cyrfArI/y1 4Y3A== X-Gm-Message-State: AOAM533JLu+1ctGd0WcKEsZelWgt6gFy7XbmW3Iu1RB+pX7ccE5TUP2q 1twt3nEy4dmctapRcM5QCZz9NgTiKqtLwA== X-Google-Smtp-Source: ABdhPJxUY5GWGKF8ukuUf4Al5nmaHhHzpUebZ3ZbAHPJRFEolmuqoXtwK+kEfkrroLHcmShYVregOg== X-Received: by 2002:a17:90b:f87:: with SMTP id ft7mr2297690pjb.11.1618884866561; Mon, 19 Apr 2021 19:14:26 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:25 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Vishal Bhakta , VMware PV-Drivers Subject: [PATCH 105/117] vmw_pvscsi: Convert to the scsi_status union Date: Mon, 19 Apr 2021 19:13:50 -0700 Message-Id: <20210420021402.27678-15-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Vishal Bhakta Cc: VMware PV-Drivers Signed-off-by: Bart Van Assche --- drivers/scsi/vmw_pvscsi.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 8a79605d9652..36473ba06990 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -567,18 +567,18 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, return; } - cmd->result = 0; + cmd->status.combined = 0; if (sdstat != SAM_STAT_GOOD && (btstat == BTSTAT_SUCCESS || btstat == BTSTAT_LINKED_COMMAND_COMPLETED || btstat == BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG)) { if (sdstat == SAM_STAT_COMMAND_TERMINATED) { - cmd->result = (DID_RESET << 16); + cmd->status.combined = (DID_RESET << 16); } else { - cmd->result = (DID_OK << 16) | sdstat; + cmd->status.combined = (DID_OK << 16) | sdstat; if (sdstat == SAM_STAT_CHECK_CONDITION && cmd->sense_buffer) - cmd->result |= (DRIVER_SENSE << 24); + cmd->status.combined |= (DRIVER_SENSE << 24); } } else switch (btstat) { @@ -586,25 +586,25 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, case BTSTAT_LINKED_COMMAND_COMPLETED: case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG: /* If everything went fine, let's move on.. */ - cmd->result = (DID_OK << 16); + cmd->status.combined = (DID_OK << 16); break; case BTSTAT_DATARUN: case BTSTAT_DATA_UNDERRUN: /* Report residual data in underruns */ scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); - cmd->result = (DID_ERROR << 16); + cmd->status.combined = (DID_ERROR << 16); break; case BTSTAT_SELTIMEO: /* Our emulation returns this for non-connected devs */ - cmd->result = (DID_BAD_TARGET << 16); + cmd->status.combined = (DID_BAD_TARGET << 16); break; case BTSTAT_LUNMISMATCH: case BTSTAT_TAGREJECT: case BTSTAT_BADMSG: - cmd->result = (DRIVER_INVALID << 24); + cmd->status.combined = (DRIVER_INVALID << 24); fallthrough; case BTSTAT_HAHARDWARE: @@ -615,25 +615,25 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, case BTSTAT_HASOFTWARE: case BTSTAT_BUSFREE: case BTSTAT_SENSFAILED: - cmd->result |= (DID_ERROR << 16); + cmd->status.combined |= (DID_ERROR << 16); break; case BTSTAT_SENTRST: case BTSTAT_RECVRST: case BTSTAT_BUSRESET: - cmd->result = (DID_RESET << 16); + cmd->status.combined = (DID_RESET << 16); break; case BTSTAT_ABORTQUEUE: - cmd->result = (DID_BUS_BUSY << 16); + cmd->status.combined = (DID_BUS_BUSY << 16); break; case BTSTAT_SCSIPARITY: - cmd->result = (DID_PARITY << 16); + cmd->status.combined = (DID_PARITY << 16); break; default: - cmd->result = (DID_ERROR << 16); + cmd->status.combined = (DID_ERROR << 16); scmd_printk(KERN_DEBUG, cmd, "Unknown completion status: 0x%x\n", btstat); @@ -641,7 +641,7 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, dev_dbg(&cmd->device->sdev_gendev, "cmd=%p %x ctx=%p result=0x%x status=0x%x,%x\n", - cmd, cmd->cmnd[0], ctx, cmd->result, btstat, sdstat); + cmd, cmd->cmnd[0], ctx, cmd->status.combined, btstat, sdstat); cmd->scsi_done(cmd); } @@ -859,7 +859,7 @@ static int pvscsi_abort(struct scsi_cmnd *cmd) /* * Successfully aborted the command. */ - cmd->result = (DID_ABORT << 16); + cmd->status.combined = (DID_ABORT << 16); cmd->scsi_done(cmd); out: @@ -886,7 +886,7 @@ static void pvscsi_reset_all(struct pvscsi_adapter *adapter) pvscsi_unmap_buffers(adapter, ctx); pvscsi_patch_sense(cmd); pvscsi_release_context(adapter, ctx); - cmd->result = (DID_RESET << 16); + cmd->status.combined = (DID_RESET << 16); cmd->scsi_done(cmd); } } From patchwork Tue Apr 20 02:13:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C85B1C43460 for ; Tue, 20 Apr 2021 02:14:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A07FE61107 for ; Tue, 20 Apr 2021 02:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233725AbhDTCPD (ORCPT ); Mon, 19 Apr 2021 22:15:03 -0400 Received: from mail-pf1-f170.google.com ([209.85.210.170]:46037 "EHLO mail-pf1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233669AbhDTCO7 (ORCPT ); Mon, 19 Apr 2021 22:14:59 -0400 Received: by mail-pf1-f170.google.com with SMTP id i190so24479200pfc.12 for ; Mon, 19 Apr 2021 19:14:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MZMCTmbSIZIUshLCt1pBIvfJPFAJSVXQEPvbH8WqsNI=; b=h0PGxjWB89iEOzb30wuPb2nAjBCzSt3C+3EO6mV0MkL4NQcnK87TCdJid2s5sW0ICu RFsxiw7Iu5W0m8HJ9zrfiIP6Qys2RLK5LF9lyk7arDXXH8P17kRxH2P8pxQZQygLr1k2 JHeDqtAd2W7CU9A45t7YHGnmTy7jOweIJDoxfteaTQgInA13epSVe5fOT1wuV1SU2/CO RQG4Zt1Bcai+eae4uPVyVdt5iJUYkhMGc+vCe+T5Z+TQC+IL+XFWV6DarfoAW9XmywF4 MkdRccen5R9b3mEGvehHCm62KG4ff+J9Tx28w1J6ou+aXyQODXP8d+Vh7zKiNEXSXfLj V8oQ== X-Gm-Message-State: AOAM531ycVqsjp1p0NO4N01uIrS4/p/kfs3ezJCHosTetNgAyZx8buwM Cmy6lhRrRuLn4hqzqkf+D0A= X-Google-Smtp-Source: ABdhPJyhyxzssNqt3ZrW/pMRJUUnFZLe+uZ1Iqwv0hO22eqjrT13qFbDAHKreGUaa5vHkfeUyw31lw== X-Received: by 2002:a63:3757:: with SMTP id g23mr14617542pgn.422.1618884868858; Mon, 19 Apr 2021 19:14:28 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:28 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Ondrej Zary Subject: [PATCH 107/117] wd719x: Convert to the scsi_status union Date: Mon, 19 Apr 2021 19:13:52 -0700 Message-Id: <20210420021402.27678-17-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Ondrej Zary Signed-off-by: Bart Van Assche --- drivers/scsi/wd719x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c index edc8a139a60d..6861352dddd3 100644 --- a/drivers/scsi/wd719x.c +++ b/drivers/scsi/wd719x.c @@ -199,7 +199,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result) dma_unmap_single(&wd->pdev->dev, cmd->SCp.dma_handle, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); - cmd->result = result << 16; + cmd->status.combined = result << 16; cmd->scsi_done(cmd); } @@ -294,7 +294,7 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) dma_unmap_single(&wd->pdev->dev, scb->phys, sizeof(*scb), DMA_BIDIRECTIONAL); out_error: - cmd->result = DID_ERROR << 16; + cmd->status.combined = DID_ERROR << 16; cmd->scsi_done(cmd); return 0; } From patchwork Tue Apr 20 02:13:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F6C7C433B4 for ; Tue, 20 Apr 2021 02:14:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1038061107 for ; Tue, 20 Apr 2021 02:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233729AbhDTCPD (ORCPT ); Mon, 19 Apr 2021 22:15:03 -0400 Received: from mail-pf1-f176.google.com ([209.85.210.176]:43666 "EHLO mail-pf1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233653AbhDTCPA (ORCPT ); Mon, 19 Apr 2021 22:15:00 -0400 Received: by mail-pf1-f176.google.com with SMTP id p67so19540278pfp.10 for ; Mon, 19 Apr 2021 19:14:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E8eY+3b1e1VB8Xgf2jPBHrqijd11LuHKYiSCjB5BH8Q=; b=GBwu/2qyYFI1i22o7pIWHu5JKFT5znEKPk+S5lHdGRnws509vMCfqBWAgI8CnaTZpm 5+38Je+A9M9GqCdySOQhafQAk+3ipTWbMeUyaIeSIqO4qGJ/SvO270GIuhkR0ghqchdQ DMdbbaRnrml1VeU+8Rivp3FqbnjuxHNLK+ohrZLIgrppzL+dewbDScDulnRujmRSONHL FxuN1noQRYs8wTC8/gRkq15BgPQvI1RRBLHc18dNFvBz86obP5EduhvES3+PTeDO0Wec HloOhHcl3H58LpKzJMMHB9JKteA2YG/n/+1KaE18zfh9NDAtAUFf5jseabwqlo2+2Ncu FleQ== X-Gm-Message-State: AOAM532//r8NT4yO02kIaDdJy7QPR3UldVEf8sOiWDQq+AKYTSVoCgiv sLg60X1vDX3kS29KRA8LyC4= X-Google-Smtp-Source: ABdhPJy04JLKc8lhi72vGOQO+quk7anQgV0+KK0ruBSqR+miMYrpnG4GZChsc0I8LDzKyTtGiM0UBA== X-Received: by 2002:a62:e40a:0:b029:263:e573:e1c9 with SMTP id r10-20020a62e40a0000b0290263e573e1c9mr616214pfh.74.1618884870189; Mon, 19 Apr 2021 19:14:30 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:29 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Juergen Gross Subject: [PATCH 108/117] xen-scsiback: Pass union status to the {status, msg, host, driver}_byte() macros Date: Mon, 19 Apr 2021 19:13:53 -0700 Message-Id: <20210420021402.27678-18-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org An explanation of the purpose of this patch is available in the patch "scsi: Introduce the scsi_status union". Cc: Juergen Gross Signed-off-by: Bart Van Assche --- drivers/xen/xen-scsiback.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 55a4763da05e..835bb6d6a895 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -217,7 +217,7 @@ static unsigned long vaddr(struct vscsibk_pend *req, int seg) return vaddr_page(req->pages[seg]); } -static void scsiback_print_status(char *sense_buffer, int errors, +static void scsiback_print_status(char *sense_buffer, union scsi_status errors, struct vscsibk_pend *pending_req) { struct scsiback_tpg *tpg = pending_req->v2p->tpg; @@ -336,17 +336,18 @@ static void scsiback_cmd_done(struct vscsibk_pend *pending_req) struct vscsibk_info *info = pending_req->info; unsigned char *sense_buffer; unsigned int resid; - int errors; + union scsi_status errors; sense_buffer = pending_req->sense_buffer; resid = pending_req->se_cmd.residual_count; - errors = pending_req->result; + errors.combined = pending_req->result; - if (errors && log_print_stat) + if (errors.combined && log_print_stat) scsiback_print_status(sense_buffer, errors, pending_req); scsiback_fast_flush_area(pending_req); - scsiback_do_resp_with_sense(sense_buffer, errors, resid, pending_req); + scsiback_do_resp_with_sense(sense_buffer, errors.combined, resid, + pending_req); scsiback_put(info); /* * Drop the extra KREF_ACK reference taken by target_submit_cmd_map_sgls() From patchwork Tue Apr 20 02:13:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D5A8C433B4 for ; Tue, 20 Apr 2021 02:14:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01CDB613AB for ; Tue, 20 Apr 2021 02:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233739AbhDTCPG (ORCPT ); Mon, 19 Apr 2021 22:15:06 -0400 Received: from mail-pf1-f170.google.com ([209.85.210.170]:37629 "EHLO mail-pf1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233736AbhDTCPE (ORCPT ); Mon, 19 Apr 2021 22:15:04 -0400 Received: by mail-pf1-f170.google.com with SMTP id y62so663265pfg.4 for ; Mon, 19 Apr 2021 19:14:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HDYlRIC13bmilV/Nq0di6clRroRJ3dRpRLq+wT9d2zs=; b=F56ZG9EuPlLOGoRKiHTgGfYN47p4qACYm//14hZghvHzIORm0oDx0Z00J4zGHQjKqo 6nHrmLmppd/Bo9s3jmL9rnUY6oqDwnFrXRf6F8WL4p7RjwhLYklpGpiWjp5axom+ZdVe DiVKMcvbJ82RM4kgLc6UkLVLFkLBRcY8z+P2xMD4EkY/g7ktFOYCR9LJGe/K6LFug0xY CH1qkpboGtSYW5aiwNnthlnSgfaf9YxP8P25ec4uzjcW7LPK1fGWVS/rtCfRjbdPAuIo BDCOSoBbMWwvNOl+syj3C2lRKE5qi2G7Rb16huDvyefmOOzil0hB7A7WDPWmzGAMkece 5Uqg== X-Gm-Message-State: AOAM530O4PwjFgMTcZZLp6rPGdN01HDEcee2XOSGSHwIKFE6kyb52LUl u3teO36xv/995+9vwuHMzhE= X-Google-Smtp-Source: ABdhPJxrwYM0TQbyAL5VIk2GJy8FdgJN5+u1cSQL+MmLgiB4d48pFoY76KiQA9hlF0ZJfaqr+W2trg== X-Received: by 2002:aa7:95aa:0:b029:256:143:e5d8 with SMTP id a10-20020aa795aa0000b02902560143e5d8mr22167049pfk.67.1618884873886; Mon, 19 Apr 2021 19:14:33 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:33 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Ming Lei , Hannes Reinecke , John Garry Subject: [PATCH 111/117] Use the scsi_status union more widely Date: Mon, 19 Apr 2021 19:13:56 -0700 Message-Id: <20210420021402.27678-21-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Change the type of the SCSI status argument of the following functions from int into union scsi_status: * scsi_status_is_good(); * status_byte(); * msg_byte(); * host_byte(); * driver_byte(); * scsi_hostbyte_string(); * scsi_driverbyte_string(). Make all callers of these functions pass a union scsi_result as argument. Remove the scsi_status_to_int() macro. Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: John Garry Signed-off-by: Bart Van Assche --- drivers/scsi/constants.c | 8 ++++---- drivers/scsi/scsi_logging.c | 4 ++-- drivers/scsi/sd.c | 4 ++-- include/scsi/scsi.h | 28 +++++++--------------------- include/scsi/scsi_dbg.h | 10 ++++++---- 5 files changed, 21 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 84d73f57292b..0ea510b4ca52 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -410,10 +410,10 @@ static const char * const driverbyte_table[]={ "DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", "DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; -const char *scsi_hostbyte_string(int result) +const char *scsi_hostbyte_string(union scsi_status result) { const char *hb_string = NULL; - int hb = host_byte(result); + enum host_status hb = host_byte(result); if (hb < ARRAY_SIZE(hostbyte_table)) hb_string = hostbyte_table[hb]; @@ -421,10 +421,10 @@ const char *scsi_hostbyte_string(int result) } EXPORT_SYMBOL(scsi_hostbyte_string); -const char *scsi_driverbyte_string(int result) +const char *scsi_driverbyte_string(union scsi_status result) { const char *db_string = NULL; - int db = driver_byte(result); + enum driver_status db = driver_byte(result); if (db < ARRAY_SIZE(driverbyte_table)) db_string = driverbyte_table[db]; diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c index 5c994ba1fad8..3cba3ff97559 100644 --- a/drivers/scsi/scsi_logging.c +++ b/drivers/scsi/scsi_logging.c @@ -384,8 +384,8 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg, char *logbuf; size_t off, logbuf_len; const char *mlret_string = scsi_mlreturn_string(disposition); - const char *hb_string = scsi_hostbyte_string(cmd->status.combined); - const char *db_string = scsi_driverbyte_string(cmd->status.combined); + const char *hb_string = scsi_hostbyte_string(cmd->status); + const char *db_string = scsi_driverbyte_string(cmd->status); unsigned long cmd_age = (jiffies - cmd->jiffies_at_alloc) / HZ; logbuf = scsi_log_reserve_buffer(&logbuf_len); diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8df2f25e4129..756fe99794a7 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3812,8 +3812,8 @@ void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) void sd_print_result(const struct scsi_disk *sdkp, const char *msg, union scsi_status result) { - const char *hb_string = scsi_hostbyte_string(result.combined); - const char *db_string = scsi_driverbyte_string(result.combined); + const char *hb_string = scsi_hostbyte_string(result); + const char *db_string = scsi_driverbyte_string(result); if (hb_string || db_string) sd_printk(KERN_INFO, sdkp, diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 18bb1fb2458f..03f047333e52 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -33,20 +33,20 @@ enum scsi_timeouts { /** scsi_status_is_good - check the status return. * - * @status: the status passed up from the driver (including host and + * @scsi_status: the status passed up from the driver (including host and * driver components) * * This returns true for known good conditions that may be treated as * command completed normally */ -static inline bool __scsi_status_is_good(int status) +static inline bool scsi_status_is_good(union scsi_status scsi_status) { /* * FIXME: bit0 is listed as reserved in SCSI-2, but is * significant in SCSI-3. For now, we follow the SCSI-2 * behaviour and ignore reserved bits. */ - status &= 0xfe; + const u8 status = scsi_status.combined & 0xfe; return ((status == SAM_STAT_GOOD) || (status == SAM_STAT_CONDITION_MET) || /* Next two "intermediate" statuses are obsolete in SAM-4 */ @@ -56,20 +56,6 @@ static inline bool __scsi_status_is_good(int status) (status == SAM_STAT_COMMAND_TERMINATED)); } -/* - * If the 'status' argument has type int, unsigned int or union scsi_status, - * return the combined SCSI status. If the 'status' argument has another type, - * trigger a compiler error by passing a struct to a context where an integer - * is expected. - */ -#define scsi_status_to_int(status) \ - __builtin_choose_expr(sizeof(status) == 4, \ - *(int32_t *)&(status), \ - (union scsi_status){}) - -#define scsi_status_is_good(status) \ - __scsi_status_is_good(scsi_status_to_int(status)) - /* * standard mode-select header prepended to all mode-select commands @@ -148,10 +134,10 @@ enum scsi_disposition { * driver_byte = set by mid-level. */ #define status_byte(result) ((enum sam_status_divided_by_two) \ - ((scsi_status_to_int((result)) >> 1) & 0x7f)) -#define msg_byte(result) ((scsi_status_to_int((result)) >> 8) & 0xff) -#define host_byte(result) ((scsi_status_to_int((result)) >> 16) & 0xff) -#define driver_byte(result) ((scsi_status_to_int((result)) >> 24) & 0xff) + ((result).b.status >> 1)) +#define msg_byte(result) ((result).b.msg) +#define host_byte(result) ((result).b.host) +#define driver_byte(result) ((result).b.driver) #define sense_class(sense) (((sense) >> 4) & 0x7) #define sense_error(sense) ((sense) & 0xf) diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index 7b196d234626..d3a868b6dd89 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h @@ -2,6 +2,8 @@ #ifndef _SCSI_SCSI_DBG_H #define _SCSI_SCSI_DBG_H +#include + struct scsi_cmnd; struct scsi_device; struct scsi_sense_hdr; @@ -23,8 +25,8 @@ extern const char *scsi_sense_key_string(unsigned char); extern const char *scsi_extd_sense_format(unsigned char, unsigned char, const char **); extern const char *scsi_mlreturn_string(int); -extern const char *scsi_hostbyte_string(int); -extern const char *scsi_driverbyte_string(int); +extern const char *scsi_hostbyte_string(union scsi_status result); +extern const char *scsi_driverbyte_string(union scsi_status result); #else static inline bool scsi_opcode_sa_name(int cmd, int sa, @@ -71,13 +73,13 @@ scsi_mlreturn_string(int result) } static inline const char * -scsi_hostbyte_string(int result) +scsi_hostbyte_string(union scsi_status result) { return NULL; } static inline const char * -scsi_driverbyte_string(int result) +scsi_driverbyte_string(union scsi_status result) { return NULL; } From patchwork Tue Apr 20 02:13:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424900 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EF67C433B4 for ; Tue, 20 Apr 2021 02:14:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2008D61107 for ; Tue, 20 Apr 2021 02:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233780AbhDTCPJ (ORCPT ); Mon, 19 Apr 2021 22:15:09 -0400 Received: from mail-pf1-f181.google.com ([209.85.210.181]:41512 "EHLO mail-pf1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233742AbhDTCPH (ORCPT ); Mon, 19 Apr 2021 22:15:07 -0400 Received: by mail-pf1-f181.google.com with SMTP id w6so9947408pfc.8 for ; Mon, 19 Apr 2021 19:14:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bwHCFpLsVX8rqHH5vL11TcWELe35KuYUJmSlE/XLmrE=; b=IpWqOFPRKg0XPytaWIDvliXnxbWk/i8A1Sj/HCn5ybSM13YUY+DpazbtUn0e4ow6QY /SXt2aVCii+3mh8BGCaq9PJfPwg48R13v7111+V7tEfihRVmz0cO0J6XA6ct3sUBjbn6 82rMxIqlhlonb35Z0PDoOrMmq/BZhPMsr1EqWg23uSwWdLzChu4rKT3rRPfU+B4fMepP UfwJ0XymGjhh+rvFnXHGR/7Gc1bb+KSExOKAD7wpzhFjf7viXVPKNiAlOFo4aqPmu+Hi UKpaxPC1OXK0idVjKYGTWu1t/KbXWtcj7i1PmFQjrBSx1RfoQS3ppnqN4nLFS+xjKaM5 dy2w== X-Gm-Message-State: AOAM531BIPHh2Gg06qjE0sJ35oG2dmT+ytfny9zWeEyXvw/NTzu7hPZW Q7WLUrHbW8pZbjWUgIc1uiY= X-Google-Smtp-Source: ABdhPJzJ9Ktv1v2OaBYM/Tylnj+lSn2Nidts3P4EjNHqXT37pwO1lRe3NCuyr2szkaoh8jtAhHCNtQ== X-Received: by 2002:a63:db47:: with SMTP id x7mr5468251pgi.360.1618884876359; Mon, 19 Apr 2021 19:14:36 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:35 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Ming Lei , Hannes Reinecke , John Garry Subject: [PATCH 113/117] Change the return type of scsi_execute_req() into union scsi_status Date: Mon, 19 Apr 2021 19:13:58 -0700 Message-Id: <20210420021402.27678-23-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make it explicit that scsi_execute_req() returns a SCSI status. Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: John Garry Signed-off-by: Bart Van Assche --- drivers/hwmon/drivetemp.c | 2 +- drivers/scsi/ch.c | 2 +- drivers/scsi/scsi.c | 8 ++++---- drivers/scsi/scsi_ioctl.c | 2 +- drivers/scsi/scsi_lib.c | 8 ++++---- drivers/scsi/scsi_scan.c | 13 ++++++------- drivers/scsi/sd.c | 9 ++++----- drivers/scsi/sd_zbc.c | 2 +- drivers/scsi/ses.c | 4 ++-- drivers/scsi/sr.c | 6 +++--- drivers/scsi/virtio_scsi.c | 4 ++-- drivers/target/target_core_pscsi.c | 6 +++--- include/scsi/scsi_device.h | 4 ++-- 13 files changed, 34 insertions(+), 36 deletions(-) diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c index 1eb37106a220..a1affc2b5e0a 100644 --- a/drivers/hwmon/drivetemp.c +++ b/drivers/hwmon/drivetemp.c @@ -194,7 +194,7 @@ static int drivetemp_scsi_command(struct drivetemp_data *st, return scsi_execute_req(st->sdev, scsi_cmd, data_dir, st->smartdata, ATA_SECT_SIZE, NULL, HZ, 5, - NULL); + NULL).combined; } static int drivetemp_ata_command(struct drivetemp_data *st, u8 feature, diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 663af5ed20de..0944ceefa287 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -196,7 +196,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, retry: errno = 0; - result.combined = scsi_execute_req(ch->device, cmd, direction, buffer, + result = scsi_execute_req(ch->device, cmd, direction, buffer, buflength, &sshdr, timeout * HZ, MAX_RETRIES, NULL); diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index c6f3bbec8982..92f16d937882 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -308,7 +308,7 @@ EXPORT_SYMBOL(scsi_track_queue_full); static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer, u8 page, unsigned len) { - int result; + union scsi_status result; unsigned char cmd[16]; if (len < 4) @@ -327,7 +327,7 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer, */ result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, NULL, 30 * HZ, 3, NULL); - if (result) + if (result.combined) return -EIO; /* Sanity check that we got the page back that we asked for */ @@ -492,7 +492,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, { unsigned char cmd[16]; struct scsi_sense_hdr sshdr; - int result; + union scsi_status result; if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3) return -EINVAL; @@ -508,7 +508,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, &sshdr, 30 * HZ, 3, NULL); - if (result && scsi_sense_valid(&sshdr) && + if (result.combined && scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST && (sshdr.asc == 0x20 || sshdr.asc == 0x24) && sshdr.ascq == 0x00) return -EINVAL; diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index fee0e72917b3..b9e2f5b03c83 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -95,7 +95,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, SCSI_LOG_IOCTL(1, sdev_printk(KERN_INFO, sdev, "Trying ioctl with scsi command %d\n", *cmd)); - result.combined = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, + result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, &sshdr, timeout, retries, NULL); SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev, diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 485cb002cbc9..23750d167c47 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2121,7 +2121,7 @@ scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int modepage, } ret = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, real_buffer, len, - sshdr, timeout, retries, NULL); + sshdr, timeout, retries, NULL).combined; kfree(real_buffer); return ret; } @@ -2188,7 +2188,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, memset(buffer, 0, len); - result.combined = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, + result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, sshdr, timeout, retries, NULL); /* This code looks awful: what it's doing is making sure an @@ -2262,7 +2262,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, char cmd[] = { TEST_UNIT_READY, 0, 0, 0, 0, 0, }; - int result; + union scsi_status result; /* try to eat the UNIT_ATTENTION if there are enough retries */ do { @@ -2274,7 +2274,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, } while (scsi_sense_valid(sshdr) && sshdr->sense_key == UNIT_ATTENTION && --retries); - return result; + return result.combined; } EXPORT_SYMBOL(scsi_test_unit_ready); diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 43346f7dedd1..26c5066ecac5 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -608,8 +608,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, memset(inq_result, 0, try_inquiry_len); - result.combined = - scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, + result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, inq_result, try_inquiry_len, &sshdr, HZ / 2 + HZ * scsi_inq_timeout, 3, &resid); @@ -1315,7 +1314,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag u64 lun; unsigned int num_luns; unsigned int retries; - int result; + union scsi_status result; struct scsi_lun *lunp, *lun_data; struct scsi_sense_hdr sshdr; struct scsi_device *sdev; @@ -1402,9 +1401,9 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, "scsi scan: REPORT LUNS" " %s (try %d) result 0x%x\n", - result ? "failed" : "successful", - retries, result)); - if (result == 0) + result.combined ? "failed" : "successful", + retries, result.combined)); + if (result.combined == 0) break; else if (scsi_sense_valid(&sshdr)) { if (sshdr.sense_key != UNIT_ATTENTION) @@ -1412,7 +1411,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag } } - if (result) { + if (result.combined) { /* * The device probably does not support a REPORT LUN command */ diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 263a0e253f60..1df895e0e619 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1824,8 +1824,7 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, put_unaligned_be64(sa_key, &data[8]); data[20] = flags; - result.combined = - scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, &data, sizeof(data), + result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, &data, sizeof(data), &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL); if (driver_byte(result) == DRIVER_SENSE && @@ -2160,7 +2159,7 @@ sd_spinup_disk(struct scsi_disk *sdkp) cmd[0] = TEST_UNIT_READY; memset((void *) &cmd[1], 0, 9); - the_result.combined = scsi_execute_req(sdkp->device, cmd, + the_result = scsi_execute_req(sdkp->device, cmd, DMA_NONE, NULL, 0, &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL); @@ -2359,7 +2358,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, cmd[13] = RC16_LEN; memset(buffer, 0, RC16_LEN); - the_result.combined = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, + the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buffer, RC16_LEN, &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL); @@ -2444,7 +2443,7 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, memset(&cmd[1], 0, 9); memset(buffer, 0, 8); - the_result.combined = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, + the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buffer, 8, &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL); diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index dc63bce96ec5..8a9fe228aea9 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -109,7 +109,7 @@ static int sd_zbc_do_report_zones(struct scsi_disk *sdkp, unsigned char *buf, if (partial) cmd[14] = ZBC_REPORT_ZONE_PARTIAL; - result.combined = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, + result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buf, buflen, &sshdr, timeout, SD_MAX_RETRIES, NULL); if (result.combined) { diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index c2afba2a5414..69a0507b1f0a 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -89,7 +89,7 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, unsigned char recv_page_code; ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, - NULL, SES_TIMEOUT, SES_RETRIES, NULL); + NULL, SES_TIMEOUT, SES_RETRIES, NULL).combined; if (unlikely(ret)) return ret; @@ -123,7 +123,7 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, }; result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, - NULL, SES_TIMEOUT, SES_RETRIES, NULL); + NULL, SES_TIMEOUT, SES_RETRIES, NULL).combined; if (result) sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", result); diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index a78e499d4836..d745ff8a30e8 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -206,7 +206,7 @@ static unsigned int sr_get_events(struct scsi_device *sdev) int result; result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, sizeof(buf), - &sshdr, SR_TIMEOUT, MAX_RETRIES, NULL); + &sshdr, SR_TIMEOUT, MAX_RETRIES, NULL).combined; if (scsi_sense_valid(&sshdr) && sshdr.sense_key == UNIT_ATTENTION) return DISK_EVENT_MEDIA_CHANGE; @@ -813,8 +813,8 @@ static void get_sectorsize(struct scsi_cd *cd) /* Do the command and wait.. */ the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE, - buffer, sizeof(buffer), NULL, - SR_TIMEOUT, MAX_RETRIES, NULL); + buffer, sizeof(buffer), NULL, + SR_TIMEOUT, MAX_RETRIES, NULL).combined; retries--; diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index bc937cc74f20..fc288787d5d6 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -351,8 +351,8 @@ static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi) result.combined = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, - inq_result, inquiry_len, NULL, - SD_TIMEOUT, SD_MAX_RETRIES, NULL); + inq_result, inquiry_len, NULL, + SD_TIMEOUT, SD_MAX_RETRIES, NULL).combined; if (result.combined == 0 && inq_result[0] >> 5) { /* PQ indicates the LUN is not attached */ diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 5b562dbd4f11..fd9bb57fd337 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -146,7 +146,7 @@ static void pscsi_tape_read_blocksize(struct se_device *dev, cdb[4] = 0x0c; /* 12 bytes */ ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, 12, NULL, - HZ, 1, NULL); + HZ, 1, NULL).combined; if (ret) goto out_free; @@ -197,7 +197,7 @@ pscsi_get_inquiry_vpd_serial(struct scsi_device *sdev, struct t10_wwn *wwn) put_unaligned_be16(INQUIRY_VPD_SERIAL_LEN, &cdb[3]); ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, - INQUIRY_VPD_SERIAL_LEN, NULL, HZ, 1, NULL); + INQUIRY_VPD_SERIAL_LEN, NULL, HZ, 1, NULL).combined; if (ret) goto out_free; @@ -233,7 +233,7 @@ pscsi_get_inquiry_vpd_device_ident(struct scsi_device *sdev, ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, INQUIRY_VPD_DEVICE_IDENTIFIER_LEN, - NULL, HZ, 1, NULL); + NULL, HZ, 1, NULL).combined; if (ret) goto out; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index c91c284c88ef..27f3e5eb7c9a 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -455,13 +455,13 @@ __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, sense, sshdr, timeout, retries, flags, rq_flags, \ resid); \ }) -static inline int scsi_execute_req(struct scsi_device *sdev, +static inline union scsi_status scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout, int retries, int *resid) { return scsi_execute(sdev, cmd, data_direction, buffer, - bufflen, NULL, sshdr, timeout, retries, 0, 0, resid).combined; + bufflen, NULL, sshdr, timeout, retries, 0, 0, resid); } extern void sdev_disable_disk_events(struct scsi_device *sdev); extern void sdev_enable_disk_events(struct scsi_device *sdev); From patchwork Tue Apr 20 02:14:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424899 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93E9BC433B4 for ; Tue, 20 Apr 2021 02:14:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6380F61107 for ; Tue, 20 Apr 2021 02:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233826AbhDTCPR (ORCPT ); Mon, 19 Apr 2021 22:15:17 -0400 Received: from mail-pg1-f170.google.com ([209.85.215.170]:40902 "EHLO mail-pg1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233803AbhDTCPJ (ORCPT ); Mon, 19 Apr 2021 22:15:09 -0400 Received: by mail-pg1-f170.google.com with SMTP id b17so25573234pgh.7 for ; Mon, 19 Apr 2021 19:14:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A1HgG7bhuOpMgMFQ3Em5ZD7GI6GUv5eNGkKBkv3gf/w=; b=NvZioW1fRI/u0XPD+4pBnylWbnO0jm4pwvfzhb/A1cfT0NisEBA5q6yhQA4rl+6RMs m35n4t/EdZOkhQ0rKWa5KcQPbUoDj34j7Bz+6O76STyuTMN+ykvpDisFsCzzJXQQbSkQ azWP00qbGnuchZ0fydb2EV7ejq16G7lnG3xdzjOuv04ZXjdud4Y6V0ApSgJxhT0hxJpA hT1HRdTfrSUWYrB1PjO2I0TU3hgBAgBpvNnP2NLH6Obyo3Hf2R+fwm8F13WViog+3+dM 2xy+Dz7zNXDnaKRI7jIHXFFAe6X0cl3NAO+Vs3CIGq1KJd5kmxIH/Z4383uclHVeh551 5PyQ== X-Gm-Message-State: AOAM5336exeV4h0g1JPNGJ43+BDY/0A8O3bvgPC1dSQjUqePWBpJblAs lRNVJRLsktMEnOkFSMOH/q4= X-Google-Smtp-Source: ABdhPJxLbeUgKPZAeorpc/4YahLYPvAwiC5M9n1tF5bkAI9uarqtC/OoQ6Pn3+kkfbzFK1vE014Nmw== X-Received: by 2002:a63:1024:: with SMTP id f36mr14718615pgl.299.1618884878847; Mon, 19 Apr 2021 19:14:38 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:38 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Ming Lei , Hannes Reinecke , John Garry Subject: [PATCH 115/117] Change the return types of scsi_mode_sense() and sd_do_mode_sense() Date: Mon, 19 Apr 2021 19:14:00 -0700 Message-Id: <20210420021402.27678-25-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make it explicit that scsi_mode_sense() and sd_do_mode_sense() return a SCSI status. Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: John Garry Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_lib.c | 4 ++-- drivers/scsi/scsi_transport_sas.c | 4 ++-- drivers/scsi/sd.c | 18 +++++++++--------- drivers/scsi/sr.c | 2 +- include/scsi/scsi_device.h | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 44925839ccee..964462895cbb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2144,7 +2144,7 @@ EXPORT_SYMBOL_GPL(scsi_mode_select); * or 8 depending on whether a six or ten byte command was * issued) if successful. */ -int +union scsi_status scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char *buffer, int len, int timeout, int retries, struct scsi_mode_data *data, struct scsi_sense_hdr *sshdr) @@ -2241,7 +2241,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, goto retry; } - return result.combined; + return result; } EXPORT_SYMBOL(scsi_mode_sense); diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 2caa1393cf94..65caf3888f36 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -1235,8 +1235,8 @@ int sas_read_port_mode_page(struct scsi_device *sdev) if (!buffer) return -ENOMEM; - res.combined = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, - 3, &mode_data, NULL); + res = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, 3, + &mode_data, NULL); error = -EINVAL; if (!scsi_status_is_good(res)) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 14cf7841a0bf..2f423a332bc1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -194,7 +194,7 @@ cache_type_store(struct device *dev, struct device_attribute *attr, } if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT, - sdkp->max_retries, &data, NULL)) + sdkp->max_retries, &data, NULL).combined) return -EINVAL; len = min_t(size_t, sizeof(buffer), data.length - data.header_length - data.block_descriptor_length); @@ -2628,7 +2628,7 @@ sd_print_capacity(struct scsi_disk *sdkp, } /* called with buffer of length 512 */ -static inline int +static inline union scsi_status sd_do_mode_sense(struct scsi_disk *sdkp, int dbd, int modepage, unsigned char *buffer, int len, struct scsi_mode_data *data, struct scsi_sense_hdr *sshdr) @@ -2657,14 +2657,14 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) } if (sdp->use_192_bytes_for_3f) { - res.combined = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 192, &data, NULL); + res = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 192, &data, NULL); } else { /* * First attempt: ask for all pages (0x3F), but only 4 bytes. * We have to start carefully: some devices hang if we ask * for more than is available. */ - res.combined = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 4, &data, NULL); + res = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 4, &data, NULL); /* * Second attempt: ask for page 0 When only page 0 is @@ -2673,13 +2673,13 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) * CDB. */ if (!scsi_status_is_good(res)) - res.combined = sd_do_mode_sense(sdkp, 0, 0, buffer, 4, &data, NULL); + res = sd_do_mode_sense(sdkp, 0, 0, buffer, 4, &data, NULL); /* * Third attempt: ask 255 bytes, as we did earlier. */ if (!scsi_status_is_good(res)) - res.combined = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 255, + res = sd_do_mode_sense(sdkp, 0, 0x3F, buffer, 255, &data, NULL); } @@ -2742,7 +2742,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) } /* cautiously ask */ - res.combined = sd_do_mode_sense(sdkp, dbd, modepage, buffer, first_len, + res = sd_do_mode_sense(sdkp, dbd, modepage, buffer, first_len, &data, &sshdr); if (!scsi_status_is_good(res)) @@ -2774,7 +2774,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) /* Get the data */ if (len > first_len) - res.combined = sd_do_mode_sense(sdkp, dbd, modepage, buffer, len, + res = sd_do_mode_sense(sdkp, dbd, modepage, buffer, len, &data, &sshdr); if (scsi_status_is_good(res)) { @@ -2893,7 +2893,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) if (sdkp->protection_type == 0) return; - res.combined = scsi_mode_sense(sdp, 1, 0x0a, buffer, 36, SD_TIMEOUT, + res = scsi_mode_sense(sdp, 1, 0x0a, buffer, 36, SD_TIMEOUT, sdkp->max_retries, &data, &sshdr); if (!scsi_status_is_good(res) || !data.header_length || diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index da78b402072f..2496ece3a33d 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -910,7 +910,7 @@ static void get_capabilities(struct scsi_cd *cd) scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr); /* ask for mode page 0x2a */ - rc.combined = scsi_mode_sense(cd->device, 0, 0x2a, buffer, ms_len, + rc = scsi_mode_sense(cd->device, 0, 0x2a, buffer, ms_len, SR_TIMEOUT, 3, &data, NULL); if (!scsi_status_is_good(rc) || data.length > ms_len || diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 3192610af5db..de6f5f98d2eb 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -402,10 +402,10 @@ extern int scsi_track_queue_full(struct scsi_device *, int); extern int scsi_set_medium_removal(struct scsi_device *, char); -extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, - unsigned char *buffer, int len, int timeout, - int retries, struct scsi_mode_data *data, - struct scsi_sense_hdr *); +extern union scsi_status scsi_mode_sense(struct scsi_device *sdev, int dbd, + int modepage, unsigned char *buffer, int len, + int timeout, int retries, struct scsi_mode_data *data, + struct scsi_sense_hdr *); extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int modepage, unsigned char *buffer, int len, int timeout, int retries, From patchwork Tue Apr 20 02:14:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 424898 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C7CBC433B4 for ; Tue, 20 Apr 2021 02:14:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A6CF613AB for ; Tue, 20 Apr 2021 02:14:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233858AbhDTCPW (ORCPT ); Mon, 19 Apr 2021 22:15:22 -0400 Received: from mail-pf1-f170.google.com ([209.85.210.170]:39588 "EHLO mail-pf1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbhDTCPM (ORCPT ); Mon, 19 Apr 2021 22:15:12 -0400 Received: by mail-pf1-f170.google.com with SMTP id c17so24496410pfn.6 for ; Mon, 19 Apr 2021 19:14:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=krxDzFEfDdHJoAFRcvs98ymdi4VtAXsyP2h50yvLkAk=; b=KMj28a6jW7P+kyEHKrCsBIgck2F9sqi54rh6yNlQhnPrZxPMIPWfXOYTTs8IHEXdwB oAIQFuWzVsZxhUleSzzFaCb8bMl1JSon7xqpDlfiOdRlD6Xdtiud/X8qtlz3cjnegLQr LxcsHuB3znB08LpfZWXazz8XIKlBpc/o0sAc4XrCMspf0rgcv1Rgq2i3up7D9cgmJtNY 8aRXky1kD1znpvVuQ/IejoR2MAqvnCljWJQTeBaemdwmx/Ld/THquRzr5YTQXxHXtdPV 0t5jLzfkzFZcTyOqWik6RWEAwJiJOJWo4U45+ZsQt6cHGbw3MPJEJW9LADwcSh5UrV0f a/Nw== X-Gm-Message-State: AOAM533LihuykbspXYvnBf3UA5WKJVZqHvOTD3EnQy4CFRflSvgRhngI ZIeIINUCquuk9n1ysc2E4XY= X-Google-Smtp-Source: ABdhPJw50ei6raBV+nx6SVunXxjPiM7Eqn7KR2pYBdJJg8XhyqJ4KrNZGaW8tJri0eNgLEkjnr4OdQ== X-Received: by 2002:a63:1813:: with SMTP id y19mr12118051pgl.144.1618884881280; Mon, 19 Apr 2021 19:14:41 -0700 (PDT) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:3e77:56a4:910b:42a9]) by smtp.gmail.com with ESMTPSA id mq2sm630984pjb.24.2021.04.19.19.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 19:14:40 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Don Brace , Ming Lei , Hannes Reinecke , John Garry Subject: [PATCH 117/117] Change the return type of ioctl_internal_command() into union scsi_status Date: Mon, 19 Apr 2021 19:14:02 -0700 Message-Id: <20210420021402.27678-27-bvanassche@acm.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org> References: <20210420000845.25873-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make it explicit that ioctl_internal_command() returns a SCSI status. Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: John Garry Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_ioctl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 8b3bab5b5cb8..896cf5bac255 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -86,8 +86,8 @@ static int ioctl_probe(struct Scsi_Host *host, void __user *buffer) * The output area is then filled in starting from the command byte. */ -static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, - int timeout, int retries) +static union scsi_status ioctl_internal_command(struct scsi_device *sdev, + char *cmd, int timeout, int retries) { union scsi_status result; struct scsi_sense_hdr sshdr; @@ -136,13 +136,13 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev, "IOCTL Releasing command\n")); - return result.combined; + return result; } int scsi_set_medium_removal(struct scsi_device *sdev, char state) { char scsi_cmd[MAX_COMMAND_SIZE]; - int ret; + union scsi_status ret; if (!sdev->removable || !sdev->lockable) return 0; @@ -156,9 +156,9 @@ int scsi_set_medium_removal(struct scsi_device *sdev, char state) ret = ioctl_internal_command(sdev, scsi_cmd, IOCTL_NORMAL_TIMEOUT, NORMAL_RETRIES); - if (ret == 0) + if (ret.combined == 0) sdev->locked = (state == SCSI_REMOVAL_PREVENT); - return ret; + return ret.combined; } EXPORT_SYMBOL(scsi_set_medium_removal); @@ -244,14 +244,14 @@ static int scsi_ioctl_common(struct scsi_device *sdev, int cmd, void __user *arg scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0; scsi_cmd[4] = 1; return ioctl_internal_command(sdev, scsi_cmd, - START_STOP_TIMEOUT, NORMAL_RETRIES); + START_STOP_TIMEOUT, NORMAL_RETRIES).combined; case SCSI_IOCTL_STOP_UNIT: scsi_cmd[0] = START_STOP; scsi_cmd[1] = 0; scsi_cmd[2] = scsi_cmd[3] = scsi_cmd[5] = 0; scsi_cmd[4] = 0; return ioctl_internal_command(sdev, scsi_cmd, - START_STOP_TIMEOUT, NORMAL_RETRIES); + START_STOP_TIMEOUT, NORMAL_RETRIES).combined; case SCSI_IOCTL_GET_PCI: return scsi_ioctl_get_pci(sdev, arg); case SG_SCSI_RESET: