diff mbox series

[27/37] scsi: add 'set_status_byte()' accessor

Message ID 20201204100140.140863-28-hare@suse.de (mailing list archive)
State Superseded
Headers show
Series SCSI result handling cleanup, part 1 | expand

Commit Message

Hannes Reinecke Dec. 4, 2020, 10:01 a.m. UTC
Add the missing 'set_status_byte()' accessor function.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 include/scsi/scsi_cmnd.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Benjamin Block Dec. 4, 2020, 2:16 p.m. UTC | #1
On Fri, Dec 04, 2020 at 11:01:30AM +0100, Hannes Reinecke wrote:
> Add the missing 'set_status_byte()' accessor function.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  include/scsi/scsi_cmnd.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
> index 69ade4fb71aa..ace15b5dc956 100644
> --- a/include/scsi/scsi_cmnd.h
> +++ b/include/scsi/scsi_cmnd.h
> @@ -308,6 +308,11 @@ 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)
> +{
> +	cmd->result = (cmd->result & 0xffffff00) | status;
> +}
> +
>  static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
>  {
>  	cmd->result = (cmd->result & 0xffff00ff) | (status << 8);
> -- 
> 2.16.4
> 

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
diff mbox series

Patch

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 69ade4fb71aa..ace15b5dc956 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -308,6 +308,11 @@  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)
+{
+	cmd->result = (cmd->result & 0xffffff00) | status;
+}
+
 static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
 {
 	cmd->result = (cmd->result & 0xffff00ff) | (status << 8);