[PATCH v1 2/8] scsi: megaraid_sas: use parentheses to enclose macros with complex values
From: Luo Jiaxing
Date: Sat Apr 10 2021 - 02:48:21 EST
checkpatch.pl report several error below:
ERROR: Macros with complex values should be enclosed in parentheses
+#define SCP2LUN(scp) (u32)(scp)->device->lun // to LUN
ERROR: Macros with complex values should be enclosed in parentheses
+#define SCP2ADAPTER(scp) (adapter_t *)SCSIHOST2ADAP(SCP2HOST(scp))
So fix those by enclosed by parentheses.
Signed-off-by: Jianqin Xie <xiejianqin@xxxxxxxxxxxxx>
Signed-off-by: Luo Jiaxing <luojiaxing@xxxxxxxxxx>
---
drivers/scsi/megaraid/mbox_defs.h | 2 +-
drivers/scsi/megaraid/mega_common.h | 16 ++++++++--------
drivers/scsi/megaraid/megaraid_sas.h | 6 +++---
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/scsi/megaraid/mbox_defs.h b/drivers/scsi/megaraid/mbox_defs.h
index 5001624..3efbfdb 100644
--- a/drivers/scsi/megaraid/mbox_defs.h
+++ b/drivers/scsi/megaraid/mbox_defs.h
@@ -124,7 +124,7 @@
#define FC_MAX_PHYSICAL_DEVICES 256
#define MAX_MBOX_CHANNELS 5
#define MAX_MBOX_TARGET 15
-#define MBOX_MAX_PHYSICAL_DRIVES MAX_MBOX_CHANNELS*MAX_MBOX_TARGET
+#define MBOX_MAX_PHYSICAL_DRIVES (MAX_MBOX_CHANNELS * MAX_MBOX_TARGET)
#define MAX_ROW_SIZE_40LD 32
#define MAX_ROW_SIZE_8LD 8
#define SPAN_DEPTH_8_SPANS 8
diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h
index 2ad0aa2..2a0981b 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -196,22 +196,22 @@ typedef struct {
// conversion from scsi command
-#define SCP2HOST(scp) (scp)->device->host // to host
-#define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata // to soft state
-#define SCP2CHANNEL(scp) (scp)->device->channel // to channel
-#define SCP2TARGET(scp) (scp)->device->id // to target
-#define SCP2LUN(scp) (u32)(scp)->device->lun // to LUN
+#define SCP2HOST(scp) ((scp)->device->host) // to host
+#define SCP2HOSTDATA(scp) (SCP2HOST(scp)->hostdata) // to soft state
+#define SCP2CHANNEL(scp) ((scp)->device->channel) // to channel
+#define SCP2TARGET(scp) ((scp)->device->id) // to target
+#define SCP2LUN(scp) ((u32)(scp)->device->lun) // to LUN
// generic macro to convert scsi command and host to controller's soft state
#define SCSIHOST2ADAP(host) (((caddr_t *)(host->hostdata))[0])
-#define SCP2ADAPTER(scp) (adapter_t *)SCSIHOST2ADAP(SCP2HOST(scp))
+#define SCP2ADAPTER(scp) ((adapter_t *)SCSIHOST2ADAP(SCP2HOST(scp)))
#define MRAID_IS_LOGICAL(adp, scp) \
- (SCP2CHANNEL(scp) == (adp)->max_channel) ? 1 : 0
+ ((SCP2CHANNEL(scp) == (adp)->max_channel) ? 1 : 0)
#define MRAID_IS_LOGICAL_SDEV(adp, sdev) \
- (sdev->channel == (adp)->max_channel) ? 1 : 0
+ ((sdev->channel == (adp)->max_channel) ? 1 : 0)
/**
* MRAID_GET_DEVICE_MAP - device ids
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index b5a765b..b652a84 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -154,9 +154,9 @@
#define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
#define MFI_INIT_HOTPLUG 0x00000010
#define MFI_STOP_ADP 0x00000020
-#define MFI_RESET_FLAGS MFI_INIT_READY| \
- MFI_INIT_MFIMODE| \
- MFI_INIT_ABORT
+#define MFI_RESET_FLAGS (MFI_INIT_READY | \
+ MFI_INIT_MFIMODE | \
+ MFI_INIT_ABORT)
#define MFI_ADP_TRIGGER_SNAP_DUMP 0x00000100
#define MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE (0x01)
--
2.7.4