linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Michael Ellerman <mpe@ellerman.id.au>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 3/3] macintosh/ams: Fix unused variable warning
Date: Thu, 7 Mar 2024 06:29:02 +0000	[thread overview]
Message-ID: <425898fd-151c-4b49-87e2-d18b8650cdf5@csgroup.eu> (raw)
In-Reply-To: <87plw6obdq.fsf@mail.lhotse>



Le 07/03/2024 à 06:32, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> Le 06/03/2024 à 13:58, Michael Ellerman a écrit :
>>> If both CONFIG_SENSORS_AMS_PMU and CONFIG_SENSORS_AMS_I2C are unset,
>>> there is an unused variable warning in the ams driver:
>>>
>>>     drivers/macintosh/ams/ams-core.c: In function 'ams_init':
>>>     drivers/macintosh/ams/ams-core.c:181:29: warning: unused variable 'np'
>>>       181 |         struct device_node *np;
>>>
>>> Fix it by using IS_ENABLED() to create a block for each case, and move
>>> the variable declartion in there.
>>>
>>> Probably the dependencies should be changed so that the driver can't be
>>> built with both variants disabled, but that would be a larger change.
>>
>> Can be done easily that way I think:
>>
>> diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
>> index a0e717a986dc..fb38f684444f 100644
>> --- a/drivers/macintosh/Kconfig
>> +++ b/drivers/macintosh/Kconfig
>> @@ -262,7 +262,7 @@ config SENSORS_AMS
>>    	  will be called ams.
>>
>>    config SENSORS_AMS_PMU
>> -	bool "PMU variant"
>> +	bool "PMU variant" if SENSORS_AMS_I2C
>>    	depends on SENSORS_AMS && ADB_PMU
>>    	default y
>>    	help
> 
> Thanks. It's a little clunky. For example if you answer no to both
> prompts, it still selects SENSORS_AMS_PMU, but I guess it doesn't really
> matter.
> 
>    $ make oldconfig
>    ...
>      Apple Motion Sensor driver (SENSORS_AMS) [N/m/y/?] (NEW) y
>        PMU variant (SENSORS_AMS_PMU) [Y/n/?] (NEW) n
>        I2C variant (SENSORS_AMS_I2C) [Y/n/?] (NEW) n
>    #
>    # configuration written to .config
>    #
>    make[1]: Leaving directory '/home/michael/linux/.build'
>    
>    $ grep SENSORS_AMS .build/.config
>    CONFIG_SENSORS_AMS=y
>    CONFIG_SENSORS_AMS_PMU=y
>    # CONFIG_SENSORS_AMS_I2C is not set
> 
> 
> I'll turn to this into a patch and add your SoB?

That's fine for me.

You can alternatively use Suggested-by: , I don't really mind.

Thanks
Christophe

  reply	other threads:[~2024-03-07  6:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 12:58 [PATCH 1/3] powerpc/64s: Fix get_hugepd_cache_index() build failure Michael Ellerman
2024-03-06 12:58 ` [PATCH 2/3] powerpc/83xx: Fix build failure with FPU=n Michael Ellerman
2024-03-06 12:58 ` [PATCH 3/3] macintosh/ams: Fix unused variable warning Michael Ellerman
2024-03-06 13:17   ` Christophe Leroy
2024-03-07  5:32     ` Michael Ellerman
2024-03-07  6:29       ` Christophe Leroy [this message]
2024-03-13 13:19 ` (subset) [PATCH 1/3] powerpc/64s: Fix get_hugepd_cache_index() build failure Michael Ellerman

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=425898fd-151c-4b49-87e2-d18b8650cdf5@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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;
as well as URLs for NNTP newsgroup(s).