From a505b86fde5903944828fa04f775e79a6636791d Mon Sep 17 00:00:00 2001 From: "Stephen M. Cameron" Date: Fri, 14 Nov 2014 17:27:04 -0600 Subject: hpsa: get rid of type/attribute/direction bit field where possible Using bit fields for hardware command fields isn't portable and relies on assumptions about how the compiler lays out the bits. We can fix this in the driver's internal command structure, but the ioctl interface we can't change because it is part of the userland ABI. Signed-off-by: Don Brace Reviewed-by: Webb Scales Signed-off-by: Christoph Hellwig --- drivers/scsi/hpsa_cmd.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'drivers/scsi/hpsa_cmd.h') diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 575eda8a8c5e..cb988c41cad9 100644 --- a/drivers/scsi/hpsa_cmd.h +++ b/drivers/scsi/hpsa_cmd.h @@ -320,11 +320,19 @@ struct CommandListHeader { struct RequestBlock { u8 CDBLen; - struct { - u8 Type:3; - u8 Attribute:3; - u8 Direction:2; - } Type; + /* + * type_attr_dir: + * type: low 3 bits + * attr: middle 3 bits + * dir: high 2 bits + */ + u8 type_attr_dir; +#define TYPE_ATTR_DIR(t, a, d) ((((d) & 0x03) << 6) |\ + (((a) & 0x07) << 3) |\ + ((t) & 0x07)) +#define GET_TYPE(tad) ((tad) & 0x07) +#define GET_ATTR(tad) (((tad) >> 3) & 0x07) +#define GET_DIR(tad) (((tad) >> 6) & 0x03) u16 Timeout; u8 CDB[16]; }; -- cgit v1.2.3