From: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andi Shyti <andi.shyti@kernel.org>, Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH 3/3] i2c: rcar: Fix Wvoid-pointer-to-enum-cast warning
Date: Thu, 27 Nov 2025 12:42:15 +0100 [thread overview]
Message-ID: <dbb94fb1-2f78-4bd2-9254-c435ab3325c0@oss.qualcomm.com> (raw)
In-Reply-To: <CAMuHMdX7t=mabqFE5O-Cii3REMuyaePHmqX+j_mqyrn6XXzsoA@mail.gmail.com>
On 27/11/2025 10:02, Geert Uytterhoeven wrote:
> Hi Krzysztof,
>
> On Wed, 26 Nov 2025 at 19:23, Krzysztof Kozlowski
> <krzysztof.kozlowski@oss.qualcomm.com> wrote:
>> 'i2c_types' is an enum, thus cast of pointer on 64-bit compile test with
>> clang and W=1 causes:
>>
>> i2c-rcar.c:1144:18: error: cast to smaller integer type 'enum rcar_i2c_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
>>
>> One of the discussions in 2023 on LKML suggested warning is not suitable
>> for kernel. Nothing changed in this regard since that time, so assume
>> the warning will stay and we want to have warnings-free builds.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
>
> Thanks for your patch!
>
> =
>> --- a/drivers/i2c/busses/i2c-rcar.c
>> +++ b/drivers/i2c/busses/i2c-rcar.c
>> @@ -1141,7 +1141,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
>> if (IS_ERR(priv->io))
>> return PTR_ERR(priv->io);
>>
>> - priv->devtype = (enum rcar_i2c_type)of_device_get_match_data(dev);
>> + priv->devtype = (kernel_ulong_t)of_device_get_match_data(dev);
>
> Any specific reason you picked "kernel_ulong_t" instead of "unsigned long"?
> The former seems to be the least common option.
As I wrote in the first patch, because to my knowledge it is the
preferred form for holding driver data which are in general pointers. We
do not store pointers as unsigned long. It is also already used for the
driver data types - see include/linux/mod_devicetable.h.
> FWIW, the most common option is "uintptr_t", which torvalds doesn't like...
Because it is discouraged in the kernel.
https://lore.kernel.org/all/2023081004-lapped-handbag-0324@gregkh/
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-11-27 11:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 18:22 [PATCH 1/3] i2c: bcm-iproc: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
2025-11-26 18:22 ` [PATCH 2/3] i2c: pxa: " Krzysztof Kozlowski
2025-11-26 18:23 ` [PATCH 3/3] i2c: rcar: " Krzysztof Kozlowski
2025-11-27 9:02 ` Geert Uytterhoeven
2025-11-27 11:42 ` Krzysztof Kozlowski [this message]
2025-11-27 11:48 ` Krzysztof Kozlowski
2025-11-27 12:52 ` Geert Uytterhoeven
2025-11-27 13:42 ` Krzysztof Kozlowski
2025-11-27 13:46 ` Geert Uytterhoeven
2025-11-28 8:32 ` Arnd Bergmann
2025-12-03 17:38 ` [PATCH 1/3] i2c: bcm-iproc: " Andi Shyti
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=dbb94fb1-2f78-4bd2-9254-c435ab3325c0@oss.qualcomm.com \
--to=krzysztof.kozlowski@oss.qualcomm.com \
--cc=andi.shyti@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=justinstitt@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=magnus.damm@gmail.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=wsa+renesas@sang-engineering.com \
/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