Link: https://lore.kernel.org/r/20240212120608.30469-1-hdegoede@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- drivers/platform/x86/touchscreen_dmi.c | 4 ++--
+ drivers/platform/x86/touchscreen_dmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
-diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
-index fd22f6778664b..fb5c84872d322 100644
--- a/drivers/platform/x86/touchscreen_dmi.c
+++ b/drivers/platform/x86/touchscreen_dmi.c
-@@ -50,7 +50,7 @@ static const struct property_entry chuwi_hi8_air_props[] = {
+@@ -50,7 +50,7 @@ static const struct property_entry chuwi
};
static const struct ts_dmi_data chuwi_hi8_air_data = {
.properties = chuwi_hi8_air_props,
};
-@@ -1648,7 +1648,7 @@ static void ts_dmi_add_props(struct i2c_client *client)
+@@ -1648,7 +1648,7 @@ static void ts_dmi_add_props(struct i2c_
int error;
if (has_acpi_companion(dev) &&
- !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
+ strstarts(client->name, ts_data->acpi_name)) {
- error = device_create_managed_software_node(dev, ts_data->properties, NULL);
+ error = device_add_properties(dev, ts_data->properties);
if (error)
dev_err(dev, "failed to add properties: %d\n", error);
---
-2.43.0
-
+++ /dev/null
-From 348424bfd17a248c97fef308f20e7c853834c9bc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 4 Mar 2021 11:20:23 +0300
-Subject: platform/x86: touchscreen_dmi: Handle device properties with software
- node API
-
-From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-
-[ Upstream commit 87eaede45385e384faf5b15d9c718a951667bdd0 ]
-
-The old device property API (device_add_properties()) is
-going to be removed. Replacing the it with the software node
-API equivalent, device_create_managed_software_node().
-
-Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-Link: https://lore.kernel.org/r/20210304082023.17689-1-heikki.krogerus@linux.intel.com
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Stable-dep-of: dbcbfd662a72 ("platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/platform/x86/touchscreen_dmi.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
-index eedff2ae28511..fd22f6778664b 100644
---- a/drivers/platform/x86/touchscreen_dmi.c
-+++ b/drivers/platform/x86/touchscreen_dmi.c
-@@ -1649,7 +1649,7 @@ static void ts_dmi_add_props(struct i2c_client *client)
-
- if (has_acpi_companion(dev) &&
- !strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) {
-- error = device_add_properties(dev, ts_data->properties);
-+ error = device_create_managed_software_node(dev, ts_data->properties, NULL);
- if (error)
- dev_err(dev, "failed to add properties: %d\n", error);
- }
---
-2.43.0
-
-software-node-introduce-device_add_software_node.patch
-software-node-provide-replacement-for-device_add_pro.patch
-platform-x86-touchscreen_dmi-handle-device-propertie.patch
platform-x86-touchscreen_dmi-allow-partial-prefix-ma.patch
crypto-virtio-akcipher-fix-stack-overflow-on-memcpy.patch
mtd-spinand-gigadevice-support-gd5f1gq5uexxg.patch
gpio-74x164-enable-output-pins-after-registers-are-r.patch
gpiolib-fix-the-error-path-order-in-gpiochip_add_dat.patch
gpio-fix-resource-unwinding-order-in-error-path.patch
+mtd-spinand-gigadevice-fix-quad-io-for-gd5f1gq5uexxg.patch
+++ /dev/null
-From fdcd9f91d60f029d904322dbf5cf129901f39ec2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 15 Jan 2021 12:49:11 +0300
-Subject: software node: Introduce device_add_software_node()
-
-From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-
-[ Upstream commit e68d0119e3284334de5650a1ac42ef4e179f895e ]
-
-This helper will register a software node and then assign
-it to device at the same time. The function will also make
-sure that the device can't have more than one software node.
-
-Acked-by: Felipe Balbi <balbi@kernel.org>
-Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-Link: https://lore.kernel.org/r/20210115094914.88401-2-heikki.krogerus@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: dbcbfd662a72 ("platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/base/swnode.c | 71 +++++++++++++++++++++++++++++++++++-----
- include/linux/property.h | 3 ++
- 2 files changed, 65 insertions(+), 9 deletions(-)
-
-diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
-index b664c36388e24..ad66d7c545f92 100644
---- a/drivers/base/swnode.c
-+++ b/drivers/base/swnode.c
-@@ -48,6 +48,19 @@ EXPORT_SYMBOL_GPL(is_software_node);
- struct swnode, fwnode) : NULL; \
- })
-
-+static inline struct swnode *dev_to_swnode(struct device *dev)
-+{
-+ struct fwnode_handle *fwnode = dev_fwnode(dev);
-+
-+ if (!fwnode)
-+ return NULL;
-+
-+ if (!is_software_node(fwnode))
-+ fwnode = fwnode->secondary;
-+
-+ return to_swnode(fwnode);
-+}
-+
- static struct swnode *
- software_node_to_swnode(const struct software_node *node)
- {
-@@ -853,22 +866,62 @@ void fwnode_remove_software_node(struct fwnode_handle *fwnode)
- }
- EXPORT_SYMBOL_GPL(fwnode_remove_software_node);
-
-+/**
-+ * device_add_software_node - Assign software node to a device
-+ * @dev: The device the software node is meant for.
-+ * @swnode: The software node.
-+ *
-+ * This function will register @swnode and make it the secondary firmware node
-+ * pointer of @dev. If @dev has no primary node, then @swnode will become the primary
-+ * node.
-+ */
-+int device_add_software_node(struct device *dev, const struct software_node *swnode)
-+{
-+ int ret;
-+
-+ /* Only one software node per device. */
-+ if (dev_to_swnode(dev))
-+ return -EBUSY;
-+
-+ ret = software_node_register(swnode);
-+ if (ret)
-+ return ret;
-+
-+ set_secondary_fwnode(dev, software_node_fwnode(swnode));
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(device_add_software_node);
-+
-+/**
-+ * device_remove_software_node - Remove device's software node
-+ * @dev: The device with the software node.
-+ *
-+ * This function will unregister the software node of @dev.
-+ */
-+void device_remove_software_node(struct device *dev)
-+{
-+ struct swnode *swnode;
-+
-+ swnode = dev_to_swnode(dev);
-+ if (!swnode)
-+ return;
-+
-+ software_node_notify(dev, KOBJ_REMOVE);
-+ set_secondary_fwnode(dev, NULL);
-+ kobject_put(&swnode->kobj);
-+}
-+EXPORT_SYMBOL_GPL(device_remove_software_node);
-+
- int software_node_notify(struct device *dev, unsigned long action)
- {
-- struct fwnode_handle *fwnode = dev_fwnode(dev);
- struct swnode *swnode;
- int ret;
-
-- if (!fwnode)
-- return 0;
--
-- if (!is_software_node(fwnode))
-- fwnode = fwnode->secondary;
-- if (!is_software_node(fwnode))
-+ swnode = dev_to_swnode(dev);
-+ if (!swnode)
- return 0;
-
-- swnode = to_swnode(fwnode);
--
- switch (action) {
- case KOBJ_ADD:
- ret = sysfs_create_link(&dev->kobj, &swnode->kobj,
-diff --git a/include/linux/property.h b/include/linux/property.h
-index 2d4542629d80b..3b6093f6bd04c 100644
---- a/include/linux/property.h
-+++ b/include/linux/property.h
-@@ -485,4 +485,7 @@ fwnode_create_software_node(const struct property_entry *properties,
- const struct fwnode_handle *parent);
- void fwnode_remove_software_node(struct fwnode_handle *fwnode);
-
-+int device_add_software_node(struct device *dev, const struct software_node *swnode);
-+void device_remove_software_node(struct device *dev);
-+
- #endif /* _LINUX_PROPERTY_H_ */
---
-2.43.0
-
+++ /dev/null
-From 3995588dbe6584f277a9a6d92164ade46144c9dc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 4 Feb 2021 17:17:06 +0300
-Subject: software node: Provide replacement for device_add_properties()
-
-From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-
-[ Upstream commit 151f6ff78cdf1d6de76e90556cfc43f1e48abe18 ]
-
-At the moment the function device_del() is calling
-device_remove_properties() unconditionally. That will result into the
-reference count of the software node attached to the device being
-decremented, and in most cases it will hit 0 at that point. So in
-practice device_del() will unregister the software node attached to
-the device, even if that was not the intention of the caller. Right
-now software nodes can not be reused or shared because of that.
-
-So device_del() can not unregister the software nodes unconditionally
-like that. Unfortunately some of the users of device_add_properties()
-are now relying on this behaviour. Because of that, and also in
-general, we do need a function that can offer similar behaviour where
-the lifetime of the software node is bound to the lifetime of the
-device. But it just has to be a separate function so the behaviour is
-optional. We can not remove the device_remove_properties() call from
-device_del() before we have that new function, and before we have
-replaced device_add_properties() calls with it in all the places that
-require that behaviour.
-
-This adds function device_create_managed_software_node() that can be
-used for exactly that purpose. Software nodes created with it are
-declared "managed", and separate handling for those nodes is added to
-the software node code. The reference count of the "managed" nodes is
-decremented when the device they are attached to is removed. This will
-not affect the other nodes that are not declared "managed".
-
-The function device_create_managed_software_node() has also one
-additional feature that device_add_properties() does not have. It
-allows the software nodes created with it to be part of a node
-hierarchy by taking also an optional parent node as parameter.
-
-Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-Link: https://lore.kernel.org/r/20210204141711.53775-2-heikki.krogerus@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: dbcbfd662a72 ("platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/base/swnode.c | 43 ++++++++++++++++++++++++++++++++++++++++
- include/linux/property.h | 4 ++++
- 2 files changed, 47 insertions(+)
-
-diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
-index ad66d7c545f92..f9069180f2428 100644
---- a/drivers/base/swnode.c
-+++ b/drivers/base/swnode.c
-@@ -24,6 +24,7 @@ struct swnode {
- struct swnode *parent;
-
- unsigned int allocated:1;
-+ unsigned int managed:1;
- };
-
- static DEFINE_IDA(swnode_root_ids);
-@@ -913,6 +914,43 @@ void device_remove_software_node(struct device *dev)
- }
- EXPORT_SYMBOL_GPL(device_remove_software_node);
-
-+/**
-+ * device_create_managed_software_node - Create a software node for a device
-+ * @dev: The device the software node is assigned to.
-+ * @properties: Device properties for the software node.
-+ * @parent: Parent of the software node.
-+ *
-+ * Creates a software node as a managed resource for @dev, which means the
-+ * lifetime of the newly created software node is tied to the lifetime of @dev.
-+ * Software nodes created with this function should not be reused or shared
-+ * because of that. The function takes a deep copy of @properties for the
-+ * software node.
-+ *
-+ * Since the new software node is assigned directly to @dev, and since it should
-+ * not be shared, it is not returned to the caller. The function returns 0 on
-+ * success, and errno in case of an error.
-+ */
-+int device_create_managed_software_node(struct device *dev,
-+ const struct property_entry *properties,
-+ const struct software_node *parent)
-+{
-+ struct fwnode_handle *p = software_node_fwnode(parent);
-+ struct fwnode_handle *fwnode;
-+
-+ if (parent && !p)
-+ return -EINVAL;
-+
-+ fwnode = fwnode_create_software_node(properties, p);
-+ if (IS_ERR(fwnode))
-+ return PTR_ERR(fwnode);
-+
-+ to_swnode(fwnode)->managed = true;
-+ set_secondary_fwnode(dev, fwnode);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(device_create_managed_software_node);
-+
- int software_node_notify(struct device *dev, unsigned long action)
- {
- struct swnode *swnode;
-@@ -941,6 +979,11 @@ int software_node_notify(struct device *dev, unsigned long action)
- sysfs_remove_link(&swnode->kobj, dev_name(dev));
- sysfs_remove_link(&dev->kobj, "software_node");
- kobject_put(&swnode->kobj);
-+
-+ if (swnode->managed) {
-+ set_secondary_fwnode(dev, NULL);
-+ kobject_put(&swnode->kobj);
-+ }
- break;
- default:
- break;
-diff --git a/include/linux/property.h b/include/linux/property.h
-index 3b6093f6bd04c..d339b835c7766 100644
---- a/include/linux/property.h
-+++ b/include/linux/property.h
-@@ -488,4 +488,8 @@ void fwnode_remove_software_node(struct fwnode_handle *fwnode);
- int device_add_software_node(struct device *dev, const struct software_node *swnode);
- void device_remove_software_node(struct device *dev);
-
-+int device_create_managed_software_node(struct device *dev,
-+ const struct property_entry *properties,
-+ const struct software_node *parent);
-+
- #endif /* _LINUX_PROPERTY_H_ */
---
-2.43.0
-