From: Greg Kroah-Hartman Date: Tue, 11 Mar 2025 14:16:50 +0000 (+0100) Subject: drop some driver core changes for 5.10 X-Git-Tag: v5.4.291~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7f0fce84e9057f0afa10eb1daa109739eaa0492;p=thirdparty%2Fkernel%2Fstable-queue.git drop some driver core changes for 5.10 Not really needed --- 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 bc794c1cf6..0000000000 --- a/queue-5.10/driver-core-platform-change-logic-implementing-platf.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 1eae1d687bfd5e9aa2c573ebc0edaddeaf1c898f 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: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak") -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 33606a173a..0000000000 --- a/queue-5.10/driver-core-platform-emit-a-warning-if-a-remove-call.patch +++ /dev/null @@ -1,60 +0,0 @@ -From d3130d676b6942ea14cd06dcbe105f997a956302 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: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak") -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 7911049774..0000000000 --- a/queue-5.10/driver-core-platform-reorder-functions.patch +++ /dev/null @@ -1,361 +0,0 @@ -From d850359856e0edc5c80cd3bb1b9f5932091f18f5 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: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak") -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 1084c88789..0000000000 --- a/queue-5.10/driver-core-platform-use-bus_type-functions.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 42a21f6047a9a56987a59b5340e718b5e1109e7a 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: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak") -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/mtd-hyperbus-hbmc-am654-convert-to-platform-remove-c.patch b/queue-5.10/mtd-hyperbus-hbmc-am654-convert-to-platform-remove-c.patch deleted file mode 100644 index 9eaec5c0e5..0000000000 --- a/queue-5.10/mtd-hyperbus-hbmc-am654-convert-to-platform-remove-c.patch +++ /dev/null @@ -1,70 +0,0 @@ -From dedab413388b592ae804446041bc6f7e77dfaf5d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 8 Oct 2023 22:01:32 +0200 -Subject: mtd: hyperbus: hbmc-am654: 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 59bd56760df17506bc2f828f19b40a2243edd0d0 ] - -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 ignored (apart -from emitting a warning) 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. Eventually after all drivers -are converted, .remove_new() will be renamed to .remove(). - -Trivially convert this driver from always returning zero in the remove -callback to the void returning variant. - -Signed-off-by: Uwe Kleine-König -Signed-off-by: Miquel Raynal -Acked-by: Tudor Ambarus -Link: https://lore.kernel.org/linux-mtd/20231008200143.196369-10-u.kleine-koenig@pengutronix.de -Stable-dep-of: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak") -Signed-off-by: Sasha Levin ---- - drivers/mtd/hyperbus/hbmc-am654.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c -index a6161ce340d4e..dbe3eb361cca2 100644 ---- a/drivers/mtd/hyperbus/hbmc-am654.c -+++ b/drivers/mtd/hyperbus/hbmc-am654.c -@@ -229,7 +229,7 @@ static int am654_hbmc_probe(struct platform_device *pdev) - return ret; - } - --static int am654_hbmc_remove(struct platform_device *pdev) -+static void am654_hbmc_remove(struct platform_device *pdev) - { - struct am654_hbmc_priv *priv = platform_get_drvdata(pdev); - struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv; -@@ -241,8 +241,6 @@ static int am654_hbmc_remove(struct platform_device *pdev) - - if (dev_priv->rx_chan) - dma_release_channel(dev_priv->rx_chan); -- -- return 0; - } - - static const struct of_device_id am654_hbmc_dt_ids[] = { -@@ -256,7 +254,7 @@ MODULE_DEVICE_TABLE(of, am654_hbmc_dt_ids); - - static struct platform_driver am654_hbmc_platform_driver = { - .probe = am654_hbmc_probe, -- .remove = am654_hbmc_remove, -+ .remove_new = am654_hbmc_remove, - .driver = { - .name = "hbmc-am654", - .of_match_table = am654_hbmc_dt_ids, --- -2.39.5 - diff --git a/queue-5.10/mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch b/queue-5.10/mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch index 4c4c14d588..40c99c8ff4 100644 --- a/queue-5.10/mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch +++ b/queue-5.10/mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch @@ -16,14 +16,12 @@ Signed-off-by: Joe Hattori Signed-off-by: Miquel Raynal Signed-off-by: Sasha Levin --- - drivers/mtd/hyperbus/hbmc-am654.c | 19 +++++++++++++------ + drivers/mtd/hyperbus/hbmc-am654.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c -index dbe3eb361cca2..4b6cbee23fe89 100644 --- a/drivers/mtd/hyperbus/hbmc-am654.c +++ b/drivers/mtd/hyperbus/hbmc-am654.c -@@ -174,26 +174,30 @@ static int am654_hbmc_probe(struct platform_device *pdev) +@@ -174,26 +174,30 @@ static int am654_hbmc_probe(struct platf priv->hbdev.np = of_get_next_child(np, NULL); ret = of_address_to_resource(priv->hbdev.np, 0, &res); if (ret) @@ -60,7 +58,7 @@ index dbe3eb361cca2..4b6cbee23fe89 100644 priv->ctlr.dev = dev; priv->ctlr.ops = &am654_hbmc_ops; -@@ -226,6 +230,8 @@ static int am654_hbmc_probe(struct platform_device *pdev) +@@ -226,6 +230,8 @@ release_dma: disable_mux: if (priv->mux_ctrl) mux_control_deselect(priv->mux_ctrl); @@ -69,14 +67,11 @@ index dbe3eb361cca2..4b6cbee23fe89 100644 return ret; } -@@ -241,6 +247,7 @@ static void am654_hbmc_remove(struct platform_device *pdev) +@@ -241,6 +247,7 @@ static int am654_hbmc_remove(struct plat if (dev_priv->rx_chan) dma_release_channel(dev_priv->rx_chan); + of_node_put(priv->hbdev.np); - } - static const struct of_device_id am654_hbmc_dt_ids[] = { --- -2.39.5 - + return ret; + } diff --git a/queue-5.10/mtd-hyperbus-make-hyperbus_unregister_device-return-.patch b/queue-5.10/mtd-hyperbus-make-hyperbus_unregister_device-return-.patch deleted file mode 100644 index 9aa63f196d..0000000000 --- a/queue-5.10/mtd-hyperbus-make-hyperbus_unregister_device-return-.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 9cfe7c4f97f6d4cf6aacc85a5282564415887533 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 3 Jun 2022 23:07:45 +0200 -Subject: mtd: hyperbus: Make hyperbus_unregister_device() return void -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Uwe Kleine-König - -[ Upstream commit 0c90466a7985d39355f743e9cd2139da3e86c4d8 ] - -The only thing that could theoretically fail in that function is -mtd_device_unregister(). However it's not supposed to fail and when -used correctly it doesn't. So wail loudly if it does anyhow. - -This matches how other drivers (e.g. nand/raw/nandsim.c) use -mtd_device_unregister(). - -This is a preparation for making platform remove callbacks return void. - -Signed-off-by: Uwe Kleine-König -Signed-off-by: Miquel Raynal -Link: https://lore.kernel.org/linux-mtd/20220603210758.148493-2-u.kleine-koenig@pengutronix.de -Stable-dep-of: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak") -Signed-off-by: Sasha Levin ---- - drivers/mtd/hyperbus/hbmc-am654.c | 6 +++--- - drivers/mtd/hyperbus/hyperbus-core.c | 8 ++------ - drivers/mtd/hyperbus/rpc-if.c | 5 +++-- - include/linux/mtd/hyperbus.h | 4 +--- - 4 files changed, 9 insertions(+), 14 deletions(-) - -diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c -index a3439b791eeb4..a6161ce340d4e 100644 ---- a/drivers/mtd/hyperbus/hbmc-am654.c -+++ b/drivers/mtd/hyperbus/hbmc-am654.c -@@ -233,16 +233,16 @@ static int am654_hbmc_remove(struct platform_device *pdev) - { - struct am654_hbmc_priv *priv = platform_get_drvdata(pdev); - struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv; -- int ret; - -- ret = hyperbus_unregister_device(&priv->hbdev); -+ hyperbus_unregister_device(&priv->hbdev); -+ - if (priv->mux_ctrl) - mux_control_deselect(priv->mux_ctrl); - - if (dev_priv->rx_chan) - dma_release_channel(dev_priv->rx_chan); - -- return ret; -+ return 0; - } - - static const struct of_device_id am654_hbmc_dt_ids[] = { -diff --git a/drivers/mtd/hyperbus/hyperbus-core.c b/drivers/mtd/hyperbus/hyperbus-core.c -index 2f9fc4e17d53e..4d8047d43e48e 100644 ---- a/drivers/mtd/hyperbus/hyperbus-core.c -+++ b/drivers/mtd/hyperbus/hyperbus-core.c -@@ -126,16 +126,12 @@ int hyperbus_register_device(struct hyperbus_device *hbdev) - } - EXPORT_SYMBOL_GPL(hyperbus_register_device); - --int hyperbus_unregister_device(struct hyperbus_device *hbdev) -+void hyperbus_unregister_device(struct hyperbus_device *hbdev) - { -- int ret = 0; -- - if (hbdev && hbdev->mtd) { -- ret = mtd_device_unregister(hbdev->mtd); -+ WARN_ON(mtd_device_unregister(hbdev->mtd)); - map_destroy(hbdev->mtd); - } -- -- return ret; - } - EXPORT_SYMBOL_GPL(hyperbus_unregister_device); - -diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c -index dc164c18f8429..cd0e577684ff0 100644 ---- a/drivers/mtd/hyperbus/rpc-if.c -+++ b/drivers/mtd/hyperbus/rpc-if.c -@@ -151,11 +151,12 @@ static int rpcif_hb_probe(struct platform_device *pdev) - static int rpcif_hb_remove(struct platform_device *pdev) - { - struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev); -- int error = hyperbus_unregister_device(&hyperbus->hbdev); -+ -+ hyperbus_unregister_device(&hyperbus->hbdev); - - rpcif_disable_rpm(&hyperbus->rpc); - -- return error; -+ return 0; - } - - static struct platform_driver rpcif_platform_driver = { -diff --git a/include/linux/mtd/hyperbus.h b/include/linux/mtd/hyperbus.h -index 0ce612428aea2..bb6b7121a5427 100644 ---- a/include/linux/mtd/hyperbus.h -+++ b/include/linux/mtd/hyperbus.h -@@ -89,9 +89,7 @@ int hyperbus_register_device(struct hyperbus_device *hbdev); - /** - * hyperbus_unregister_device - deregister HyperBus slave memory device - * @hbdev: hyperbus_device to be unregistered -- * -- * Return: 0 for success, others for failure. - */ --int hyperbus_unregister_device(struct hyperbus_device *hbdev); -+void hyperbus_unregister_device(struct hyperbus_device *hbdev); - - #endif /* __LINUX_MTD_HYPERBUS_H__ */ --- -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 82a6472269..0000000000 --- a/queue-5.10/platform-provide-a-remove-callback-that-returns-no-v.patch +++ /dev/null @@ -1,86 +0,0 @@ -From d513c6f29e95ad19a3285bcd0eae0a7bc05a1c51 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: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak") -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 95f8b38044..3d869f3bb5 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -84,13 +84,6 @@ media-marvell-add-check-for-clk_enable.patch media-mipi-csis-add-check-for-clk_enable.patch media-camif-core-add-check-for-clk_enable.patch media-uvcvideo-propagate-buf-error-to-userspace.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 -mtd-hyperbus-make-hyperbus_unregister_device-return-.patch -platform-provide-a-remove-callback-that-returns-no-v.patch -mtd-hyperbus-hbmc-am654-convert-to-platform-remove-c.patch mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch staging-media-imx-fix-of-node-leak-in-imx_media_add_.patch pci-rcar-ep-fix-incorrect-variable-used-when-calling.patch @@ -464,3 +457,4 @@ vsock-keep-the-binding-until-socket-destruction.patch vsock-orphan-socket-after-transport-release.patch sched-sch_cake-add-bounds-checks-to-host-bulk-flow-fairness-counts.patch kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch +crypto-hisilicon-qm-inject-error-before-stopping-queue.patch