[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <47275EB5.1070704@student.ltu.se>
Date: Tue, 30 Oct 2007 17:41:25 +0100
From: Richard Knutsson <ricknu-0@...dent.ltu.se>
To: Denys Vlasenko <vda.linux@...glemail.com>
CC: James.Bottomley@...eleye.com, James.Smart@...lex.com,
linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: Re: [PATCH] drivers/scsi/lpfc/lpfc_hw.h: Some minor cleanup.
Denys Vlasenko wrote:
> On Tuesday 30 October 2007 10:54, Richard Knutsson wrote:
>
>> Signed-off-by: Richard Knutsson <ricknu-0@...dent.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists