From: Greg Kroah-Hartman Date: Tue, 29 Apr 2025 12:38:58 +0000 (+0200) Subject: drop some unneedd 5.10 patches X-Git-Tag: v5.4.293~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=886adc800887d1b2c0926c7a8ec77e2486d94cdc;p=thirdparty%2Fkernel%2Fstable-queue.git drop some unneedd 5.10 patches --- diff --git a/queue-5.10/backlight-led_bl-convert-to-platform-remove-callback.patch b/queue-5.10/backlight-led_bl-convert-to-platform-remove-callback.patch deleted file mode 100644 index 2051e9ab60..0000000000 --- a/queue-5.10/backlight-led_bl-convert-to-platform-remove-callback.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 1e8aad01d355754c5ec31df0bc8297af773c77da Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 8 Mar 2023 08:39:38 +0100 -Subject: backlight: led_bl: Convert to platform remove callback returning void -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Uwe Kleine-König - -[ Upstream commit c4c4fa57fd3cc00020152baa169337521f90b2ad ] - -The .remove() callback for a platform driver returns an int which makes -many driver authors wrongly assume it's possible to do error handling by -returning an error code. However the value returned is (mostly) ignored -and this typically results in resource leaks. To improve here there is a -quest to make the remove callback return void. In the first step of this -quest all drivers are converted to .remove_new() which already returns -void. - -Trivially convert this driver from always returning zero in the remove -callback to the void returning variant. - -Signed-off-by: Uwe Kleine-König -Reviewed-by: Daniel Thompson -Signed-off-by: Lee Jones -Link: https://lore.kernel.org/r/20230308073945.2336302-7-u.kleine-koenig@pengutronix.de -Stable-dep-of: 276822a00db3 ("backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()") -Signed-off-by: Sasha Levin ---- - drivers/video/backlight/led_bl.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c -index f54d256e2d548..a1b6a2ad73a07 100644 ---- a/drivers/video/backlight/led_bl.c -+++ b/drivers/video/backlight/led_bl.c -@@ -217,7 +217,7 @@ static int led_bl_probe(struct platform_device *pdev) - return 0; - } - --static int led_bl_remove(struct platform_device *pdev) -+static void led_bl_remove(struct platform_device *pdev) - { - struct led_bl_data *priv = platform_get_drvdata(pdev); - struct backlight_device *bl = priv->bl_dev; -@@ -228,8 +228,6 @@ static int led_bl_remove(struct platform_device *pdev) - led_bl_power_off(priv); - for (i = 0; i < priv->nb_leds; i++) - led_sysfs_enable(priv->leds[i]); -- -- return 0; - } - - static const struct of_device_id led_bl_of_match[] = { -@@ -245,7 +243,7 @@ static struct platform_driver led_bl_driver = { - .of_match_table = of_match_ptr(led_bl_of_match), - }, - .probe = led_bl_probe, -- .remove = led_bl_remove, -+ .remove_new = led_bl_remove, - }; - - module_platform_driver(led_bl_driver); --- -2.39.5 - diff --git a/queue-5.10/backlight-led_bl-hold-led_access-lock-when-calling-l.patch b/queue-5.10/backlight-led_bl-hold-led_access-lock-when-calling-l.patch index a89e398a6b..f09ca12b49 100644 --- a/queue-5.10/backlight-led_bl-hold-led_access-lock-when-calling-l.patch +++ b/queue-5.10/backlight-led_bl-hold-led_access-lock-when-calling-l.patch @@ -31,14 +31,12 @@ Link: https://lore.kernel.org/r/20250122091914.309533-1-herve.codina@bootlin.com Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- - drivers/video/backlight/led_bl.c | 5 ++++- + drivers/video/backlight/led_bl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c -index a1b6a2ad73a07..589dae9ebb638 100644 --- a/drivers/video/backlight/led_bl.c +++ b/drivers/video/backlight/led_bl.c -@@ -226,8 +226,11 @@ static void led_bl_remove(struct platform_device *pdev) +@@ -226,8 +226,11 @@ static int led_bl_remove(struct platform backlight_device_unregister(bl); led_bl_power_off(priv); @@ -48,9 +46,6 @@ index a1b6a2ad73a07..589dae9ebb638 100644 led_sysfs_enable(priv->leds[i]); + mutex_unlock(&priv->leds[i]->led_access); + } - } - static const struct of_device_id led_bl_of_match[] = { --- -2.39.5 - + return 0; + } diff --git a/queue-5.10/driver-core-platform-change-logic-implementing-platf.patch b/queue-5.10/driver-core-platform-change-logic-implementing-platf.patch deleted file mode 100644 index 92a89de60b..0000000000 --- a/queue-5.10/driver-core-platform-change-logic-implementing-platf.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 5cae0e026c8b364f338819cb26b34cb3ecc51fad Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 19 Nov 2020 13:46:10 +0100 -Subject: driver core: platform: change logic implementing - platform_driver_probe -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Uwe Kleine-König - -[ Upstream commit 16085668eacdc56c46652d0f3bfef81ecace57de ] - -Instead of overwriting the core driver's probe function handle probing -devices for drivers loaded by platform_driver_probe() in the platform -driver probe function. - -The intended goal is to not have to change the probe function to -simplify converting the platform bus to use bus functions. - -Signed-off-by: Uwe Kleine-König -Link: https://lore.kernel.org/r/20201119124611.2573057-2-u.kleine-koenig@pengutronix.de -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: 276822a00db3 ("backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()") -Signed-off-by: Sasha Levin ---- - drivers/base/platform.c | 18 +++++++++++++++--- - 1 file changed, 15 insertions(+), 3 deletions(-) - -diff --git a/drivers/base/platform.c b/drivers/base/platform.c -index fa023cf80dc48..16426eb934632 100644 ---- a/drivers/base/platform.c -+++ b/drivers/base/platform.c -@@ -743,12 +743,25 @@ struct platform_device *platform_device_register_full( - } - EXPORT_SYMBOL_GPL(platform_device_register_full); - -+static int platform_probe_fail(struct platform_device *pdev); -+ - static int platform_drv_probe(struct device *_dev) - { - struct platform_driver *drv = to_platform_driver(_dev->driver); - struct platform_device *dev = to_platform_device(_dev); - int ret; - -+ /* -+ * A driver registered using platform_driver_probe() cannot be bound -+ * again later because the probe function usually lives in __init code -+ * and so is gone. For these drivers .probe is set to -+ * platform_probe_fail in __platform_driver_probe(). Don't even -+ * prepare clocks and PM domains for these to match the traditional -+ * behaviour. -+ */ -+ if (unlikely(drv->probe == platform_probe_fail)) -+ return -ENXIO; -+ - ret = of_clk_set_defaults(_dev->of_node, false); - if (ret < 0) - return ret; -@@ -822,7 +835,7 @@ void platform_driver_unregister(struct platform_driver *drv) - } - EXPORT_SYMBOL_GPL(platform_driver_unregister); - --static int platform_drv_probe_fail(struct device *_dev) -+static int platform_probe_fail(struct platform_device *pdev) - { - return -ENXIO; - } -@@ -887,10 +900,9 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv, - * new devices fail. - */ - spin_lock(&drv->driver.bus->p->klist_drivers.k_lock); -- drv->probe = NULL; -+ drv->probe = platform_probe_fail; - if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list)) - retval = -ENODEV; -- drv->driver.probe = platform_drv_probe_fail; - spin_unlock(&drv->driver.bus->p->klist_drivers.k_lock); - - if (code != retval) --- -2.39.5 - diff --git a/queue-5.10/driver-core-platform-emit-a-warning-if-a-remove-call.patch b/queue-5.10/driver-core-platform-emit-a-warning-if-a-remove-call.patch deleted file mode 100644 index 00ab6dbbb2..0000000000 --- a/queue-5.10/driver-core-platform-emit-a-warning-if-a-remove-call.patch +++ /dev/null @@ -1,60 +0,0 @@ -From be789066e7a8cf1d42fae45038e28a7663cbc213 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 7 Feb 2021 22:15:37 +0100 -Subject: driver core: platform: Emit a warning if a remove callback returned - non-zero -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Uwe Kleine-König - -[ Upstream commit e5e1c209788138f33ca6558bf9f572f6904f486d ] - -The driver core ignores the return value of a bus' remove callback. However -a driver returning an error code is a hint that there is a problem, -probably a driver author who expects that returning e.g. -EBUSY has any -effect. - -The right thing to do would be to make struct platform_driver::remove() -return void. With the immense number of platform drivers this is however a -big quest and I hope to prevent at least a few new drivers that return an -error code here. - -Signed-off-by: Uwe Kleine-König -Link: https://lore.kernel.org/r/20210207211537.19992-1-uwe@kleine-koenig.org -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: 276822a00db3 ("backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()") -Signed-off-by: Sasha Levin ---- - drivers/base/platform.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/drivers/base/platform.c b/drivers/base/platform.c -index 90166535a5c05..d0b15cbab0ff0 100644 ---- a/drivers/base/platform.c -+++ b/drivers/base/platform.c -@@ -1305,13 +1305,16 @@ static int platform_remove(struct device *_dev) - { - struct platform_driver *drv = to_platform_driver(_dev->driver); - struct platform_device *dev = to_platform_device(_dev); -- int ret = 0; - -- if (drv->remove) -- ret = drv->remove(dev); -+ if (drv->remove) { -+ int ret = drv->remove(dev); -+ -+ if (ret) -+ dev_warn(_dev, "remove callback returned a non-zero value. This will be ignored.\n"); -+ } - dev_pm_domain_detach(_dev, true); - -- return ret; -+ return 0; - } - - static void platform_shutdown(struct device *_dev) --- -2.39.5 - diff --git a/queue-5.10/driver-core-platform-reorder-functions.patch b/queue-5.10/driver-core-platform-reorder-functions.patch deleted file mode 100644 index 934cbdaf39..0000000000 --- a/queue-5.10/driver-core-platform-reorder-functions.patch +++ /dev/null @@ -1,361 +0,0 @@ -From 755c0725a3eaa804db5be07cd930b3d0e59648fc Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 19 Nov 2020 13:46:09 +0100 -Subject: driver core: platform: reorder functions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Uwe Kleine-König - -[ Upstream commit e21d740a3fe5ad2db7b5f5c2331fe2b713b1edba ] - -This way all callbacks and structures used to initialize -platform_bus_type are defined just before platform_bus_type and in the -same order. Also move platform_drv_probe_fail just before it's only -user. - -Signed-off-by: Uwe Kleine-König -Link: https://lore.kernel.org/r/20201119124611.2573057-1-u.kleine-koenig@pengutronix.de -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: 276822a00db3 ("backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()") -Signed-off-by: Sasha Levin ---- - drivers/base/platform.c | 293 ++++++++++++++++++++-------------------- - 1 file changed, 147 insertions(+), 146 deletions(-) - -diff --git a/drivers/base/platform.c b/drivers/base/platform.c -index 647066229fec3..fa023cf80dc48 100644 ---- a/drivers/base/platform.c -+++ b/drivers/base/platform.c -@@ -772,11 +772,6 @@ static int platform_drv_probe(struct device *_dev) - return ret; - } - --static int platform_drv_probe_fail(struct device *_dev) --{ -- return -ENXIO; --} -- - static int platform_drv_remove(struct device *_dev) - { - struct platform_driver *drv = to_platform_driver(_dev->driver); -@@ -827,6 +822,11 @@ void platform_driver_unregister(struct platform_driver *drv) - } - EXPORT_SYMBOL_GPL(platform_driver_unregister); - -+static int platform_drv_probe_fail(struct device *_dev) -+{ -+ return -ENXIO; -+} -+ - /** - * __platform_driver_probe - register driver for non-hotpluggable device - * @drv: platform driver structure -@@ -1017,109 +1017,6 @@ void platform_unregister_drivers(struct platform_driver * const *drivers, - } - EXPORT_SYMBOL_GPL(platform_unregister_drivers); - --/* modalias support enables more hands-off userspace setup: -- * (a) environment variable lets new-style hotplug events work once system is -- * fully running: "modprobe $MODALIAS" -- * (b) sysfs attribute lets new-style coldplug recover from hotplug events -- * mishandled before system is fully running: "modprobe $(cat modalias)" -- */ --static ssize_t modalias_show(struct device *dev, -- struct device_attribute *attr, char *buf) --{ -- struct platform_device *pdev = to_platform_device(dev); -- int len; -- -- len = of_device_modalias(dev, buf, PAGE_SIZE); -- if (len != -ENODEV) -- return len; -- -- len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1); -- if (len != -ENODEV) -- return len; -- -- return sysfs_emit(buf, "platform:%s\n", pdev->name); --} --static DEVICE_ATTR_RO(modalias); -- --static ssize_t driver_override_store(struct device *dev, -- struct device_attribute *attr, -- const char *buf, size_t count) --{ -- struct platform_device *pdev = to_platform_device(dev); -- int ret; -- -- ret = driver_set_override(dev, &pdev->driver_override, buf, count); -- if (ret) -- return ret; -- -- return count; --} -- --static ssize_t driver_override_show(struct device *dev, -- struct device_attribute *attr, char *buf) --{ -- struct platform_device *pdev = to_platform_device(dev); -- ssize_t len; -- -- device_lock(dev); -- len = sysfs_emit(buf, "%s\n", pdev->driver_override); -- device_unlock(dev); -- -- return len; --} --static DEVICE_ATTR_RW(driver_override); -- --static ssize_t numa_node_show(struct device *dev, -- struct device_attribute *attr, char *buf) --{ -- return sysfs_emit(buf, "%d\n", dev_to_node(dev)); --} --static DEVICE_ATTR_RO(numa_node); -- --static umode_t platform_dev_attrs_visible(struct kobject *kobj, struct attribute *a, -- int n) --{ -- struct device *dev = container_of(kobj, typeof(*dev), kobj); -- -- if (a == &dev_attr_numa_node.attr && -- dev_to_node(dev) == NUMA_NO_NODE) -- return 0; -- -- return a->mode; --} -- --static struct attribute *platform_dev_attrs[] = { -- &dev_attr_modalias.attr, -- &dev_attr_numa_node.attr, -- &dev_attr_driver_override.attr, -- NULL, --}; -- --static struct attribute_group platform_dev_group = { -- .attrs = platform_dev_attrs, -- .is_visible = platform_dev_attrs_visible, --}; --__ATTRIBUTE_GROUPS(platform_dev); -- --static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) --{ -- struct platform_device *pdev = to_platform_device(dev); -- int rc; -- -- /* Some devices have extra OF data and an OF-style MODALIAS */ -- rc = of_device_uevent_modalias(dev, env); -- if (rc != -ENODEV) -- return rc; -- -- rc = acpi_device_uevent_modalias(dev, env); -- if (rc != -ENODEV) -- return rc; -- -- add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX, -- pdev->name); -- return 0; --} -- - static const struct platform_device_id *platform_match_id( - const struct platform_device_id *id, - struct platform_device *pdev) -@@ -1134,44 +1031,6 @@ static const struct platform_device_id *platform_match_id( - return NULL; - } - --/** -- * platform_match - bind platform device to platform driver. -- * @dev: device. -- * @drv: driver. -- * -- * Platform device IDs are assumed to be encoded like this: -- * "", where is a short description of the type of -- * device, like "pci" or "floppy", and is the enumerated -- * instance of the device, like '0' or '42'. Driver IDs are simply -- * "". So, extract the from the platform_device structure, -- * and compare it against the name of the driver. Return whether they match -- * or not. -- */ --static int platform_match(struct device *dev, struct device_driver *drv) --{ -- struct platform_device *pdev = to_platform_device(dev); -- struct platform_driver *pdrv = to_platform_driver(drv); -- -- /* When driver_override is set, only bind to the matching driver */ -- if (pdev->driver_override) -- return !strcmp(pdev->driver_override, drv->name); -- -- /* Attempt an OF style match first */ -- if (of_driver_match_device(dev, drv)) -- return 1; -- -- /* Then try ACPI style match */ -- if (acpi_driver_match_device(dev, drv)) -- return 1; -- -- /* Then try to match against the id table */ -- if (pdrv->id_table) -- return platform_match_id(pdrv->id_table, pdev) != NULL; -- -- /* fall-back to driver name match */ -- return (strcmp(pdev->name, drv->name) == 0); --} -- - #ifdef CONFIG_PM_SLEEP - - static int platform_legacy_suspend(struct device *dev, pm_message_t mesg) -@@ -1316,6 +1175,148 @@ int platform_pm_restore(struct device *dev) - - #endif /* CONFIG_HIBERNATE_CALLBACKS */ - -+/* modalias support enables more hands-off userspace setup: -+ * (a) environment variable lets new-style hotplug events work once system is -+ * fully running: "modprobe $MODALIAS" -+ * (b) sysfs attribute lets new-style coldplug recover from hotplug events -+ * mishandled before system is fully running: "modprobe $(cat modalias)" -+ */ -+static ssize_t modalias_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ int len; -+ -+ len = of_device_modalias(dev, buf, PAGE_SIZE); -+ if (len != -ENODEV) -+ return len; -+ -+ len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1); -+ if (len != -ENODEV) -+ return len; -+ -+ return sysfs_emit(buf, "platform:%s\n", pdev->name); -+} -+static DEVICE_ATTR_RO(modalias); -+ -+static ssize_t numa_node_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ return sysfs_emit(buf, "%d\n", dev_to_node(dev)); -+} -+static DEVICE_ATTR_RO(numa_node); -+ -+static ssize_t driver_override_show(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ ssize_t len; -+ -+ device_lock(dev); -+ len = sysfs_emit(buf, "%s\n", pdev->driver_override); -+ device_unlock(dev); -+ -+ return len; -+} -+ -+static ssize_t driver_override_store(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ int ret; -+ -+ ret = driver_set_override(dev, &pdev->driver_override, buf, count); -+ if (ret) -+ return ret; -+ -+ return count; -+} -+static DEVICE_ATTR_RW(driver_override); -+ -+static struct attribute *platform_dev_attrs[] = { -+ &dev_attr_modalias.attr, -+ &dev_attr_numa_node.attr, -+ &dev_attr_driver_override.attr, -+ NULL, -+}; -+ -+static umode_t platform_dev_attrs_visible(struct kobject *kobj, struct attribute *a, -+ int n) -+{ -+ struct device *dev = container_of(kobj, typeof(*dev), kobj); -+ -+ if (a == &dev_attr_numa_node.attr && -+ dev_to_node(dev) == NUMA_NO_NODE) -+ return 0; -+ -+ return a->mode; -+} -+ -+static struct attribute_group platform_dev_group = { -+ .attrs = platform_dev_attrs, -+ .is_visible = platform_dev_attrs_visible, -+}; -+__ATTRIBUTE_GROUPS(platform_dev); -+ -+ -+/** -+ * platform_match - bind platform device to platform driver. -+ * @dev: device. -+ * @drv: driver. -+ * -+ * Platform device IDs are assumed to be encoded like this: -+ * "", where is a short description of the type of -+ * device, like "pci" or "floppy", and is the enumerated -+ * instance of the device, like '0' or '42'. Driver IDs are simply -+ * "". So, extract the from the platform_device structure, -+ * and compare it against the name of the driver. Return whether they match -+ * or not. -+ */ -+static int platform_match(struct device *dev, struct device_driver *drv) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ struct platform_driver *pdrv = to_platform_driver(drv); -+ -+ /* When driver_override is set, only bind to the matching driver */ -+ if (pdev->driver_override) -+ return !strcmp(pdev->driver_override, drv->name); -+ -+ /* Attempt an OF style match first */ -+ if (of_driver_match_device(dev, drv)) -+ return 1; -+ -+ /* Then try ACPI style match */ -+ if (acpi_driver_match_device(dev, drv)) -+ return 1; -+ -+ /* Then try to match against the id table */ -+ if (pdrv->id_table) -+ return platform_match_id(pdrv->id_table, pdev) != NULL; -+ -+ /* fall-back to driver name match */ -+ return (strcmp(pdev->name, drv->name) == 0); -+} -+ -+static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) -+{ -+ struct platform_device *pdev = to_platform_device(dev); -+ int rc; -+ -+ /* Some devices have extra OF data and an OF-style MODALIAS */ -+ rc = of_device_uevent_modalias(dev, env); -+ if (rc != -ENODEV) -+ return rc; -+ -+ rc = acpi_device_uevent_modalias(dev, env); -+ if (rc != -ENODEV) -+ return rc; -+ -+ add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX, -+ pdev->name); -+ return 0; -+} -+ - int platform_dma_configure(struct device *dev) - { - enum dev_dma_attr attr; --- -2.39.5 - diff --git a/queue-5.10/driver-core-platform-use-bus_type-functions.patch b/queue-5.10/driver-core-platform-use-bus_type-functions.patch deleted file mode 100644 index e73fab0a54..0000000000 --- a/queue-5.10/driver-core-platform-use-bus_type-functions.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 9d1ddcb33799b6b3c278d2c440ec242db06cc644 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 19 Nov 2020 13:46:11 +0100 -Subject: driver core: platform: use bus_type functions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Uwe Kleine-König - -[ Upstream commit 9c30921fe7994907e0b3e0637b2c8c0fc4b5171f ] - -This works towards the goal mentioned in 2006 in commit 594c8281f905 -("[PATCH] Add bus_type probe, remove, shutdown methods."). - -The functions are moved to where the other bus_type functions are -defined and renamed to match the already established naming scheme. - -Signed-off-by: Uwe Kleine-König -Link: https://lore.kernel.org/r/20201119124611.2573057-3-u.kleine-koenig@pengutronix.de -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: 276822a00db3 ("backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()") -Signed-off-by: Sasha Levin ---- - drivers/base/platform.c | 132 ++++++++++++++++++++-------------------- - 1 file changed, 65 insertions(+), 67 deletions(-) - -diff --git a/drivers/base/platform.c b/drivers/base/platform.c -index 16426eb934632..90166535a5c05 100644 ---- a/drivers/base/platform.c -+++ b/drivers/base/platform.c -@@ -743,70 +743,6 @@ struct platform_device *platform_device_register_full( - } - EXPORT_SYMBOL_GPL(platform_device_register_full); - --static int platform_probe_fail(struct platform_device *pdev); -- --static int platform_drv_probe(struct device *_dev) --{ -- struct platform_driver *drv = to_platform_driver(_dev->driver); -- struct platform_device *dev = to_platform_device(_dev); -- int ret; -- -- /* -- * A driver registered using platform_driver_probe() cannot be bound -- * again later because the probe function usually lives in __init code -- * and so is gone. For these drivers .probe is set to -- * platform_probe_fail in __platform_driver_probe(). Don't even -- * prepare clocks and PM domains for these to match the traditional -- * behaviour. -- */ -- if (unlikely(drv->probe == platform_probe_fail)) -- return -ENXIO; -- -- ret = of_clk_set_defaults(_dev->of_node, false); -- if (ret < 0) -- return ret; -- -- ret = dev_pm_domain_attach(_dev, true); -- if (ret) -- goto out; -- -- if (drv->probe) { -- ret = drv->probe(dev); -- if (ret) -- dev_pm_domain_detach(_dev, true); -- } -- --out: -- if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) { -- dev_warn(_dev, "probe deferral not supported\n"); -- ret = -ENXIO; -- } -- -- return ret; --} -- --static int platform_drv_remove(struct device *_dev) --{ -- struct platform_driver *drv = to_platform_driver(_dev->driver); -- struct platform_device *dev = to_platform_device(_dev); -- int ret = 0; -- -- if (drv->remove) -- ret = drv->remove(dev); -- dev_pm_domain_detach(_dev, true); -- -- return ret; --} -- --static void platform_drv_shutdown(struct device *_dev) --{ -- struct platform_driver *drv = to_platform_driver(_dev->driver); -- struct platform_device *dev = to_platform_device(_dev); -- -- if (drv->shutdown) -- drv->shutdown(dev); --} -- - /** - * __platform_driver_register - register a driver for platform-level devices - * @drv: platform driver structure -@@ -817,9 +753,6 @@ int __platform_driver_register(struct platform_driver *drv, - { - drv->driver.owner = owner; - drv->driver.bus = &platform_bus_type; -- drv->driver.probe = platform_drv_probe; -- drv->driver.remove = platform_drv_remove; -- drv->driver.shutdown = platform_drv_shutdown; - - return driver_register(&drv->driver); - } -@@ -1329,6 +1262,68 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) - return 0; - } - -+static int platform_probe(struct device *_dev) -+{ -+ struct platform_driver *drv = to_platform_driver(_dev->driver); -+ struct platform_device *dev = to_platform_device(_dev); -+ int ret; -+ -+ /* -+ * A driver registered using platform_driver_probe() cannot be bound -+ * again later because the probe function usually lives in __init code -+ * and so is gone. For these drivers .probe is set to -+ * platform_probe_fail in __platform_driver_probe(). Don't even prepare -+ * clocks and PM domains for these to match the traditional behaviour. -+ */ -+ if (unlikely(drv->probe == platform_probe_fail)) -+ return -ENXIO; -+ -+ ret = of_clk_set_defaults(_dev->of_node, false); -+ if (ret < 0) -+ return ret; -+ -+ ret = dev_pm_domain_attach(_dev, true); -+ if (ret) -+ goto out; -+ -+ if (drv->probe) { -+ ret = drv->probe(dev); -+ if (ret) -+ dev_pm_domain_detach(_dev, true); -+ } -+ -+out: -+ if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) { -+ dev_warn(_dev, "probe deferral not supported\n"); -+ ret = -ENXIO; -+ } -+ -+ return ret; -+} -+ -+static int platform_remove(struct device *_dev) -+{ -+ struct platform_driver *drv = to_platform_driver(_dev->driver); -+ struct platform_device *dev = to_platform_device(_dev); -+ int ret = 0; -+ -+ if (drv->remove) -+ ret = drv->remove(dev); -+ dev_pm_domain_detach(_dev, true); -+ -+ return ret; -+} -+ -+static void platform_shutdown(struct device *_dev) -+{ -+ struct platform_driver *drv = to_platform_driver(_dev->driver); -+ struct platform_device *dev = to_platform_device(_dev); -+ -+ if (drv->shutdown) -+ drv->shutdown(dev); -+} -+ -+ - int platform_dma_configure(struct device *dev) - { - enum dev_dma_attr attr; -@@ -1355,6 +1350,9 @@ struct bus_type platform_bus_type = { - .dev_groups = platform_dev_groups, - .match = platform_match, - .uevent = platform_uevent, -+ .probe = platform_probe, -+ .remove = platform_remove, -+ .shutdown = platform_shutdown, - .dma_configure = platform_dma_configure, - .pm = &platform_dev_pm_ops, - }; --- -2.39.5 - diff --git a/queue-5.10/platform-provide-a-remove-callback-that-returns-no-v.patch b/queue-5.10/platform-provide-a-remove-callback-that-returns-no-v.patch deleted file mode 100644 index 44a6c7527d..0000000000 --- a/queue-5.10/platform-provide-a-remove-callback-that-returns-no-v.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 9a4cc968fa1d50ae1ce704b5813a2e70f0fa1192 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 9 Dec 2022 16:09:14 +0100 -Subject: platform: Provide a remove callback that returns no value -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Uwe Kleine-König - -[ Upstream commit 5c5a7680e67ba6fbbb5f4d79fa41485450c1985c ] - -struct platform_driver::remove returning an integer made driver authors -expect that returning an error code was proper error handling. However -the driver core ignores the error and continues to remove the device -because there is nothing the core could do anyhow and reentering the -remove callback again is only calling for trouble. - -So this is an source for errors typically yielding resource leaks in the -error path. - -As there are too many platform drivers to neatly convert them all to -return void in a single go, do it in several steps after this patch: - - a) Convert all drivers to implement .remove_new() returning void instead - of .remove() returning int; - b) Change struct platform_driver::remove() to return void and so make - it identical to .remove_new(); - c) Change all drivers back to .remove() now with the better prototype; - d) drop struct platform_driver::remove_new(). - -While this touches all drivers eventually twice, steps a) and c) can be -done one driver after another and so reduces coordination efforts -immensely and simplifies review. - -Signed-off-by: Uwe Kleine-König -Link: https://lore.kernel.org/r/20221209150914.3557650-1-u.kleine-koenig@pengutronix.de -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: 276822a00db3 ("backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()") -Signed-off-by: Sasha Levin ---- - drivers/base/platform.c | 4 +++- - include/linux/platform_device.h | 11 +++++++++++ - 2 files changed, 14 insertions(+), 1 deletion(-) - -diff --git a/drivers/base/platform.c b/drivers/base/platform.c -index d0b15cbab0ff0..e07043d85c65c 100644 ---- a/drivers/base/platform.c -+++ b/drivers/base/platform.c -@@ -1306,7 +1306,9 @@ static int platform_remove(struct device *_dev) - struct platform_driver *drv = to_platform_driver(_dev->driver); - struct platform_device *dev = to_platform_device(_dev); - -- if (drv->remove) { -+ if (drv->remove_new) { -+ drv->remove_new(dev); -+ } else if (drv->remove) { - int ret = drv->remove(dev); - - if (ret) -diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h -index e7a83b0218077..870a918aa251c 100644 ---- a/include/linux/platform_device.h -+++ b/include/linux/platform_device.h -@@ -203,7 +203,18 @@ extern void platform_device_put(struct platform_device *pdev); - - struct platform_driver { - int (*probe)(struct platform_device *); -+ -+ /* -+ * Traditionally the remove callback returned an int which however is -+ * ignored by the driver core. This led to wrong expectations by driver -+ * authors who thought returning an error code was a valid error -+ * handling strategy. To convert to a callback returning void, new -+ * drivers should implement .remove_new() until the conversion it done -+ * that eventually makes .remove() return void. -+ */ - int (*remove)(struct platform_device *); -+ void (*remove_new)(struct platform_device *); -+ - void (*shutdown)(struct platform_device *); - int (*suspend)(struct platform_device *, pm_message_t state); - int (*resume)(struct platform_device *); --- -2.39.5 - diff --git a/queue-5.10/series b/queue-5.10/series index 5e157b9b38..d077b9926e 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -216,12 +216,6 @@ soc-samsung-exynos-chipid-pass-revision-reg-offsets.patch soc-samsung-exynos-chipid-add-null-pointer-check-in-.patch iio-adc-ad7768-1-move-setting-of-val-a-bit-later-to-.patch iio-adc-ad7768-1-fix-conversion-result-sign.patch -driver-core-platform-reorder-functions.patch -driver-core-platform-change-logic-implementing-platf.patch -driver-core-platform-use-bus_type-functions.patch -driver-core-platform-emit-a-warning-if-a-remove-call.patch -platform-provide-a-remove-callback-that-returns-no-v.patch -backlight-led_bl-convert-to-platform-remove-callback.patch backlight-led_bl-hold-led_access-lock-when-calling-l.patch cifs-print-tids-as-hex.patch cifs-avoid-null-pointer-dereference-in-dbg-call.patch