Skip to contentSkip to conversation

mfd: cros_ec: remove unused __remove function

PATCH In review Arnd Bergmann 4 participants 6 messages Jun 8, 2018 – Jun 14, 2018

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

PATCH 1/1 mfd: cros_ec: remove unused __remove function

This function is no longer called, so we get a harmless warning until it is removed as well:

drivers/mfd/cros_ec_dev.c:265:13: error: '__remove' defined but not used [-Werror=unused-function]

Fixes 3aa2177e4787 ("mfd: cros_ec: Use devm_kzalloc for private data")
---
 drivers/mfd/cros_ec_dev.c | 2 --
 1 file changed, 2 deletions(-)
drivers/mfd/cros_ec_dev.c +0 -2
index dfc9f131aabe..4199cdd4ff89 100644
@@ -262,8 +262,6 @@ static const struct file_operations fops = {
 #endif
 };
 
-static void __remove(struct device *dev) { }
-
 static void cros_ec_sensors_register(struct cros_ec_dev *ec)
 {
 	/*
Signature · 1 line
2.9.0
#1 lore raw
Quoted 6 lines · Arnd Bergmann

This function is no longer called, so we get a harmless warning until it is removed as well:

drivers/mfd/cros_ec_dev.c:265:13: error: '__remove' defined but not used [-Werror=unused-function]

Fixes 3aa2177e4787 ("mfd: cros_ec: Use devm_kzalloc for private data")

Gwendal, in PATCH v2 of https://patchwork.kernel.org/patch/10439449/
you mentioned that you readded the __remove to avoid a warning when built as a module. Can you explain what's going on?

Benson

Signature · 7 lines
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
[email protected]
Chromium OS Project
[email protected]
#2 lore raw
Quoted 5 lines · Benson Leung
Quoted 3 lines · Arnd Bergmann

This function is no longer called, so we get a harmless warning until it is removed as well:

Quoted 7 lines
Quoted 3 lines

drivers/mfd/cros_ec_dev.c:265:13: error: '__remove' defined but not used [-Werror=unused-function]

Fixes 3aa2177e4787 ("mfd: cros_ec: Use devm_kzalloc for private data")

Gwendal, in PATCH v2 of https://patchwork.kernel.org/patch/10439449/
you mentioned that you readded the __remove to avoid a warning when built as a module. Can you explain what's going on?

Yes please, and quickly. I'm going to sent the patch-set today. If I don't hear from you promptly, I'll probably pull the patch!

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw
Quoted 10 lines · Lee Jones
Quoted 7 lines · Benson Leung
Quoted 5 lines · Arnd Bergmann

This function is no longer called, so we get a harmless warning until it is removed as well:

drivers/mfd/cros_ec_dev.c:265:13: error: '__remove' defined but not used [-Werror=unused-function]

Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Fixes 3aa2177e4787 ("mfd: cros_ec: Use devm_kzalloc for private data")

Gwendal, in PATCH v2 of https://patchwork.kernel.org/patch/10439449/
you mentioned that you readded the __remove to avoid a warning when built as a module. Can you explain what's going on?

Yes please, and quickly. I'm going to sent the patch-set today. If I don't hear from you promptly, I'll probably pull the patch!

I readded it because when cros_ec_dev is loaded as module, I get a warning on dmesg when unloading:

"""Device 'cros_pd' [or 'cros_ec'] does not have a release() function, it is broken and must be fixed."""

The warning comes from device_release(). Given I get a warning when I remove the release function or when I leave it empty. Let's pull the patch.

Sorry for the confusion,

Gwendal.

Quoted 6 lines

--
Lee Jones [李琼斯]
Linaro Services Technical Lead

Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw
Quoted 22 lines · Gwendal Grignou
Quoted 10 lines · Lee Jones
Quoted 7 lines · Benson Leung
Quoted 5 lines · Arnd Bergmann

This function is no longer called, so we get a harmless warning until it is removed as well:

drivers/mfd/cros_ec_dev.c:265:13: error: '__remove' defined but not used [-Werror=unused-function]

Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Fixes 3aa2177e4787 ("mfd: cros_ec: Use devm_kzalloc for private data")

Gwendal, in PATCH v2 of https://patchwork.kernel.org/patch/10439449/
you mentioned that you readded the __remove to avoid a warning when built as a module. Can you explain what's going on?

Yes please, and quickly. I'm going to sent the patch-set today. If I don't hear from you promptly, I'll probably pull the patch!

I readded it because when cros_ec_dev is loaded as module, I get a warning on dmesg when unloading:

Quoted 6 lines

"""Device 'cros_pd' [or 'cros_ec'] does not have a release() function, it is broken and must be fixed."""

The warning comes from device_release(). Given I get a warning when I remove the release function or when I leave it empty. Let's pull the patch.

I already did. It's in Mainline. :)

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#5 lore raw
In reply to Gwendal Grignou
Quoted 22 lines · Gwendal Grignou
Quoted 10 lines · Lee Jones
Quoted 7 lines · Benson Leung
Quoted 5 lines · Arnd Bergmann

This function is no longer called, so we get a harmless warning until it is removed as well:

drivers/mfd/cros_ec_dev.c:265:13: error: '__remove' defined but not used [-Werror=unused-function]

Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Fixes 3aa2177e4787 ("mfd: cros_ec: Use devm_kzalloc for private data")

Gwendal, in PATCH v2 of https://patchwork.kernel.org/patch/10439449/
you mentioned that you readded the __remove to avoid a warning when built as a module. Can you explain what's going on?

Yes please, and quickly. I'm going to sent the patch-set today. If I don't hear from you promptly, I'll probably pull the patch!

I readded it because when cros_ec_dev is loaded as module, I get a warning on dmesg when unloading:

Quoted 6 lines

"""Device 'cros_pd' [or 'cros_ec'] does not have a release() function, it is broken and must be fixed."""

The warning comes from device_release(). Given I get a warning when I remove the release function or when I leave it empty. Let's pull the patch.

I had not realized that this function was supposed to be the .release callback for a device, only that it was not being called at all.

The runtime warning you get is obviously correct and you do need a .release function in the device that will free the memory for the cros_ec_dev structure when the last reference to the device goes away.

Please send a fix for this, replacing the incorrect devm_kzalloc with a working allocation/deallocation.

Arnd