Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/x86: wmi: Make remove callback return void

The driver core ignores the return value of struct bus_type::remove()
(and so wmi_dev_remove()) because there is only little that can be done.

To simplify the quest to make this function return void, let struct
wmi_driver::remove() return void, too. All implementers of this callback
return 0 already and this way it should be obvious to driver authors
that returning an error code is a bad idea.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20210301160404.1677064-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Uwe Kleine-König and committed by
Hans de Goede
2b329f56 24789075

+11 -20
+1 -2
drivers/platform/x86/dell/dell-smbios-wmi.c
··· 205 205 return ret; 206 206 } 207 207 208 - static int dell_smbios_wmi_remove(struct wmi_device *wdev) 208 + static void dell_smbios_wmi_remove(struct wmi_device *wdev) 209 209 { 210 210 struct wmi_smbios_priv *priv = dev_get_drvdata(&wdev->dev); 211 211 int count; ··· 218 218 count = get_order(priv->req_buf_size); 219 219 free_pages((unsigned long)priv->buf, count); 220 220 mutex_unlock(&call_mutex); 221 - return 0; 222 221 } 223 222 224 223 static const struct wmi_device_id dell_smbios_wmi_id_table[] = {
+1 -2
drivers/platform/x86/dell/dell-wmi-descriptor.c
··· 174 174 return ret; 175 175 } 176 176 177 - static int dell_wmi_descriptor_remove(struct wmi_device *wdev) 177 + static void dell_wmi_descriptor_remove(struct wmi_device *wdev) 178 178 { 179 179 struct descriptor_priv *priv = dev_get_drvdata(&wdev->dev); 180 180 181 181 mutex_lock(&list_mutex); 182 182 list_del(&priv->list); 183 183 mutex_unlock(&list_mutex); 184 - return 0; 185 184 } 186 185 187 186 static const struct wmi_device_id dell_wmi_descriptor_id_table[] = {
+1 -2
drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c
··· 152 152 return 0; 153 153 } 154 154 155 - static int bios_attr_set_interface_remove(struct wmi_device *wdev) 155 + static void bios_attr_set_interface_remove(struct wmi_device *wdev) 156 156 { 157 157 mutex_lock(&wmi_priv.mutex); 158 158 wmi_priv.bios_attr_wdev = NULL; 159 159 mutex_unlock(&wmi_priv.mutex); 160 - return 0; 161 160 } 162 161 163 162 static const struct wmi_device_id bios_attr_set_interface_id_table[] = {
+1 -2
drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c
··· 119 119 return 0; 120 120 } 121 121 122 - static int bios_attr_pass_interface_remove(struct wmi_device *wdev) 122 + static void bios_attr_pass_interface_remove(struct wmi_device *wdev) 123 123 { 124 124 mutex_lock(&wmi_priv.mutex); 125 125 wmi_priv.password_attr_wdev = NULL; 126 126 mutex_unlock(&wmi_priv.mutex); 127 - return 0; 128 127 } 129 128 130 129 static const struct wmi_device_id bios_attr_pass_interface_id_table[] = {
+1 -2
drivers/platform/x86/dell/dell-wmi.c
··· 714 714 return dell_wmi_input_setup(wdev); 715 715 } 716 716 717 - static int dell_wmi_remove(struct wmi_device *wdev) 717 + static void dell_wmi_remove(struct wmi_device *wdev) 718 718 { 719 719 dell_wmi_input_destroy(wdev); 720 - return 0; 721 720 } 722 721 static const struct wmi_device_id dell_wmi_id_table[] = { 723 722 { .guid_string = DELL_EVENT_GUID },
+1 -2
drivers/platform/x86/intel-wmi-sbl-fw-update.c
··· 117 117 return 0; 118 118 } 119 119 120 - static int intel_wmi_sbl_fw_update_remove(struct wmi_device *wdev) 120 + static void intel_wmi_sbl_fw_update_remove(struct wmi_device *wdev) 121 121 { 122 122 dev_info(&wdev->dev, "Slim Bootloader signaling driver removed\n"); 123 - return 0; 124 123 } 125 124 126 125 static const struct wmi_device_id intel_wmi_sbl_id_table[] = {
+1 -2
drivers/platform/x86/intel-wmi-thunderbolt.c
··· 66 66 return ret; 67 67 } 68 68 69 - static int intel_wmi_thunderbolt_remove(struct wmi_device *wdev) 69 + static void intel_wmi_thunderbolt_remove(struct wmi_device *wdev) 70 70 { 71 71 sysfs_remove_group(&wdev->dev.kobj, &tbt_attribute_group); 72 72 kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE); 73 - return 0; 74 73 } 75 74 76 75 static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = {
+1 -2
drivers/platform/x86/wmi-bmof.c
··· 86 86 return ret; 87 87 } 88 88 89 - static int wmi_bmof_remove(struct wmi_device *wdev) 89 + static void wmi_bmof_remove(struct wmi_device *wdev) 90 90 { 91 91 struct bmof_priv *priv = dev_get_drvdata(&wdev->dev); 92 92 93 93 sysfs_remove_bin_file(&wdev->dev.kobj, &priv->bmof_bin_attr); 94 94 kfree(priv->bmofdata); 95 - return 0; 96 95 } 97 96 98 97 static const struct wmi_device_id wmi_bmof_id_table[] = {
+2 -3
drivers/platform/x86/wmi.c
··· 985 985 struct wmi_block *wblock = dev_to_wblock(dev); 986 986 struct wmi_driver *wdriver = 987 987 container_of(dev->driver, struct wmi_driver, driver); 988 - int ret = 0; 989 988 990 989 if (wdriver->filter_callback) { 991 990 misc_deregister(&wblock->char_dev); ··· 993 994 } 994 995 995 996 if (wdriver->remove) 996 - ret = wdriver->remove(dev_to_wdev(dev)); 997 + wdriver->remove(dev_to_wdev(dev)); 997 998 998 999 if (ACPI_FAILURE(wmi_method_enable(wblock, 0))) 999 1000 dev_warn(dev, "failed to disable device\n"); 1000 1001 1001 - return ret; 1002 + return 0; 1002 1003 } 1003 1004 1004 1005 static struct class wmi_bus_class = {
+1 -1
include/linux/wmi.h
··· 37 37 const struct wmi_device_id *id_table; 38 38 39 39 int (*probe)(struct wmi_device *wdev, const void *context); 40 - int (*remove)(struct wmi_device *wdev); 40 + void (*remove)(struct wmi_device *wdev); 41 41 void (*notify)(struct wmi_device *device, union acpi_object *data); 42 42 long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd, 43 43 struct wmi_ioctl_buffer *arg);