Skip to contentSkip to conversation

mfd: cros_ec: Avoid unneeded internal declaration warning

PATCH Applied Nathan Chancellor 3 participants 4 messages Sep 27, 2018 – Oct 9, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: cros_ec: Avoid unneeded internal declaration warning

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.

---

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(+)
drivers/mfd/cros_ec_dev.c +1 -0
index 999dac752bcc..8f9d6964173e 100644
@@ -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,
Signature · 1 line
2.19.0
#1 lore raw
Quoted 42 lines · 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.

---

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(+)
drivers/mfd/cros_ec_dev.c +1 -0
index 999dac752bcc..8f9d6964173e 100644
@@ -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,
Signature · 1 line
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

Applied
#2 lore raw
Quoted 22 lines · Nathan Chancellor
Quoted 21 lines · 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.

---

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.

Quoted 5 lines
Quoted 5 lines

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.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Acked-by
#3 lore raw
In reply to Nathan Chancellor

Quoting Nathan Chancellor (2018-09-27 18:16:14)

Quoted 11 lines · Nathan Chancellor
Quoted 10 lines
drivers/mfd/cros_ec_dev.c +1 -0
index 999dac752bcc..8f9d6964173e 100644
@@ -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,
Quoted 8 lines
Quoted 5 lines
drivers/mfd/cros_ec_dev.c +0 -0
      .remove = ec_device_remove,
      .shutdown = ec_device_shutdown,
Signature · 1 line
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.