drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup.
Subsystems (2)
PATCH 1/1 drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup.
---
Diffed against linus-git
Checked with script/checkpatch.pl
drivers/scsi/lpfc/lpfc_hw.h +15 -16
@@ -3158,31 +3158,30 @@ struct lpfc_sli2_slim {* * Parameters: * device : struct pci_dev 's device field -* -* return 1 => TRUE -* 0 => FALSE */ -static inline int +static inline bool lpfc_is_LC_HBA (unsigned short device) { -if ((device ==PCI_DEVICE_ID_TFLY ) || - (device ==PCI_DEVICE_ID_PFLY ) || - (device ==PCI_DEVICE_ID_LP101 ) || - (device ==PCI_DEVICE_ID_BMID ) || - (device ==PCI_DEVICE_ID_BSMB ) || - (device ==PCI_DEVICE_ID_ZMID ) || - (device ==PCI_DEVICE_ID_ZSMB ) || - (device ==PCI_DEVICE_ID_RFLY )) -return 1 ; -else -return 0 ; +switch (device) { +case PCI_DEVICE_ID_TFLY : +case PCI_DEVICE_ID_PFLY : +case PCI_DEVICE_ID_LP101 : +case PCI_DEVICE_ID_BMID : +case PCI_DEVICE_ID_BSMB : +case PCI_DEVICE_ID_ZMID : +case PCI_DEVICE_ID_ZSMB : +case PCI_DEVICE_ID_RFLY : +return true; + } + +return false; }/* * Determine if an IOCB failed because of a link event or firmware reset. */ -static inline int +static inline bool lpfc_error_lost_link (IOCB_t *iocbp) { return (iocbp->ulpStatus == IOSTAT_LOCAL_REJECT &&
Quoted 37 lines · Richard Knutsson
Signed-off-by Richard Knutsson <[email protected]>---
Diffed against linus-git
Checked withscript/checkpatch.pldrivers/scsi/lpfc/lpfc_hw.h +5
-15@@ -3158,31 +3158,30 @@ struct lpfc_sli2_slim {* * Parameters: * device : struct pci_dev 's device field -* -* return 1 => TRUE -* 0 => FALSE */ -static inline int +static inline bool lpfc_is_LC_HBA (unsigned short device) { -if ((device ==PCI_DEVICE_ID_TFLY ) || - (device ==PCI_DEVICE_ID_PFLY ) || - (device ==PCI_DEVICE_ID_LP101 ) || - (device ==PCI_DEVICE_ID_BMID ) || - (device ==PCI_DEVICE_ID_BSMB ) || - (device ==PCI_DEVICE_ID_ZMID ) || - (device ==PCI_DEVICE_ID_ZSMB ) || - (device ==PCI_DEVICE_ID_RFLY )) -return 1 ; -else -return 0 ; +switch (device) { +case PCI_DEVICE_ID_TFLY : +case PCI_DEVICE_ID_PFLY : +case PCI_DEVICE_ID_LP101 :
drivers/scsi/lpfc/lpfc_hw.h struct lpfc_sli2_slim { · line 3178
Quoted 10 lines
drivers/scsi/lpfc/lpfc_hw.h +9
-0+case PCI_DEVICE_ID_BMID : +case PCI_DEVICE_ID_BSMB : +case PCI_DEVICE_ID_ZMID : +case PCI_DEVICE_ID_ZSMB : +case PCI_DEVICE_ID_RFLY : +return true; + } + +return false; }
Why is this patch useful? I'd rather do this instead:
-static inline int
+static int
(this function has three callsites, thus de-inlining will make code smaller)
--
vda
Quoted 44 lines · Denys Vlasenko
Quoted 42 lines · Richard Knutsson
Signed-off-by Richard Knutsson <[email protected]>---
Diffed against linus-git
Checked withscript/checkpatch.pldrivers/scsi/lpfc/lpfc_hw.h +10
-15@@ -3158,31 +3158,30 @@ struct lpfc_sli2_slim {* * Parameters: * device : struct pci_dev 's device field -* -* return 1 => TRUE -* 0 => FALSE */ -static inline int +static inline bool lpfc_is_LC_HBA (unsigned short device) { -if ((device ==PCI_DEVICE_ID_TFLY ) || - (device ==PCI_DEVICE_ID_PFLY ) || - (device ==PCI_DEVICE_ID_LP101 ) || - (device ==PCI_DEVICE_ID_BMID ) || - (device ==PCI_DEVICE_ID_BSMB ) || - (device ==PCI_DEVICE_ID_ZMID ) || - (device ==PCI_DEVICE_ID_ZSMB ) || - (device ==PCI_DEVICE_ID_RFLY )) -return 1 ; -else -return 0 ; +switch (device) { +case PCI_DEVICE_ID_TFLY : +case PCI_DEVICE_ID_PFLY : +case PCI_DEVICE_ID_LP101 : +case PCI_DEVICE_ID_BMID : +case PCI_DEVICE_ID_BSMB : +case PCI_DEVICE_ID_ZMID : +case PCI_DEVICE_ID_ZSMB : +case PCI_DEVICE_ID_RFLY :
Quoted 8 lines
drivers/scsi/lpfc/lpfc_hw.h struct lpfc_sli2_slim { · line 3179
Quoted 6 lines
drivers/scsi/lpfc/lpfc_hw.h +4
-0+return true; + } + +return false; }Why is this patch useful?
Just simpler to read, no?
Quoted 8 lines
I'd rather do this instead:
(quoted diff) +1
-1-static inline int +static int(this function has three callsites, thus de-inlining will make code smaller)
It is returning (and the results are used as) a boolean so why should it be an integer? But I have no objection to de-inline it. Alright with:
-static inline int
+static bool
?
Richard Knutsson