Re: [alobakin:pfcp 5/20] drivers/iio/imu/adis16475.c:363 adis16475_set_freq() warn: set_bit() takes a bit number

From: Alexander Lobakin
Date: Mon Nov 06 2023 - 08:42:12 EST


From: Nuno Sá <noname.nuno@xxxxxxxxx>
Date: Mon, 06 Nov 2023 13:02:58 +0100

> On Mon, 2023-11-06 at 12:18 +0100, Alexander Lobakin wrote:
>> From: Nuno Sá <noname.nuno@xxxxxxxxx>
>> Date: Mon, 06 Nov 2023 11:07:16 +0100

[...]

>> assign_bit() does not take a bitmask as a first argument, but a bit number.
>>
>> I.e. if you want to switch BIT(0), you call it like assign_bit(0, ...),
>> not assign_bit(BIT(0), ...). Same for the bit nr 1.
>>
>
> Yes, I know... if you look at my reply to Dan you can see I realized that already :)

Oh okay :)

>
> I guess by the time I first sent this time I didn't knew or maybe just a dumb
> mistake...
>
> I'll send a patch later today removing the BIT() from the #define, thx!

Nice! Don't forget the tags the build bot asked for :p

BTW, I believe the reason why this warning triggered after my commit is
that before it, assign_bit() is a static inline, but becomes a macro
then. smatch becomes able to see through it that it indeed is a wrapper
around set_bit()/clear_bit() and realizes the first argument is invalid.

>
> - Nuno Sá
>

Thanks,
Olek