* [PATCH] drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup.
@ 2007-10-30 10:54 Richard Knutsson
2007-10-30 15:44 ` Denys Vlasenko
0 siblings, 1 reply; 3+ messages in thread
From: Richard Knutsson @ 2007-10-30 10:54 UTC (permalink / raw)
To: James.Bottomley, James.Smart; +Cc: linux-kernel, linux-scsi, Richard Knutsson
Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
---
Diffed against linus-git
Checked with script/checkpatch.pl
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 451accd..6f56528 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -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 &&
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup.
2007-10-30 10:54 [PATCH] drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup Richard Knutsson
@ 2007-10-30 15:44 ` Denys Vlasenko
2007-10-30 16:41 ` Richard Knutsson
0 siblings, 1 reply; 3+ messages in thread
From: Denys Vlasenko @ 2007-10-30 15:44 UTC (permalink / raw)
To: Richard Knutsson; +Cc: James.Bottomley, James.Smart, linux-kernel, linux-scsi
On Tuesday 30 October 2007 10:54, Richard Knutsson wrote:
> Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
> ---
> Diffed against linus-git
> Checked with script/checkpatch.pl
>
>
> diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
> index 451accd..6f56528 100644
> --- a/drivers/scsi/lpfc/lpfc_hw.h
> +++ b/drivers/scsi/lpfc/lpfc_hw.h
> @@ -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;
> }
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup.
2007-10-30 15:44 ` Denys Vlasenko
@ 2007-10-30 16:41 ` Richard Knutsson
0 siblings, 0 replies; 3+ messages in thread
From: Richard Knutsson @ 2007-10-30 16:41 UTC (permalink / raw)
To: Denys Vlasenko; +Cc: James.Bottomley, James.Smart, linux-kernel, linux-scsi
Denys Vlasenko wrote:
> On Tuesday 30 October 2007 10:54, Richard Knutsson wrote:
>
>> Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
>> ---
>> Diffed against linus-git
>> Checked with script/checkpatch.pl
>>
>>
>> diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
>> index 451accd..6f56528 100644
>> --- a/drivers/scsi/lpfc/lpfc_hw.h
>> +++ b/drivers/scsi/lpfc/lpfc_hw.h
>> @@ -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;
>> }
>>
>
> Why is this patch useful?
Just simpler to read, no?
> I'd rather do this instead:
>
> -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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-10-30 17:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-30 10:54 [PATCH] drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup Richard Knutsson
2007-10-30 15:44 ` Denys Vlasenko
2007-10-30 16:41 ` Richard Knutsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).