From: Sasha Levin Date: Mon, 7 Oct 2024 20:39:48 +0000 (-0400) Subject: Drop driver-core-platform-reorder-functions.patch X-Git-Tag: v6.6.55~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b5c988e9b3ed471e046d493e183e22346defcd4b;p=thirdparty%2Fkernel%2Fstable-queue.git Drop driver-core-platform-reorder-functions.patch Signed-off-by: Sasha Levin --- 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 61703ce94e0..00000000000 --- a/queue-5.10/driver-core-platform-reorder-functions.patch +++ /dev/null @@ -1,361 +0,0 @@ -From c354385ee03ba34e7fecb93208340f21c41686f6 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: cfd67903977b ("PCI: xilinx-nwl: Clean up clock on probe failure/removal") -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/series b/queue-5.10/series index a8e807f6782..6cf961eea6d 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -164,7 +164,6 @@ drivers-media-dvb-frontends-rtl2832-fix-an-out-of-bo.patch drivers-media-dvb-frontends-rtl2830-fix-an-out-of-bo.patch pci-keystone-fix-if-statement-expression-in-ks_pcie_.patch pci-xilinx-nwl-fix-register-misspelling.patch -driver-core-platform-reorder-functions.patch driver-core-platform-use-bus_type-functions.patch platform-provide-a-remove-callback-that-returns-no-v.patch pci-xilinx-nwl-clean-up-clock-on-probe-failure-remov.patch