lkml.org 
[lkml]   [2023]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] i2c: i2c-bcm-iproc: fix -Wvoid-pointer-to-enum-cast warning
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

\
 
 \ /
  Last update: 2023-08-10 16:45    [W:0.140 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site