lkml.org 
[lkml]   [2023]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] hwmon: (oxp-sensors) Add AYANEO 2 and Geek models
From
On 4/28/23 12:15, Joaquin Aramendia wrote:
>>> 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

Like this, maybe ?

drivers/hwmon/oxp-sensors.c:63:26: error: lvalue required as unary ‘&’ operand

That would have been something along the line of

.driver_data = (void *)&aok_zoe_a1,

or
driver_data = &aok_zoe_a1,

> 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.
>

Please do.

Thanks,
Guenter

>>
>>> 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.
>

\
 
 \ /
  Last update: 2023-04-28 21:33    [W:0.036 / U:1.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site