+++ /dev/null
-From 7cf2bd01c108a4fd6cf9338b4b57ed39d0b7fa08 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-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 <u.kleine-koenig@pengutronix.de>
-
-[ 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 <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20201119124611.2573057-2-u.kleine-koenig@pengutronix.de
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: 27a8acea47a9 ("mfd: qcom-pm8xxx: Fix OF populate on driver rebind")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- 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.51.0
-
+++ /dev/null
-From 8e34e4f21147091c8b2d3584d1e5fd103be2c094 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-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 <uwe@kleine-koenig.org>
-
-[ 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 <uwe@kleine-koenig.org>
-Link: https://lore.kernel.org/r/20210207211537.19992-1-uwe@kleine-koenig.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: 27a8acea47a9 ("mfd: qcom-pm8xxx: Fix OF populate on driver rebind")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- 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.51.0
-
+++ /dev/null
-From c6cef33f098d3b680f1f93056867cf20421748cf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-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 <u.kleine-koenig@pengutronix.de>
-
-[ 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 <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20201119124611.2573057-1-u.kleine-koenig@pengutronix.de
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: 27a8acea47a9 ("mfd: qcom-pm8xxx: Fix OF populate on driver rebind")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- 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:
-- * "<name><instance>", where <name> is a short description of the type of
-- * device, like "pci" or "floppy", and <instance> is the enumerated
-- * instance of the device, like '0' or '42'. Driver IDs are simply
-- * "<name>". So, extract the <name> 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:
-+ * "<name><instance>", where <name> is a short description of the type of
-+ * device, like "pci" or "floppy", and <instance> is the enumerated
-+ * instance of the device, like '0' or '42'. Driver IDs are simply
-+ * "<name>". So, extract the <name> 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.51.0
-
+++ /dev/null
-From 9a6ee30bd7fe0b29bda76c36c9871bde80a762f9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-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 <u.kleine-koenig@pengutronix.de>
-
-[ 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 <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20201119124611.2573057-3-u.kleine-koenig@pengutronix.de
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: 27a8acea47a9 ("mfd: qcom-pm8xxx: Fix OF populate on driver rebind")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- 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.51.0
-
+++ /dev/null
-From 1af67a9d8de2ea0bde14b917f1c99dddb5560c2b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 Nov 2023 17:56:38 +0100
-Subject: mfd: omap-usb-host: 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 <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit 418d1e74f8597e0b2d5d0d6e1be8f1f47e68f0a4 ]
-
-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 <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20231123165627.492259-11-u.kleine-koenig@pengutronix.de
-Signed-off-by: Lee Jones <lee@kernel.org>
-Stable-dep-of: 24804ba508a3 ("mfd: omap-usb-host: Fix OF populate on driver rebind")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mfd/omap-usb-host.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
-index 2a3a240b4619a..4c07add1f7ddb 100644
---- a/drivers/mfd/omap-usb-host.c
-+++ b/drivers/mfd/omap-usb-host.c
-@@ -818,13 +818,12 @@ static int usbhs_omap_remove_child(struct device *dev, void *data)
- *
- * Reverses the effect of usbhs_omap_probe().
- */
--static int usbhs_omap_remove(struct platform_device *pdev)
-+static void usbhs_omap_remove(struct platform_device *pdev)
- {
- pm_runtime_disable(&pdev->dev);
-
- /* remove children */
- device_for_each_child(&pdev->dev, NULL, usbhs_omap_remove_child);
-- return 0;
- }
-
- static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
-@@ -847,7 +846,7 @@ static struct platform_driver usbhs_omap_driver = {
- .of_match_table = usbhs_omap_dt_ids,
- },
- .probe = usbhs_omap_probe,
-- .remove = usbhs_omap_remove,
-+ .remove_new = usbhs_omap_remove,
- };
-
- MODULE_AUTHOR("Keshava Munegowda <keshava_mgowda@ti.com>");
---
-2.51.0
-
+++ /dev/null
-From ecdcde760ba6c5ddbf34b437311a12db49ac540b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 19 Dec 2025 12:07:14 +0100
-Subject: mfd: omap-usb-host: Fix OF populate on driver rebind
-
-From: Johan Hovold <johan@kernel.org>
-
-[ Upstream commit 24804ba508a3e240501c521685a1c4eb9f574f8e ]
-
-Since commit c6e126de43e7 ("of: Keep track of populated platform
-devices") child devices will not be created by of_platform_populate()
-if the devices had previously been deregistered individually so that the
-OF_POPULATED flag is still set in the corresponding OF nodes.
-
-Switch to using of_platform_depopulate() instead of open coding so that
-the child devices are created if the driver is rebound.
-
-Fixes: c6e126de43e7 ("of: Keep track of populated platform devices")
-Cc: stable@vger.kernel.org # 3.16
-Signed-off-by: Johan Hovold <johan@kernel.org>
-Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
-Link: https://patch.msgid.link/20251219110714.23919-1-johan@kernel.org
-Signed-off-by: Lee Jones <lee@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mfd/omap-usb-host.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
-index 4c07add1f7ddb..0fd321ed53a47 100644
---- a/drivers/mfd/omap-usb-host.c
-+++ b/drivers/mfd/omap-usb-host.c
-@@ -822,8 +822,10 @@ static void usbhs_omap_remove(struct platform_device *pdev)
- {
- pm_runtime_disable(&pdev->dev);
-
-- /* remove children */
-- device_for_each_child(&pdev->dev, NULL, usbhs_omap_remove_child);
-+ if (pdev->dev.of_node)
-+ of_platform_depopulate(&pdev->dev);
-+ else
-+ device_for_each_child(&pdev->dev, NULL, usbhs_omap_remove_child);
- }
-
- static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
---
-2.51.0
-
+++ /dev/null
-From ded537441c39557f81f18f5a3fb440a1082f9132 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 Nov 2023 17:56:41 +0100
-Subject: mfd: qcom-pm8xxx: 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 <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit 19ea1d3953017518d85db35b69b5aea9bc64d630 ]
-
-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.
-
-Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20231123165627.492259-14-u.kleine-koenig@pengutronix.de
-Signed-off-by: Lee Jones <lee@kernel.org>
-Stable-dep-of: 27a8acea47a9 ("mfd: qcom-pm8xxx: Fix OF populate on driver rebind")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mfd/qcom-pm8xxx.c | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/mfd/qcom-pm8xxx.c b/drivers/mfd/qcom-pm8xxx.c
-index 4e24ce7ea009e..d25ef7c717a12 100644
---- a/drivers/mfd/qcom-pm8xxx.c
-+++ b/drivers/mfd/qcom-pm8xxx.c
-@@ -589,19 +589,17 @@ static int pm8xxx_remove_child(struct device *dev, void *unused)
- return 0;
- }
-
--static int pm8xxx_remove(struct platform_device *pdev)
-+static void pm8xxx_remove(struct platform_device *pdev)
- {
- struct pm_irq_chip *chip = platform_get_drvdata(pdev);
-
- device_for_each_child(&pdev->dev, NULL, pm8xxx_remove_child);
- irq_domain_remove(chip->irqdomain);
--
-- return 0;
- }
-
- static struct platform_driver pm8xxx_driver = {
- .probe = pm8xxx_probe,
-- .remove = pm8xxx_remove,
-+ .remove_new = pm8xxx_remove,
- .driver = {
- .name = "pm8xxx-core",
- .of_match_table = pm8xxx_id_table,
---
-2.51.0
-
+++ /dev/null
-From 885fe121c2208c15247519e67230c745182933cf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 19 Dec 2025 12:09:47 +0100
-Subject: mfd: qcom-pm8xxx: Fix OF populate on driver rebind
-
-From: Johan Hovold <johan@kernel.org>
-
-[ Upstream commit 27a8acea47a93fea6ad0e2df4c20a9b51490e4d9 ]
-
-Since commit c6e126de43e7 ("of: Keep track of populated platform
-devices") child devices will not be created by of_platform_populate()
-if the devices had previously been deregistered individually so that the
-OF_POPULATED flag is still set in the corresponding OF nodes.
-
-Switch to using of_platform_depopulate() instead of open coding so that
-the child devices are created if the driver is rebound.
-
-Fixes: c6e126de43e7 ("of: Keep track of populated platform devices")
-Cc: stable@vger.kernel.org # 3.16
-Signed-off-by: Johan Hovold <johan@kernel.org>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
-Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
-Link: https://patch.msgid.link/20251219110947.24101-1-johan@kernel.org
-Signed-off-by: Lee Jones <lee@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mfd/qcom-pm8xxx.c | 8 +-------
- 1 file changed, 1 insertion(+), 7 deletions(-)
-
-diff --git a/drivers/mfd/qcom-pm8xxx.c b/drivers/mfd/qcom-pm8xxx.c
-index d25ef7c717a12..795759df1c069 100644
---- a/drivers/mfd/qcom-pm8xxx.c
-+++ b/drivers/mfd/qcom-pm8xxx.c
-@@ -583,17 +583,11 @@ static int pm8xxx_probe(struct platform_device *pdev)
- return rc;
- }
-
--static int pm8xxx_remove_child(struct device *dev, void *unused)
--{
-- platform_device_unregister(to_platform_device(dev));
-- return 0;
--}
--
- static void pm8xxx_remove(struct platform_device *pdev)
- {
- struct pm_irq_chip *chip = platform_get_drvdata(pdev);
-
-- device_for_each_child(&pdev->dev, NULL, pm8xxx_remove_child);
-+ of_platform_depopulate(&pdev->dev);
- irq_domain_remove(chip->irqdomain);
- }
-
---
-2.51.0
-
+++ /dev/null
-From ac6223ce517c547305e4c4800922947c27a34cf6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 26 Sep 2021 02:43:33 +0300
-Subject: mfd: qcom-pm8xxx: switch away from using chained IRQ handlers
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit d3546ccdce4bc07fcf0648bfe865dbcd6d961afc ]
-
-PM8xxx PMIC family uses GPIO as parent IRQ. Using it together with the
-irq_set_chained_handler_and_data() results in warnings from the GPIOLIB
-(see 461c1a7d4733 ("gpiolib: override irq_enable/disable"))
-as in this path the IRQ resources are not allocated (and thus the
-corresponding GPIO is not marked as used for the IRQ. Use request_irq so
-that the IRQ resources are proprely setup.
-
-[ 0.803271] ------------[ cut here ]------------
-[ 0.803338] WARNING: CPU: 3 PID: 1 at drivers/gpio/gpiolib.c:3207 gpiochip_enable_irq+0xa4/0xa8
-[ 0.803470] Modules linked in:
-[ 0.803542] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.14.0-rc6-next-20210820-postmarketos-qcom-apq8064+ #1
-[ 0.803645] Hardware name: Generic DT based system
-[ 0.803710] Backtrace:
-[ 0.803777] [<c0e3493c>] (dump_backtrace) from [<c0e34d00>] (show_stack+0x20/0x24)
-[ 0.803911] r7:00000c87 r6:c07062dc r5:60000093 r4:c11d0f54
-[ 0.803980] [<c0e34ce0>] (show_stack) from [<c0e38314>] (dump_stack_lvl+0x48/0x54)
-[ 0.804097] [<c0e382cc>] (dump_stack_lvl) from [<c0e38338>] (dump_stack+0x18/0x1c)
-[ 0.804217] r5:00000009 r4:c11fe208
-[ 0.804274] [<c0e38320>] (dump_stack) from [<c03219c8>] (__warn+0xfc/0x114)
-[ 0.804387] [<c03218cc>] (__warn) from [<c0e35334>] (warn_slowpath_fmt+0x74/0xd0)
-[ 0.804509] r7:c07062dc r6:00000c87 r5:c11fe208 r4:00000000
-[ 0.804577] [<c0e352c4>] (warn_slowpath_fmt) from [<c07062dc>] (gpiochip_enable_irq+0xa4/0xa8)
-[ 0.804716] r8:c27b6200 r7:c27aec00 r6:c27aec18 r5:cf77a448 r4:c02225f0
-[ 0.804789] [<c0706238>] (gpiochip_enable_irq) from [<c0706348>] (gpiochip_irq_enable+0x28/0x38)
-[ 0.804921] r5:cf77a448 r4:c27aec18
-[ 0.804977] [<c0706320>] (gpiochip_irq_enable) from [<c03897a0>] (irq_enable+0x48/0x78)
-[ 0.805111] r5:00000000 r4:c27aec00
-[ 0.805167] [<c0389758>] (irq_enable) from [<c0389850>] (__irq_startup+0x80/0xbc)
-[ 0.805286] r5:00000000 r4:c27aec00
-[ 0.805343] [<c03897d0>] (__irq_startup) from [<c038996c>] (irq_startup+0xe0/0x18c)
-[ 0.805468] r7:c27aec00 r6:00000001 r5:00000000 r4:c27aec00
-[ 0.805535] [<c038988c>] (irq_startup) from [<c0389a54>] (irq_activate_and_startup+0x3c/0x74)
-[ 0.805669] r7:c27aec00 r6:00000001 r5:c27aec00 r4:00000000
-[ 0.805736] [<c0389a18>] (irq_activate_and_startup) from [<c0389b58>] (__irq_do_set_handler+0xcc/0x1c0)
-[ 0.805875] r7:c27aec00 r6:c0383710 r5:c08a16b0 r4:00000001
-[ 0.805943] [<c0389a8c>] (__irq_do_set_handler) from [<c0389d80>] (irq_set_chained_handler_and_data+0x60/0x98)
-[ 0.806087] r7:c27b5c10 r6:c27aed40 r5:c08a16b0 r4:c27aec00
-[ 0.806154] [<c0389d20>] (irq_set_chained_handler_and_data) from [<c08a1660>] (pm8xxx_probe+0x1fc/0x24c)
-[ 0.806298] r6:0000003a r5:0000003a r4:c27b5c00
-[ 0.806359] [<c08a1464>] (pm8xxx_probe) from [<c0871420>] (platform_probe+0x6c/0xc8)
-[ 0.806495] r10:c2507080 r9:e8bea2cc r8:c165e0e0 r7:c165e0e0 r6:c15f08f8 r5:c27b5c10
-[ 0.806582] r4:00000000
-[ 0.806632] [<c08713b4>] (platform_probe) from [<c086e280>] (really_probe+0xe8/0x460)
-[ 0.806769] r7:c165e0e0 r6:c15f08f8 r5:00000000 r4:c27b5c10
-[ 0.806837] [<c086e198>] (really_probe) from [<c086e6a8>] (__driver_probe_device+0xb0/0x22c)
-[ 0.806975] r7:c27b5c10 r6:cf70fba4 r5:c15f08f8 r4:c27b5c10
-[ 0.807042] [<c086e5f8>] (__driver_probe_device) from [<c086e868>] (driver_probe_device+0x44/0xe0)
-[ 0.807188] r9:e8bea2cc r8:00000000 r7:c27b5c10 r6:cf70fba4 r5:c16ae4b4 r4:c16ae4b0
-[ 0.807271] [<c086e824>] (driver_probe_device) from [<c086ecd8>] (__device_attach_driver+0xb4/0x12c)
-[ 0.807421] r9:e8bea2cc r8:c15eec08 r7:c27b5c10 r6:cf70fba4 r5:c15f08f8 r4:00000001
-[ 0.807506] [<c086ec24>] (__device_attach_driver) from [<c086c06c>] (bus_for_each_drv+0x94/0xe4)
-[ 0.807651] r7:c16ae484 r6:c086ec24 r5:cf70fba4 r4:00000000
-[ 0.807718] [<c086bfd8>] (bus_for_each_drv) from [<c086e0e0>] (__device_attach+0x104/0x19c)
-[ 0.807852] r6:00000001 r5:c27b5c54 r4:c27b5c10
-[ 0.807913] [<c086dfdc>] (__device_attach) from [<c086eef4>] (device_initial_probe+0x1c/0x20)
-[ 0.808050] r6:c27b5c10 r5:c15ef1b0 r4:c27b5c10
-[ 0.808111] [<c086eed8>] (device_initial_probe) from [<c086d00c>] (bus_probe_device+0x94/0x9c)
-[ 0.808240] [<c086cf78>] (bus_probe_device) from [<c086a60c>] (device_add+0x404/0x8f4)
-[ 0.808370] r7:c16ae484 r6:c251ba10 r5:00000000 r4:c27b5c10
-[ 0.808439] [<c086a208>] (device_add) from [<c0a82f50>] (of_device_add+0x44/0x4c)
-[ 0.808581] r10:c144c854 r9:00000001 r8:e8bea314 r7:c251ba10 r6:00000000 r5:00000000
-[ 0.808669] r4:c27b5c00
-[ 0.808718] [<c0a82f0c>] (of_device_add) from [<c0a836cc>] (of_platform_device_create_pdata+0xa0/0xc8)
-[ 0.808850] [<c0a8362c>] (of_platform_device_create_pdata) from [<c0a83908>] (of_platform_bus_create+0x1f0/0x514)
-[ 0.809005] r9:00000001 r8:c251ba10 r7:00000000 r6:00000000 r5:00000000 r4:e8bea2b0
-[ 0.809086] [<c0a83718>] (of_platform_bus_create) from [<c0a83e04>] (of_platform_populate+0x98/0x128)
-[ 0.809233] r10:c144c854 r9:00000001 r8:c251ba10 r7:00000000 r6:00000000 r5:e8bea170
-[ 0.809321] r4:e8bea2b0
-[ 0.809371] [<c0a83d6c>] (of_platform_populate) from [<c0a83f20>] (devm_of_platform_populate+0x60/0xa8)
-[ 0.809521] r9:0000011d r8:c165e0e0 r7:e8bea170 r6:c2c34f40 r5:c2cac140 r4:c251ba10
-[ 0.809604] [<c0a83ec0>] (devm_of_platform_populate) from [<c08a212c>] (ssbi_probe+0x138/0x16c)
-[ 0.809738] r6:c2c34f40 r5:c251ba10 r4:ff822700
-[ 0.809800] [<c08a1ff4>] (ssbi_probe) from [<c0871420>] (platform_probe+0x6c/0xc8)
-[ 0.809923] r7:c165e0e0 r6:c15f0a80 r5:c251ba10 r4:00000000
-[ 0.809989] [<c08713b4>] (platform_probe) from [<c086e280>] (really_probe+0xe8/0x460)
-[ 0.810120] r7:c165e0e0 r6:c15f0a80 r5:00000000 r4:c251ba10
-[ 0.810187] [<c086e198>] (really_probe) from [<c086e6a8>] (__driver_probe_device+0xb0/0x22c)
-[ 0.810325] r7:c251ba10 r6:c15f0a80 r5:c15f0a80 r4:c251ba10
-[ 0.810393] [<c086e5f8>] (__driver_probe_device) from [<c086e868>] (driver_probe_device+0x44/0xe0)
-[ 0.810539] r9:0000011d r8:00000000 r7:c251ba10 r6:c15f0a80 r5:c16ae4b4 r4:c16ae4b0
-[ 0.810623] [<c086e824>] (driver_probe_device) from [<c086ee2c>] (__driver_attach+0xdc/0x188)
-[ 0.810766] r9:0000011d r8:c144c834 r7:00000000 r6:c15f0a80 r5:c251ba10 r4:00000000
-[ 0.810849] [<c086ed50>] (__driver_attach) from [<c086bf60>] (bus_for_each_dev+0x88/0xd4)
-[ 0.810985] r7:00000000 r6:c086ed50 r5:c15f0a80 r4:00000000
-[ 0.811052] [<c086bed8>] (bus_for_each_dev) from [<c086dad4>] (driver_attach+0x2c/0x30)
-[ 0.811182] r6:c15ef1b0 r5:c2c34e80 r4:c15f0a80
-[ 0.811243] [<c086daa8>] (driver_attach) from [<c086d2dc>] (bus_add_driver+0x180/0x21c)
-[ 0.811364] [<c086d15c>] (bus_add_driver) from [<c086fa6c>] (driver_register+0x84/0x118)
-[ 0.811492] r7:00000000 r6:ffffe000 r5:c1428210 r4:c15f0a80
-[ 0.811558] [<c086f9e8>] (driver_register) from [<c0871174>] (__platform_driver_register+0x2c/0x34)
-[ 0.811683] r5:c1428210 r4:c16524a0
-[ 0.811739] [<c0871148>] (__platform_driver_register) from [<c1428234>] (ssbi_driver_init+0x24/0x28)
-[ 0.811868] [<c1428210>] (ssbi_driver_init) from [<c0302394>] (do_one_initcall+0x68/0x2c8)
-[ 0.811990] [<c030232c>] (do_one_initcall) from [<c140147c>] (kernel_init_freeable+0x1dc/0x23c)
-[ 0.812135] r7:cf7b0400 r6:c130339c r5:00000007 r4:c147f6a0
-[ 0.812204] [<c14012a0>] (kernel_init_freeable) from [<c0e40e60>] (kernel_init+0x20/0x138)
-[ 0.812345] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0e40e40
-[ 0.812433] r4:00000000
-[ 0.812483] [<c0e40e40>] (kernel_init) from [<c0300150>] (ret_from_fork+0x14/0x24)
-[ 0.812596] Exception stack(0xcf70ffb0 to 0xcf70fff8)
-[ 0.812684] ffa0: 00000000 00000000 00000000 00000000
-[ 0.812809] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
-[ 0.812923] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000
-[ 0.813008] r5:c0e40e40 r4:00000000
-[ 0.813075] ---[ end trace ad2443eee078d094 ]---
-
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
-Tested-by: David Heidelberg <david@ixit.cz> # on Nexus 7 (deb)
-Signed-off-by: Lee Jones <lee.jones@linaro.org>
-Link: https://lore.kernel.org/r/20210925234333.2430755-1-dmitry.baryshkov@linaro.org
-Stable-dep-of: 27a8acea47a9 ("mfd: qcom-pm8xxx: Fix OF populate on driver rebind")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mfd/qcom-pm8xxx.c | 39 ++++++++++++++++-----------------------
- 1 file changed, 16 insertions(+), 23 deletions(-)
-
-diff --git a/drivers/mfd/qcom-pm8xxx.c b/drivers/mfd/qcom-pm8xxx.c
-index acd172ddcbd6a..4e24ce7ea009e 100644
---- a/drivers/mfd/qcom-pm8xxx.c
-+++ b/drivers/mfd/qcom-pm8xxx.c
-@@ -65,7 +65,7 @@
- struct pm_irq_data {
- int num_irqs;
- struct irq_chip *irq_chip;
-- void (*irq_handler)(struct irq_desc *desc);
-+ irq_handler_t irq_handler;
- };
-
- struct pm_irq_chip {
-@@ -170,19 +170,16 @@ static int pm8xxx_irq_master_handler(struct pm_irq_chip *chip, int master)
- return ret;
- }
-
--static void pm8xxx_irq_handler(struct irq_desc *desc)
-+static irqreturn_t pm8xxx_irq_handler(int irq, void *data)
- {
-- struct pm_irq_chip *chip = irq_desc_get_handler_data(desc);
-- struct irq_chip *irq_chip = irq_desc_get_chip(desc);
-+ struct pm_irq_chip *chip = data;
- unsigned int root;
- int i, ret, masters = 0;
-
-- chained_irq_enter(irq_chip, desc);
--
- ret = regmap_read(chip->regmap, SSBI_REG_ADDR_IRQ_ROOT, &root);
- if (ret) {
- pr_err("Can't read root status ret=%d\n", ret);
-- return;
-+ return IRQ_NONE;
- }
-
- /* on pm8xxx series masters start from bit 1 of the root */
-@@ -193,7 +190,7 @@ static void pm8xxx_irq_handler(struct irq_desc *desc)
- if (masters & (1 << i))
- pm8xxx_irq_master_handler(chip, i);
-
-- chained_irq_exit(irq_chip, desc);
-+ return IRQ_HANDLED;
- }
-
- static void pm8821_irq_block_handler(struct pm_irq_chip *chip,
-@@ -232,19 +229,17 @@ static inline void pm8821_irq_master_handler(struct pm_irq_chip *chip,
- pm8821_irq_block_handler(chip, master, block);
- }
-
--static void pm8821_irq_handler(struct irq_desc *desc)
-+static irqreturn_t pm8821_irq_handler(int irq, void *data)
- {
-- struct pm_irq_chip *chip = irq_desc_get_handler_data(desc);
-- struct irq_chip *irq_chip = irq_desc_get_chip(desc);
-+ struct pm_irq_chip *chip = data;
- unsigned int master;
- int ret;
-
-- chained_irq_enter(irq_chip, desc);
- ret = regmap_read(chip->regmap,
- PM8821_SSBI_REG_ADDR_IRQ_MASTER0, &master);
- if (ret) {
- pr_err("Failed to read master 0 ret=%d\n", ret);
-- goto done;
-+ return IRQ_NONE;
- }
-
- /* bits 1 through 7 marks the first 7 blocks in master 0 */
-@@ -253,19 +248,18 @@ static void pm8821_irq_handler(struct irq_desc *desc)
-
- /* bit 0 marks if master 1 contains any bits */
- if (!(master & BIT(0)))
-- goto done;
-+ return IRQ_NONE;
-
- ret = regmap_read(chip->regmap,
- PM8821_SSBI_REG_ADDR_IRQ_MASTER1, &master);
- if (ret) {
- pr_err("Failed to read master 1 ret=%d\n", ret);
-- goto done;
-+ return IRQ_NONE;
- }
-
- pm8821_irq_master_handler(chip, 1, master);
-
--done:
-- chained_irq_exit(irq_chip, desc);
-+ return IRQ_HANDLED;
- }
-
- static void pm8xxx_irq_mask_ack(struct irq_data *d)
-@@ -576,14 +570,15 @@ static int pm8xxx_probe(struct platform_device *pdev)
- if (!chip->irqdomain)
- return -ENODEV;
-
-- irq_set_chained_handler_and_data(irq, data->irq_handler, chip);
-+ rc = devm_request_irq(&pdev->dev, irq, data->irq_handler, 0, dev_name(&pdev->dev), chip);
-+ if (rc)
-+ return rc;
-+
- irq_set_irq_wake(irq, 1);
-
- rc = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
-- if (rc) {
-- irq_set_chained_handler_and_data(irq, NULL, NULL);
-+ if (rc)
- irq_domain_remove(chip->irqdomain);
-- }
-
- return rc;
- }
-@@ -596,11 +591,9 @@ static int pm8xxx_remove_child(struct device *dev, void *unused)
-
- static int pm8xxx_remove(struct platform_device *pdev)
- {
-- int irq = platform_get_irq(pdev, 0);
- struct pm_irq_chip *chip = platform_get_drvdata(pdev);
-
- device_for_each_child(&pdev->dev, NULL, pm8xxx_remove_child);
-- irq_set_chained_handler_and_data(irq, NULL, NULL);
- irq_domain_remove(chip->irqdomain);
-
- return 0;
---
-2.51.0
-
+++ /dev/null
-From a6f45a4bf0643a07ab6eca336bc6ac9db517b728 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-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 <u.kleine-koenig@pengutronix.de>
-
-[ 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 <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20221209150914.3557650-1-u.kleine-koenig@pengutronix.de
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: 27a8acea47a9 ("mfd: qcom-pm8xxx: Fix OF populate on driver rebind")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- 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.51.0
-
drm-tegra-dsi-fix-device-leak-on-probe.patch
bus-omap-ocp2scp-convert-to-platform-remove-callback.patch
bus-omap-ocp2scp-fix-of-populate-on-driver-rebind.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
-mfd-qcom-pm8xxx-switch-away-from-using-chained-irq-h.patch
-platform-provide-a-remove-callback-that-returns-no-v.patch
-mfd-qcom-pm8xxx-convert-to-platform-remove-callback-.patch
-mfd-qcom-pm8xxx-fix-of-populate-on-driver-rebind.patch
-mfd-omap-usb-host-convert-to-platform-remove-callbac.patch
-mfd-omap-usb-host-fix-of-populate-on-driver-rebind.patch
clk-tegra-tegra124-emc-fix-device-leak-on-set_rate.patch
alsa-hda-conexant-add-quirk-for-hp-zbook-studio-g4.patch
hwmon-max16065-use-read-write_once-to-avoid-compiler.patch