public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Joe Perches <joe@perches.com>
Cc: Fabian Frederick <fabf@skynet.be>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Kurt Garloff <garloff@suse.de>, akpm <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2
Date: Wed, 21 May 2014 20:29:39 -0700	[thread overview]
Message-ID: <537D6F23.3010704@roeck-us.net> (raw)
In-Reply-To: <1400720632.11896.7.camel@joe-AO725>

On 05/21/2014 06:03 PM, Joe Perches wrote:
> On Wed, 2014-05-21 at 17:28 -0700, Guenter Roeck wrote:
>> On Tue, May 20, 2014 at 10:06:42AM -0700, Joe Perches wrote:
>>> On Tue, 2014-05-20 at 18:48 +0200, Fabian Frederick wrote:
>>>> Cc: Kurt Garloff <garloff@suse.de>
>>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>>> Signed-off-by: Fabian Frederick <fabf@skynet.be>
>>>> ---
>>>>   drivers/scsi/tmscsim.c | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
>>> []
>>>> @@ -1611,7 +1611,7 @@ dc390_Reselect( struct dc390_acb* pACB )
>>>>         printk (KERN_ERR "DC390: Reselection must select host adapter: %02x!\n", lun);
>>>>       else
>>>>         lun ^= 1 << pACB->pScsiHost->this_id; /* Mask AdapterID */
>>>> -    id = 0; while (lun >>= 1) id++;
>>>> +    id = ilog2(lun);
>>>>       /* Get LUN */
>>>>       lun = DC390_read8 (ScsiFifo);
>>>>       if (!(lun & IDENTIFY_BASE)) printk (KERN_ERR "DC390: Resel: Expect identify message!\n");
>>>
>>> Hey Fabian.
>>>
>>> You've submitted several of these now.
>>>
>>> Have you gone through all of these to make sure
>>> that the ilog2(<foo>) uses are always using a
>>> non-zero <foo>?
>>>
>> Maybe I am missing something. Why not just use fls() ?
>
> fls strains Andrew Morton's brain.
>
> https://lkml.org/lkml/2014/5/19/771
>

:-).

On the other side fls(1) == 1 while ilog2(1) == 0. So some test is necessary anyway.

Guenter


  reply	other threads:[~2014-05-22  3:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 16:48 [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2 Fabian Frederick
2014-05-20 17:06 ` Joe Perches
2014-05-20 17:10   ` Fabian Frederick
2014-05-22  0:28   ` Guenter Roeck
2014-05-22  1:03     ` Joe Perches
2014-05-22  3:29       ` Guenter Roeck [this message]
2014-05-22 18:50         ` Fabian Frederick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=537D6F23.3010704@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=akpm@linux-foundation.org \
    --cc=fabf@skynet.be \
    --cc=garloff@suse.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox