From: Nickolay Vinogradov <nickolay@protei.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] asm-generic/bitops/fls64.h
Date: Tue, 13 May 2008 19:45:55 +0400 [thread overview]
Message-ID: <4829B7B3.2010300@protei.ru> (raw)
In-Reply-To: <20080513083101.96c92bd6.akpm@linux-foundation.org>
Andrew Morton пишет:
> On Tue, 13 May 2008 14:43:43 +0400 Nickolay Vinogradov <nickolay@protei.ru> wrote:
>
>> Andrew Morton __________:
>>> On Sun, 04 May 2008 22:58:50 +0400
>>> ____________________ ______________ ____________________ <nickolay@protei.ru> wrote:
>>>
>>>> bugfix in fls64 on a big endian systems(against 2.6.25).
>>>>
>>>> Signed-off-by: Nickolay Vinogradov <nickolay@protei.ru>
>>>>
>>>> --
>>>>
>>>> diff --git a/include/asm-generic/bitops/fls64.h
>>>> b/include/asm-generic/bitops/fls64.h
>>>> index 1b6b17c..2eedb6f 100644
>>>> --- a/include/asm-generic/bitops/fls64.h
>>>> +++ b/include/asm-generic/bitops/fls64.h
>>>> @@ -8,7 +8,7 @@ static inline int fls64(__u64 x)
>>>> __u32 h = x >> 32;
>>>> if (h)
>>>> return fls(h) + 32;
>>>> - return fls(x);
>>>> + return fls((__u32)x);
>>>> }
>>>>
>>>> #endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */
>>> Please describe the bug which you are fixing?
>>>
>>> Perhaps a more robust fix to <whatever the bug is> would be to
>>> repair fls() so that it works correctly when passed a u64. Perhaps.
>> Repair fls64() so that it works correctly when passed a u64.
>>
>
> Yes, but what's wrong with it now?
>
> The fls() in include/asm-generic/bitops/fls.h takes an int.
>
> The fls() in include/asm-x86/bitops.h takes an int.
>
> So both of these will already trucate the incoming argument to 32-bits.
>
> It seems that you are using a version of fls() which doesn't do this.
> Why? Which architecture are you using? Would it not be more robust to
> fix fls()?
include/asm-arm/bitops.h
fls() defined here as a macro, not as a function with 32-bit argument.
Therefore, there are two choices:
1. explicit cast to u32 before calling.
2. rewrite fls macro as an inline function.
--
Nickolay Vinogradov
Protei Research and Development Center
St.Petersburg, 194044, Russia
Tel.: +7 812 449 47 27
next prev parent reply other threads:[~2008-05-13 15:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-04 18:58 [PATCH] asm-generic/bitops/fls64.h Виноградов Николай Михайлович
2008-05-12 21:45 ` Andrew Morton
2008-05-13 10:43 ` Nickolay Vinogradov
2008-05-13 15:31 ` Andrew Morton
2008-05-13 15:45 ` Nickolay Vinogradov [this message]
2008-05-13 11:17 ` Alexander van Heukelum
2008-05-13 12:29 ` Nickolay Vinogradov
2008-05-13 13:24 ` Alexander van Heukelum
2008-05-13 13:58 ` Russell King
2008-05-13 14:24 ` Alexander van Heukelum
2008-05-13 14:46 ` Nickolay Vinogradov
2008-05-13 14:35 ` Andreas Schwab
2008-05-13 16:11 ` Andrew Morton
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=4829B7B3.2010300@protei.ru \
--to=nickolay@protei.ru \
--cc=akpm@linux-foundation.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.