From 972ab01b579105181d6ab40d20911eb7290c159c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 19 Jun 2024 13:53:04 +0200 Subject: [PATCH] drop some 5.10 patches --- ...form-change-logic-implementing-platf.patch | 83 ---- ...form-emit-a-warning-if-a-remove-call.patch | 60 --- ...iver-core-platform-reorder-functions.patch | 361 ------------------ ...core-platform-use-bus_type-functions.patch | 194 ---------- ...t-strip-remove-function-when-driver-.patch | 19 +- ...convert-to-platform-remove-callback-.patch | 67 ---- ...-a-remove-callback-that-returns-no-v.patch | 86 ----- queue-5.10/series | 6 - 8 files changed, 7 insertions(+), 869 deletions(-) delete mode 100644 queue-5.10/driver-core-platform-change-logic-implementing-platf.patch delete mode 100644 queue-5.10/driver-core-platform-emit-a-warning-if-a-remove-call.patch delete mode 100644 queue-5.10/driver-core-platform-reorder-functions.patch delete mode 100644 queue-5.10/driver-core-platform-use-bus_type-functions.patch delete mode 100644 queue-5.10/mmc-davinci_mmc-convert-to-platform-remove-callback-.patch delete mode 100644 queue-5.10/platform-provide-a-remove-callback-that-returns-no-v.patch 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 843911e24b4..00000000000 --- a/queue-5.10/driver-core-platform-change-logic-implementing-platf.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 70fc1c8589b4de6e2f301a4307f3774ef5bce168 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: 55c421b36448 ("mmc: davinci: Don't strip remove function when driver is builtin") -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.43.0 - 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 6f128b6bfb7..00000000000 --- a/queue-5.10/driver-core-platform-emit-a-warning-if-a-remove-call.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 2f1ac60bc9668567f021c314312563951039f77b 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: 55c421b36448 ("mmc: davinci: Don't strip remove function when driver is builtin") -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.43.0 - 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 9e2551c004c..00000000000 --- a/queue-5.10/driver-core-platform-reorder-functions.patch +++ /dev/null @@ -1,361 +0,0 @@ -From a434f44fb5e69a0050bd63e6eab777236da15b30 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: 55c421b36448 ("mmc: davinci: Don't strip remove function when driver is builtin") -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.43.0 - 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 2447398adce..00000000000 --- a/queue-5.10/driver-core-platform-use-bus_type-functions.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 7ed89da8a1cec28a096b252d4d9fac6903474e7e 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: 55c421b36448 ("mmc: davinci: Don't strip remove function when driver is builtin") -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.43.0 - diff --git a/queue-5.10/mmc-davinci-don-t-strip-remove-function-when-driver-.patch b/queue-5.10/mmc-davinci-don-t-strip-remove-function-when-driver-.patch index e3176ad8a0e..6655107ec79 100644 --- a/queue-5.10/mmc-davinci-don-t-strip-remove-function-when-driver-.patch +++ b/queue-5.10/mmc-davinci-don-t-strip-remove-function-when-driver-.patch @@ -29,31 +29,26 @@ Link: https://lore.kernel.org/r/20240324114017.231936-2-u.kleine-koenig@pengutro Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- - drivers/mmc/host/davinci_mmc.c | 4 ++-- + drivers/mmc/host/davinci_mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c -index b597abd79cfce..97fc4d4c496b7 100644 --- a/drivers/mmc/host/davinci_mmc.c +++ b/drivers/mmc/host/davinci_mmc.c -@@ -1347,7 +1347,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) +@@ -1347,7 +1347,7 @@ ioremap_fail: return ret; } --static void __exit davinci_mmcsd_remove(struct platform_device *pdev) -+static void davinci_mmcsd_remove(struct platform_device *pdev) +-static int __exit davinci_mmcsd_remove(struct platform_device *pdev) ++static int davinci_mmcsd_remove(struct platform_device *pdev) { struct mmc_davinci_host *host = platform_get_drvdata(pdev); -@@ -1402,7 +1402,7 @@ static struct platform_driver davinci_mmcsd_driver = { +@@ -1404,7 +1404,7 @@ static struct platform_driver davinci_mm .of_match_table = davinci_mmc_dt_ids, }, .probe = davinci_mmcsd_probe, -- .remove_new = __exit_p(davinci_mmcsd_remove), -+ .remove_new = davinci_mmcsd_remove, +- .remove = __exit_p(davinci_mmcsd_remove), ++ .remove = davinci_mmcsd_remove, .id_table = davinci_mmc_devtype, }; --- -2.43.0 - diff --git a/queue-5.10/mmc-davinci_mmc-convert-to-platform-remove-callback-.patch b/queue-5.10/mmc-davinci_mmc-convert-to-platform-remove-callback-.patch deleted file mode 100644 index 0860b63e7bd..00000000000 --- a/queue-5.10/mmc-davinci_mmc-convert-to-platform-remove-callback-.patch +++ /dev/null @@ -1,67 +0,0 @@ -From b15fd216c538118e033889ae3b410236399e6f4a Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 27 Jul 2023 14:59:56 +0800 -Subject: mmc: davinci_mmc: Convert to platform remove callback returning void -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Yangtao Li - -[ Upstream commit bc1711e8332da03648d8fe1950189237e66313af ] - -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. - -Cc: Uwe Kleine-König -Signed-off-by: Yangtao Li -Link: https://lore.kernel.org/r/20230727070051.17778-7-frank.li@vivo.com -Signed-off-by: Ulf Hansson -Stable-dep-of: 55c421b36448 ("mmc: davinci: Don't strip remove function when driver is builtin") -Signed-off-by: Sasha Levin ---- - drivers/mmc/host/davinci_mmc.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c -index 647928ab00a30..b597abd79cfce 100644 ---- a/drivers/mmc/host/davinci_mmc.c -+++ b/drivers/mmc/host/davinci_mmc.c -@@ -1347,7 +1347,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) - return ret; - } - --static int __exit davinci_mmcsd_remove(struct platform_device *pdev) -+static void __exit davinci_mmcsd_remove(struct platform_device *pdev) - { - struct mmc_davinci_host *host = platform_get_drvdata(pdev); - -@@ -1356,8 +1356,6 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev) - davinci_release_dma_channels(host); - clk_disable_unprepare(host->clk); - mmc_free_host(host->mmc); -- -- return 0; - } - - #ifdef CONFIG_PM -@@ -1404,7 +1402,7 @@ static struct platform_driver davinci_mmcsd_driver = { - .of_match_table = davinci_mmc_dt_ids, - }, - .probe = davinci_mmcsd_probe, -- .remove = __exit_p(davinci_mmcsd_remove), -+ .remove_new = __exit_p(davinci_mmcsd_remove), - .id_table = davinci_mmc_devtype, - }; - --- -2.43.0 - 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 0106f5d8f54..00000000000 --- a/queue-5.10/platform-provide-a-remove-callback-that-returns-no-v.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 6f4946eef20eaaf56aeb2414f4626249a8f4679a 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: 55c421b36448 ("mmc: davinci: Don't strip remove function when driver is builtin") -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.43.0 - diff --git a/queue-5.10/series b/queue-5.10/series index 90ce8f37223..5f958abd40d 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -39,12 +39,6 @@ iio-accel-mxc4005-reset-chip-on-probe-and-resume.patch drm-amd-display-handle-y-carry-over-in-vcp-x.y-calcu.patch serial-sc16is7xx-replace-hardcoded-divisor-value-wit.patch serial-sc16is7xx-fix-bug-in-sc16is7xx_set_baud-when-.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 -mmc-davinci_mmc-convert-to-platform-remove-callback-.patch mmc-davinci-don-t-strip-remove-function-when-driver-.patch i2c-core-add-managed-function-for-adding-i2c-adapter.patch i2c-add-fwnode-apis.patch -- 2.47.3