mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Joaquin Aramendia <samsagax@gmail.com>
Cc: derekjohn.clark@gmail.com, jdelvare@suse.com,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (oxp-sensors) Add AYANEO 2 and Geek models
Date: Fri, 28 Apr 2023 12:33:23 -0700	[thread overview]
Message-ID: <fc2989ce-82aa-aa70-cb11-c2cc2fefefcd@roeck-us.net> (raw)
In-Reply-To: <CABgtM3gydDb7gv-GQvu6mMku0KLAM+DSXqd4+FQDsk9jcXV3YA@mail.gmail.com>

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


      reply	other threads:[~2023-04-28 19:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26 18:44 Joaquín Ignacio Aramendía
2023-04-27 17:35 ` Guenter Roeck
2023-04-27 23:16   ` Joaquin Aramendia
2023-04-28  4:05     ` Guenter Roeck
2023-04-28 19:15       ` Joaquin Aramendia
2023-04-28 19:33         ` Guenter Roeck [this message]

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=fc2989ce-82aa-aa70-cb11-c2cc2fefefcd@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=derekjohn.clark@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samsagax@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®