Skip to content

Commit

Permalink
scsi: core: Add get_{status,host}_byte() accessor functions
Browse files Browse the repository at this point in the history
Add accessor functions for the host and status byte.

Link: https://lore.kernel.org/r/20210427083046.31620-17-hare@suse.de
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
hreinecke authored and martinkpetersen committed Jun 1, 2021
1 parent 7b25bdb commit f6b5a69
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/scsi/scsi_cmnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ static inline void set_status_byte(struct scsi_cmnd *cmd, char status)
cmd->result = (cmd->result & 0xffffff00) | status;
}

static inline u8 get_status_byte(struct scsi_cmnd *cmd)
{
return cmd->result & 0xff;
}

static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
{
cmd->result = (cmd->result & 0xffff00ff) | (status << 8);
Expand All @@ -325,6 +330,11 @@ static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
cmd->result = (cmd->result & 0xff00ffff) | (status << 16);
}

static inline u8 get_host_byte(struct scsi_cmnd *cmd)
{
return (cmd->result >> 16) & 0xff;
}


static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
{
Expand Down

0 comments on commit f6b5a69

Please sign in to comment.