From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AD3D3148CA; Wed, 15 Oct 2025 07:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760512592; cv=none; b=LoziJOl7ltKMoScP23iXrGJrQvDLWpSWTMYfw9Xl95ueo37HX9vErrH9PM41gQytx1VLhML6tpC5H0mq3/aEm8uK9d1CJSuJvcM8pZ4YC9G6BVkUCFe4pOJjRQfcfBgQyX0itLQ9ogTAs4SjpS0Tich0OY8fQvRzMUB2kn5cSWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760512592; c=relaxed/simple; bh=R4emF5BiDolITYJz6qnFHK9IF942ZqBBYiTQhGEY/ao=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eExT/33UjQndunubYyAzpGgCDte8e8E5PeUHhUMiQbdHKUb/oHC031YcYC4DtFP7fF2cTKbmQK3OYoCpCOYl+uZiteRFnWGe0Aq+XEQZA7ajTsKufHU1CY4/lrZNOk1V8xg6Ye7tgy9WnEUrjp77kBZ75ryhSGln3Ht3ZgM/XjI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=zn+9+KQ7; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="zn+9+KQ7" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id E26C94E410C3; Wed, 15 Oct 2025 07:16:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id AD388606FA; Wed, 15 Oct 2025 07:16:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 73A26102F22BC; Wed, 15 Oct 2025 09:16:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1760512584; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=2HI9mFzTw/gMNNYHCLXAP0BhEj2xYI91sMxshUb6nn0=; b=zn+9+KQ79/ujLiVbY+VcG43wyuivCwD+4v8Scq+JQ8DD1f48RbWnwjLuEepngTMR/0mqRw HrOiG5YJXBOh2M7cnr3K3/izSpb6ar0qvFc1nt9dHNwgEzuo3kVG79BWg0/OsgoGjXBTq2 GNa1xnx0RbnMsyJhfggbIzWvF4HY+3+699UHsqoy9pakeDimFaY6w+jsAYwxsjQduzmQrd EhNCkoSHdthnK/mMOrvEXwru5abk2S8QaoTrXYsRfG3Kl+lPCsgOVHTi67RECUfwLGHwR/ sRwL5ONHaSsOQS7JDzwHQfe1/S88i9r6m5XkVR7ngqqHJjsxmPw2ub4A21ABrQ== From: Herve Codina To: Andrew Lunn , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michael Turquette , Stephen Boyd , Andi Shyti , Wolfram Sang , Peter Rosin , Arnd Bergmann , Herve Codina , Saravana Kannan , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Ulf Hansson , Mark Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Geert Uytterhoeven Cc: Wolfram Sang , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-pm@vger.kernel.org, linux-spi@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni Subject: [PATCH v4 02/29] driver core: Rename get_dev_from_fwnode() wrapper to get_device_from_fwnode() Date: Wed, 15 Oct 2025 09:13:49 +0200 Message-ID: <20251015071420.1173068-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251015071420.1173068-1-herve.codina@bootlin.com> References: <20251015071420.1173068-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 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 Link: https://lore.kernel.org/lkml/CAGETcx97QjnjVR8Z5g0ndLHpK96hLd4aYSV=iEkKPNbNOccYmA@mail.gmail.com/ Signed-off-by: Herve Codina Reviewed-by: Andy Shevchenko Reviewed-by: Saravana Kannan Reviewed-by: Luca Ceresoli --- 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