linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: cros_ec: Avoid unneeded internal declaration warning
@ 2018-09-27  3:33 Nathan Chancellor
  2018-09-28  1:16 ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2018-09-27  3:33 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Nathan Chancellor

Clang warns:

drivers/mfd/cros_ec_dev.c:509:40: warning: variable 'cros_ec_id' is not
needed and will not be emitted [-Wunneeded-internal-declaration]
static const struct platform_device_id cros_ec_id[] = {
                                       ^
1 warning generated.

Avoid this warning by adding it to the cros_ec_dev_driver definition
under the id_table member like all other platform drivers.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

I looked at several drivers with platform_device_id defintions and I
didn't really find any where the definition wasn't then added to the
platform_driver so I'm not sure if this was just missed in commit
afbf8ec7c4f9 ("platform/chrome: cros_ec_dev - Add a platform
device ID table") or if it was an intentional omission. I'm not super
familiar with the inner workings of platform devices.

Should this commit be undesirable, the warning can be silenced with the
__used attribute but this seemed like a more proper first commit.

 drivers/mfd/cros_ec_dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index 999dac752bcc..8f9d6964173e 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -546,6 +546,7 @@ static struct platform_driver cros_ec_dev_driver = {
 		.name = DRV_NAME,
 		.pm = &cros_ec_dev_pm_ops,
 	},
+	.id_table = cros_ec_id,
 	.probe = ec_device_probe,
 	.remove = ec_device_remove,
 	.shutdown = ec_device_shutdown,
-- 
2.19.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: cros_ec: Avoid unneeded internal declaration warning
  2018-09-27  3:33 [PATCH] mfd: cros_ec: Avoid unneeded internal declaration warning Nathan Chancellor
@ 2018-09-28  1:16 ` Nathan Chancellor
  2018-10-09 10:09   ` Lee Jones
  2018-10-09 16:15   ` Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2018-09-28  1:16 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Douglas Anderson, Gwendal Grignou, Stephen Boyd,
	Benson Leung, Nick Desaulniers

On Wed, Sep 26, 2018 at 08:33:17PM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/mfd/cros_ec_dev.c:509:40: warning: variable 'cros_ec_id' is not
> needed and will not be emitted [-Wunneeded-internal-declaration]
> static const struct platform_device_id cros_ec_id[] = {
>                                        ^
> 1 warning generated.
> 
> Avoid this warning by adding it to the cros_ec_dev_driver definition
> under the id_table member like all other platform drivers.
> 
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> 
> I looked at several drivers with platform_device_id defintions and I
> didn't really find any where the definition wasn't then added to the
> platform_driver so I'm not sure if this was just missed in commit
> afbf8ec7c4f9 ("platform/chrome: cros_ec_dev - Add a platform
> device ID table") or if it was an intentional omission. I'm not super
> familiar with the inner workings of platform devices.
> 
> Should this commit be undesirable, the warning can be silenced with the
> __used attribute but this seemed like a more proper first commit.
> 
>  drivers/mfd/cros_ec_dev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 999dac752bcc..8f9d6964173e 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -546,6 +546,7 @@ static struct platform_driver cros_ec_dev_driver = {
>  		.name = DRV_NAME,
>  		.pm = &cros_ec_dev_pm_ops,
>  	},
> +	.id_table = cros_ec_id,
>  	.probe = ec_device_probe,
>  	.remove = ec_device_remove,
>  	.shutdown = ec_device_shutdown,
> -- 
> 2.19.0
> 

It just occurred to me I probably should have added some of the Chromium
guys who have modified this driver to this patch. I've done that now.

Nathan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: cros_ec: Avoid unneeded internal declaration warning
  2018-09-28  1:16 ` Nathan Chancellor
@ 2018-10-09 10:09   ` Lee Jones
  2018-10-09 16:15   ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Lee Jones @ 2018-10-09 10:09 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: linux-kernel, Douglas Anderson, Gwendal Grignou, Stephen Boyd,
	Benson Leung, Nick Desaulniers

On Thu, 27 Sep 2018, Nathan Chancellor wrote:

> On Wed, Sep 26, 2018 at 08:33:17PM -0700, Nathan Chancellor wrote:
> > Clang warns:
> > 
> > drivers/mfd/cros_ec_dev.c:509:40: warning: variable 'cros_ec_id' is not
> > needed and will not be emitted [-Wunneeded-internal-declaration]
> > static const struct platform_device_id cros_ec_id[] = {
> >                                        ^
> > 1 warning generated.
> > 
> > Avoid this warning by adding it to the cros_ec_dev_driver definition
> > under the id_table member like all other platform drivers.
> > 
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > 
> > I looked at several drivers with platform_device_id defintions and I
> > didn't really find any where the definition wasn't then added to the
> > platform_driver so I'm not sure if this was just missed in commit
> > afbf8ec7c4f9 ("platform/chrome: cros_ec_dev - Add a platform
> > device ID table") or if it was an intentional omission. I'm not super
> > familiar with the inner workings of platform devices.
> > 
> > Should this commit be undesirable, the warning can be silenced with the
> > __used attribute but this seemed like a more proper first commit.
> > 
> >  drivers/mfd/cros_ec_dev.c | 1 +
> >  1 file changed, 1 insertion(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: cros_ec: Avoid unneeded internal declaration warning
  2018-09-28  1:16 ` Nathan Chancellor
  2018-10-09 10:09   ` Lee Jones
@ 2018-10-09 16:15   ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2018-10-09 16:15 UTC (permalink / raw)
  To: Lee Jones, Nathan Chancellor
  Cc: linux-kernel, Douglas Anderson, Gwendal Grignou, Benson Leung,
	Nick Desaulniers

Quoting Nathan Chancellor (2018-09-27 18:16:14)
> On Wed, Sep 26, 2018 at 08:33:17PM -0700, Nathan Chancellor wrote:
> > diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> > index 999dac752bcc..8f9d6964173e 100644
> > --- a/drivers/mfd/cros_ec_dev.c
> > +++ b/drivers/mfd/cros_ec_dev.c
> > @@ -546,6 +546,7 @@ static struct platform_driver cros_ec_dev_driver = {
> >               .name = DRV_NAME,
> >               .pm = &cros_ec_dev_pm_ops,
> >       },
> > +     .id_table = cros_ec_id,
> >       .probe = ec_device_probe,
> >       .remove = ec_device_remove,
> >       .shutdown = ec_device_shutdown,
> > -- 
> > 2.19.0
> > 
> 
> It just occurred to me I probably should have added some of the Chromium
> guys who have modified this driver to this patch. I've done that now.

Looks OK to me.

Acked-by: Stephen Boyd <swboyd@chromium.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-09 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27  3:33 [PATCH] mfd: cros_ec: Avoid unneeded internal declaration warning Nathan Chancellor
2018-09-28  1:16 ` Nathan Chancellor
2018-10-09 10:09   ` Lee Jones
2018-10-09 16:15   ` Stephen Boyd

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