linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/4] mfd: core: Add support for software nodes
@ 2021-03-01 14:42 Andy Shevchenko
  2021-03-01 14:42 ` [PATCH v1 2/4] mfd: intel-lpss: Constify device property structures Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Andy Shevchenko @ 2021-03-01 14:42 UTC (permalink / raw)
  To: Andy Shevchenko, Heikki Krogerus, Lee Jones, linux-kernel

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>

The old device property API is going to be removed and
replaced with the newer software node API. This prepares MFD
subsystem for the transition.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/mfd-core.c   | 9 +++++++++
 include/linux/mfd/core.h | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index fc00aaccb5f7..e24008b94aac 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -244,6 +244,12 @@ static int mfd_add_device(struct device *parent, int id,
 			goto fail_of_entry;
 	}
 
+	if (cell->swnode) {
+		ret = device_add_software_node(&pdev->dev, cell->swnode);
+		if (ret)
+			goto fail_of_entry;
+	}
+
 	for (r = 0; r < cell->num_resources; r++) {
 		res[r].name = cell->resources[r].name;
 		res[r].flags = cell->resources[r].flags;
@@ -304,6 +310,7 @@ static int mfd_add_device(struct device *parent, int id,
 			list_del(&of_entry->list);
 			kfree(of_entry);
 		}
+	device_remove_software_node(&pdev->dev);
 fail_alias:
 	regulator_bulk_unregister_supply_alias(&pdev->dev,
 					       cell->parent_supplies,
@@ -372,6 +379,8 @@ static int mfd_remove_devices_fn(struct device *dev, void *data)
 	regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies,
 					       cell->num_parent_supplies);
 
+	device_remove_software_node(&pdev->dev);
+
 	platform_device_unregister(pdev);
 	return 0;
 }
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 2009c4b936d9..9ec599167fe6 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -50,6 +50,7 @@
 #define MFD_DEP_LEVEL_HIGH 1
 
 struct irq_domain;
+struct software_node;
 struct property_entry;
 
 /* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
@@ -78,6 +79,9 @@ struct mfd_cell {
 	void			*platform_data;
 	size_t			pdata_size;
 
+	/* Software node for the device. */
+	const struct software_node *swnode;
+
 	/* device properties passed to the sub devices drivers */
 	const struct property_entry *properties;
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-22 14:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 14:42 [PATCH v1 1/4] mfd: core: Add support for software nodes Andy Shevchenko
2021-03-01 14:42 ` [PATCH v1 2/4] mfd: intel-lpss: Constify device property structures Andy Shevchenko
2021-03-22 14:39   ` Lee Jones
2021-03-01 14:42 ` [PATCH v1 3/4] mfd: intel-lpss: Switch to use the software nodes Andy Shevchenko
2021-03-22 14:39   ` Lee Jones
2021-03-01 14:42 ` [PATCH v1 4/4] mfd: core: Remove support for dangling device properties Andy Shevchenko
2021-03-22 14:39   ` Lee Jones
2021-03-22 14:38 ` [PATCH v1 1/4] mfd: core: Add support for software nodes Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).