From: Nathan Chancellor <nathan@kernel.org>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: Justin Stitt <justinstitt@google.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH 1/2] i2c: i2c-bcm-iproc: fix -Wvoid-pointer-to-enum-cast warning
Date: Thu, 10 Aug 2023 07:44:52 -0700 [thread overview]
Message-ID: <20230810144452.GD1549244@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20230810085632.xzonkmse27mu4yew@intel.intel>
Hi Andi,
On Thu, Aug 10, 2023 at 10:56:32AM +0200, Andi Shyti wrote:
> Hi Justin,
>
> > @@ -1036,7 +1036,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
> > platform_set_drvdata(pdev, iproc_i2c);
> > iproc_i2c->device = &pdev->dev;
> > iproc_i2c->type =
> > - (enum bcm_iproc_i2c_type)of_device_get_match_data(&pdev->dev);
> > + (unsigned long) of_device_get_match_data(&pdev->dev);
>
> I think this should be uintptr_t, as defined in types.h:
>
> typedef unsigned long uintptr_t;
Yes, that is a valid comment, although I will say that I have seen some
developers/maintainers prefer 'unsigned long' over 'uintptr_t', so it is
really a crapshoot which one to pick :)
> (I'm a bit puzzled to see a void *data cast to a 0/1 value.)
It is an odd pattern but as far as I understand it, the kernel uses it a
lot to pass platform specific data around (just grepping for
'.data = (void *)' shows a lot of instances.
Cheers,
Nathan
WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: Justin Stitt <justinstitt@google.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH 1/2] i2c: i2c-bcm-iproc: fix -Wvoid-pointer-to-enum-cast warning
Date: Thu, 10 Aug 2023 07:44:52 -0700 [thread overview]
Message-ID: <20230810144452.GD1549244@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20230810085632.xzonkmse27mu4yew@intel.intel>
Hi Andi,
On Thu, Aug 10, 2023 at 10:56:32AM +0200, Andi Shyti wrote:
> Hi Justin,
>
> > @@ -1036,7 +1036,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
> > platform_set_drvdata(pdev, iproc_i2c);
> > iproc_i2c->device = &pdev->dev;
> > iproc_i2c->type =
> > - (enum bcm_iproc_i2c_type)of_device_get_match_data(&pdev->dev);
> > + (unsigned long) of_device_get_match_data(&pdev->dev);
>
> I think this should be uintptr_t, as defined in types.h:
>
> typedef unsigned long uintptr_t;
Yes, that is a valid comment, although I will say that I have seen some
developers/maintainers prefer 'unsigned long' over 'uintptr_t', so it is
really a crapshoot which one to pick :)
> (I'm a bit puzzled to see a void *data cast to a 0/1 value.)
It is an odd pattern but as far as I understand it, the kernel uses it a
lot to pass platform specific data around (just grepping for
'.data = (void *)' shows a lot of instances.
Cheers,
Nathan
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-08-10 14:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 21:25 [PATCH 0/2] i2c: fix -Wvoid-pointer-to-enum-cast warnings Justin Stitt
2023-08-09 21:25 ` Justin Stitt
2023-08-09 21:25 ` [PATCH 1/2] i2c: i2c-bcm-iproc: fix -Wvoid-pointer-to-enum-cast warning Justin Stitt
2023-08-09 21:25 ` Justin Stitt
2023-08-10 8:56 ` Andi Shyti
2023-08-10 8:56 ` Andi Shyti
2023-08-10 14:44 ` Nathan Chancellor [this message]
2023-08-10 14:44 ` Nathan Chancellor
2023-08-09 21:25 ` [PATCH 2/2] i2c: i2c-rcar: " Justin Stitt
2023-08-09 21:25 ` Justin Stitt
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=20230810144452.GD1549244@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=justinstitt@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.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 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.