[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251015071420.1173068-3-herve.codina@bootlin.com>
Date: Wed, 15 Oct 2025 09:13:49 +0200
From: Herve Codina <herve.codina@...tlin.com>
To: Andrew Lunn <andrew@...n.ch>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Andi Shyti <andi.shyti@...nel.org>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Peter Rosin <peda@...ntia.se>,
Arnd Bergmann <arnd@...db.de>,
Herve Codina <herve.codina@...tlin.com>,
Saravana Kannan <saravanak@...gle.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Charles Keepax <ckeepax@...nsource.cirrus.com>,
Richard Fitzgerald <rf@...nsource.cirrus.com>,
David Rhodes <david.rhodes@...rus.com>,
Linus Walleij <linus.walleij@...aro.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Mark Brown <broonie@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Len Brown <lenb@...nel.org>,
Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Geert Uytterhoeven <geert+renesas@...der.be>
Cc: Wolfram Sang <wsa@...nel.org>,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org,
linux-clk@...r.kernel.org,
linux-i2c@...r.kernel.org,
linux-pci@...r.kernel.org,
linux-sound@...r.kernel.org,
patches@...nsource.cirrus.com,
linux-gpio@...r.kernel.org,
linux-pm@...r.kernel.org,
linux-spi@...r.kernel.org,
linux-acpi@...r.kernel.org,
linux-cxl@...r.kernel.org,
Allan Nielsen <allan.nielsen@...rochip.com>,
Horatiu Vultur <horatiu.vultur@...rochip.com>,
Steen Hegelund <steen.hegelund@...rochip.com>,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: [PATCH v4 02/29] driver core: Rename get_dev_from_fwnode() wrapper to get_device_from_fwnode()
get_dev_from_fwnode() calls get_device() and so it acquires a reference
on the device returned.
In order to be more obvious that this wrapper is a get_device() variant,
rename it to get_device_from_fwnode().
Suggested-by: Mark Brown <broonie@...nel.org>
Link: https://lore.kernel.org/lkml/CAGETcx97QjnjVR8Z5g0ndLHpK96hLd4aYSV=iEkKPNbNOccYmA@mail.gmail.com/
Signed-off-by: Herve Codina <herve.codina@...tlin.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Reviewed-by: Saravana Kannan <saravanak@...gle.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
---
drivers/base/core.c | 18 +++++++++---------
drivers/pmdomain/core.c | 4 ++--
include/linux/device.h | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 3c533dab8fa5..334f5a4fbb9e 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1888,7 +1888,7 @@ static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
if (!(fwnode->flags & FWNODE_FLAG_INITIALIZED))
return false;
- dev = get_dev_from_fwnode(fwnode);
+ dev = get_device_from_fwnode(fwnode);
ret = !dev || dev->links.status == DL_DEV_NO_DRIVER;
put_device(dev);
@@ -1957,7 +1957,7 @@ static struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwn
struct device *dev;
fwnode_for_each_parent_node(fwnode, parent) {
- dev = get_dev_from_fwnode(parent);
+ dev = get_device_from_fwnode(parent);
if (dev) {
fwnode_handle_put(parent);
return dev;
@@ -2013,8 +2013,8 @@ static bool __fw_devlink_relax_cycles(struct fwnode_handle *con_handle,
goto out;
}
- sup_dev = get_dev_from_fwnode(sup_handle);
- con_dev = get_dev_from_fwnode(con_handle);
+ sup_dev = get_device_from_fwnode(sup_handle);
+ con_dev = get_device_from_fwnode(con_handle);
/*
* If sup_dev is bound to a driver and @con hasn't started binding to a
* driver, sup_dev can't be a consumer of @con. So, no need to check
@@ -2153,7 +2153,7 @@ static int fw_devlink_create_devlink(struct device *con,
if (sup_handle->flags & FWNODE_FLAG_NOT_DEVICE)
sup_dev = fwnode_get_next_parent_dev(sup_handle);
else
- sup_dev = get_dev_from_fwnode(sup_handle);
+ sup_dev = get_device_from_fwnode(sup_handle);
if (sup_dev) {
/*
@@ -2222,7 +2222,7 @@ static void __fw_devlink_link_to_consumers(struct device *dev)
bool own_link = true;
int ret;
- con_dev = get_dev_from_fwnode(link->consumer);
+ con_dev = get_device_from_fwnode(link->consumer);
/*
* If consumer device is not available yet, make a "proxy"
* SYNC_STATE_ONLY link from the consumer's parent device to
@@ -5279,7 +5279,7 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode)
EXPORT_SYMBOL_GPL(device_set_node);
/**
- * get_dev_from_fwnode - Obtain a reference count of the struct device the
+ * get_device_from_fwnode - Obtain a reference count of the struct device the
* struct fwnode_handle is associated with.
* @fwnode: The pointer to the struct fwnode_handle to obtain the struct device
* reference count of.
@@ -5297,11 +5297,11 @@ EXPORT_SYMBOL_GPL(device_set_node);
* This is possible since struct fwnode_handle has its own reference count and
* hence can out-live the struct device it is associated with.
*/
-struct device *get_dev_from_fwnode(struct fwnode_handle *fwnode)
+struct device *get_device_from_fwnode(struct fwnode_handle *fwnode)
{
return get_device((fwnode)->dev);
}
-EXPORT_SYMBOL_GPL(get_dev_from_fwnode);
+EXPORT_SYMBOL_GPL(get_device_from_fwnode);
int device_match_name(struct device *dev, const void *name)
{
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 61c2277c9ce3..5a7822de5d8a 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -2678,7 +2678,7 @@ int of_genpd_add_provider_simple(struct device_node *np,
genpd->dev.of_node = np;
fwnode = of_fwnode_handle(np);
- dev = get_dev_from_fwnode(fwnode);
+ dev = get_device_from_fwnode(fwnode);
if (!dev && !genpd_is_no_sync_state(genpd)) {
genpd->sync_state = GENPD_SYNC_STATE_SIMPLE;
device_set_node(&genpd->dev, fwnode);
@@ -2753,7 +2753,7 @@ int of_genpd_add_provider_onecell(struct device_node *np,
data->xlate = genpd_xlate_onecell;
fwnode = of_fwnode_handle(np);
- dev = get_dev_from_fwnode(fwnode);
+ dev = get_device_from_fwnode(fwnode);
if (!dev)
sync_state = true;
else
diff --git a/include/linux/device.h b/include/linux/device.h
index b031ff71a5bd..d8906136c086 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1090,7 +1090,7 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode);
int device_add_of_node(struct device *dev, struct device_node *of_node);
void device_remove_of_node(struct device *dev);
void device_set_of_node_from_dev(struct device *dev, const struct device *dev2);
-struct device *get_dev_from_fwnode(struct fwnode_handle *fwnode);
+struct device *get_device_from_fwnode(struct fwnode_handle *fwnode);
static inline struct device_node *dev_of_node(struct device *dev)
{
--
2.51.0
Powered by blists - more mailing lists