* [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2
@ 2014-05-20 16:48 Fabian Frederick
2014-05-20 17:06 ` Joe Perches
0 siblings, 1 reply; 7+ messages in thread
From: Fabian Frederick @ 2014-05-20 16:48 UTC (permalink / raw)
To: linux-kernel; +Cc: Kurt Garloff, akpm
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
index b006cf7..c353848 100644
--- 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");
--
1.8.4.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2
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
0 siblings, 2 replies; 7+ messages in thread
From: Joe Perches @ 2014-05-20 17:06 UTC (permalink / raw)
To: Fabian Frederick; +Cc: linux-kernel, Kurt Garloff, akpm
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>?
If so, that should be mentioned in the changelog.
These should probably add #include <linux/log2.h>
It would have been nicer to use a patch series
and a cover letter so I could make this reply to
to cover letter.
Please take the time to setup and use git send-email
instead of sylpheed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2
2014-05-20 17:06 ` Joe Perches
@ 2014-05-20 17:10 ` Fabian Frederick
2014-05-22 0:28 ` Guenter Roeck
1 sibling, 0 replies; 7+ messages in thread
From: Fabian Frederick @ 2014-05-20 17:10 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, Kurt Garloff, akpm
On Tue, 20 May 2014 10:06:42 -0700
Joe Perches <joe@perches.com> 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>?
>
> If so, that should be mentioned in the changelog.
>
> These should probably add #include <linux/log2.h>
>
> It would have been nicer to use a patch series
> and a cover letter so I could make this reply to
> to cover letter.
>
> Please take the time to setup and use git send-email
> instead of sylpheed.
>
Hello Joe,
Ok, I'll send a new version in patchset mode.
Fabian
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2
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
1 sibling, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2014-05-22 0:28 UTC (permalink / raw)
To: Joe Perches; +Cc: Fabian Frederick, linux-kernel, Kurt Garloff, akpm
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() ?
Guenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2
2014-05-22 0:28 ` Guenter Roeck
@ 2014-05-22 1:03 ` Joe Perches
2014-05-22 3:29 ` Guenter Roeck
0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2014-05-22 1:03 UTC (permalink / raw)
To: Guenter Roeck; +Cc: Fabian Frederick, linux-kernel, Kurt Garloff, akpm
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2
2014-05-22 1:03 ` Joe Perches
@ 2014-05-22 3:29 ` Guenter Roeck
2014-05-22 18:50 ` Fabian Frederick
0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2014-05-22 3:29 UTC (permalink / raw)
To: Joe Perches; +Cc: Fabian Frederick, linux-kernel, Kurt Garloff, akpm
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2
2014-05-22 3:29 ` Guenter Roeck
@ 2014-05-22 18:50 ` Fabian Frederick
0 siblings, 0 replies; 7+ messages in thread
From: Fabian Frederick @ 2014-05-22 18:50 UTC (permalink / raw)
To: Guenter Roeck; +Cc: Joe Perches, linux-kernel, Kurt Garloff, akpm
On Wed, 21 May 2014 20:29:39 -0700
Guenter Roeck <linux@roeck-us.net> wrote:
> 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
>
I wasn't aware of a problem with 0 value ... I guess we can forget
conversion here.
Fabian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-05-22 18:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-05-22 18:50 ` Fabian Frederick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox