Re: [PATCH] hwmon: (oxp-sensors) Add AYANEO 2 and Geek models

From: Joaquin Aramendia
Date: Fri Apr 28 2023 - 15:16:02 EST


> > I don't know why but the compiler would complain with the casting from
> > enum to void*.
>
> Really ? I tried with both 32 bit and 64 bit targets, and the above worked
> just fine (with W=1). I tried with gcc 10.3 as well as 11.3. What is
> your compiler version, what exactly is the warning/error message you
> observed, and how exactly did your code look like ?

Said something about an invalid cast of an lvalue? I can´t remember exactly
and couldn't reproduce it again. Will change all to your form after
this patch gets
merged if you like, just to keep things atomic.

>
> > Found out that explicitly casting the enum literal before casting it
> > to void* works and
> > the compiler stopped complaining so I went with it.
> >
>
> You are not casting the enum literal, but a pointer to it.

Yes. I'm taking an enum literal and taking its pointer to cast it to a void*.
A little cumbersome, but maybe it can be avoided by using your proposed
form directly and after making sure it works.

--
Joaquín I. Aramendía