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

From: Guenter Roeck
Date: Fri Apr 28 2023 - 00:05:43 EST


On 4/27/23 16:16, Joaquin Aramendia wrote:
Hello Guenter and thanks for your quick review.

Please run checkpatch --strict on your patches. Never mind, I'll apply the
patch anyway - I see the other entries are the same.
I've run it before on the other patches... did something change in the
checkpatch?
Nevermid, After this one I may submit a patch to fix all styling in one go

That makes me have a closer look at the code. What is the purpose of the
odd typecast anyway ? Why not just
.driver_data = (void *)aya_neo_2,
and
board = (enum oxp_board)dmi_entry->driver_data;
?
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 ?

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.

Guenter

As a follow up question, since this driver has become more AYANEO than
OXP since its inception,
wouldn't it be better to change the description?

Joaquín Aramendía