[PATCH 3/3] i2c: rcar: Fix Wvoid-pointer-to-enum-cast warning
Arnd Bergmann
arnd at arndb.de
Fri Nov 28 00:32:34 PST 2025
On Thu, Nov 27, 2025, at 14:46, Geert Uytterhoeven wrote:
> On Thu, 27 Nov 2025 at 14:42, Krzysztof Kozlowski <krzysztof.kozlowski at oss.qualcomm.com> wrote:
>>
>> >> kernel_ulong_t, I think.
>> >
>> > include/linux/mod_devicetable.h:typedef unsigned long kernel_ulong_t;
>> >
>> > IIRC, it was introduced originally because "unsigned long" might have
>> > a different size in userspace. Nowadays (for x32), uapi uses
>> > __kernel_ulong_t, though.
>>
>> Maybe, but if you look at the data structures all have kernel_ulong_t,
>> so this fits the logic I was following here - I cast to the type which
>> is both representing pointer and is already used for driver data,
>> because this match data serves similar purpose as mentioned driver data.
It is rather inconsistent: The __kernel_ulong_t type is used in
include/uapi/ in places where x32 uses the 64-bit ABI, as the idea
was to not have to do (much) type conversion there. This of course
failed overall because any ioctl still has to be converted.
The kernel_ulong_t as far as I can tell was only meant to be
used in include/linux/mod_devicetable.h, with the idea of being
able to interpret 64-bit kernel modules from a 32-bit module
loader in userspace. I don't think the latest kmod actually uses
it that way any more.
>> I don't mind casting via unsigned long, but:
>> 1. these are old and trivial issues,
>> 2. they are quite annoying when people want to compile test with W=1,
>> 3. I was trying to fix them (although not sure if for I2C) already,
>> 4. and some others probably as well were trying to fix them,
>> so how many people need to send them and debate before we fix them finally?
>>
>> unsigned long vs kernel_ulong_t is a nit-style discussion IMO, unless we
>> have here more concrete arguments, e.g. statement from Linus that
>> kernel_ulong_t is wrong.
>>
>> If maintainers of this code want unsigned long, please apply the patch
>> and fix directly, but for the sake, let's get it merged...
>
> Sure, let's get it fixed!
Agreed. I don't mind the use of kernel_ulong_t here either, since it's
adjacent to the module device table entries, but I would also pick
'unsigned long' or 'uintptr_t' instead.
Arnd
More information about the linux-arm-kernel
mailing list