public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Zijun Hu <zijun.hu@oss.qualcomm.com>,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	linux-acpi@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>, Len Brown <lenb@kernel.org>,
	Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: [PATCH v1 3/3] driver core: Split device related fwnode API to device/fwnode.h
Date: Mon, 23 Feb 2026 21:30:32 +0100	[thread overview]
Message-ID: <20260223204412.3298508-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260223204412.3298508-1-andriy.shevchenko@linux.intel.com>

device.h is a huge header which is hard to follow and easy to miss
something. Improve that by splitting device related fwnode API
to device/fwnode.h.

In particular this helps to speedup the build of the code that includes
device.h solely for a device related fwnode API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/device.h        | 17 +----------------
 include/linux/device/fwnode.h | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 16 deletions(-)
 create mode 100644 include/linux/device/fwnode.h

diff --git a/include/linux/device.h b/include/linux/device.h
index 4ba6ae72ddf6..d2e2745243ea 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -31,6 +31,7 @@
 #include <linux/device/devlink.h>
 #include <linux/device/devres.h>
 #include <linux/device/driver.h>
+#include <linux/device/fwnode.h>
 #include <linux/device/types.h>
 #include <linux/cleanup.h>
 
@@ -38,8 +39,6 @@ struct device_driver;
 struct module;
 struct class;
 struct subsys_private;
-struct device_node;
-struct fwnode_handle;
 
 /**
  * struct subsys_interface - interfaces to device functions
@@ -603,20 +602,6 @@ int lock_device_hotplug_sysfs(void);
 int device_offline(struct device *dev);
 int device_online(struct device *dev);
 
-void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
-void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
-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);
-
-static inline struct device_node *dev_of_node(struct device *dev)
-{
-	if (!IS_ENABLED(CONFIG_OF) || !dev)
-		return NULL;
-	return dev->of_node;
-}
-
 static inline int dev_num_vf(struct device *dev)
 {
 	if (dev->bus && dev->bus->num_vf)
diff --git a/include/linux/device/fwnode.h b/include/linux/device/fwnode.h
new file mode 100644
index 000000000000..4fe6107191a6
--- /dev/null
+++ b/include/linux/device/fwnode.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _DEVICE_FWNODE_H_
+#define _DEVICE_FWNODE_H_
+
+#include <linux/stddef.h>
+
+#include "types.h"
+
+struct device_node;
+struct fwnode_handle;
+
+void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
+void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
+
+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);
+
+static inline struct device_node *dev_of_node(struct device *dev)
+{
+	if (!IS_ENABLED(CONFIG_OF) || !dev)
+		return NULL;
+	return dev->of_node;
+}
+
+#endif /* _DEVICE_FWNODE_H_ */
-- 
2.50.1


  parent reply	other threads:[~2026-02-23 20:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 20:30 [PATCH v1 0/3] driver core: Split device.h even more Andy Shevchenko
2026-02-23 20:30 ` [PATCH v1 1/3] driver core: Split device data types to device/types.h Andy Shevchenko
2026-02-23 20:53   ` Rafael J. Wysocki
2026-02-24  9:05     ` Andy Shevchenko
2026-02-24 12:21       ` Rafael J. Wysocki
2026-02-24 13:17         ` Greg Kroah-Hartman
2026-02-24 13:47           ` Danilo Krummrich
2026-02-24 14:02           ` Andy Shevchenko
2026-02-24 14:30             ` Rafael J. Wysocki
2026-02-24 14:01         ` Andy Shevchenko
2026-02-24 14:34           ` Greg Kroah-Hartman
2026-02-23 20:30 ` [PATCH v1 2/3] driver core: Split device link data types and API to device/devlink.h Andy Shevchenko
2026-02-23 21:00   ` Rafael J. Wysocki
2026-02-23 20:30 ` Andy Shevchenko [this message]
2026-02-23 20:51   ` [PATCH v1 3/3] driver core: Split device related fwnode API to device/fwnode.h Rafael J. Wysocki
2026-02-24  0:33   ` Greg Kroah-Hartman
2026-02-24  9:03     ` Andy Shevchenko
2026-02-24  0:32 ` [PATCH v1 0/3] driver core: Split device.h even more Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260223204412.3298508-4-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dakr@kernel.org \
    --cc=djrscally@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=zijun.hu@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox