[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251223-i2c-ada-dev-set-node-v1-1-2e36e0e785b4@oss.qualcomm.com>
Date: Tue, 23 Dec 2025 11:06:48 +0100
From: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Jan Dabros <jsd@...ihalf.com>, Andi Shyti <andi.shyti@...nel.org>,
Lixu Zhang <lixu.zhang@...el.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Binbin Zhou <zhoubinbin@...ngson.cn>,
Fabrizio Castro <fabrizio.castro.jz@...esas.com>,
Israel Cepeda <israel.a.cepeda.lopez@...el.com>,
Hans de Goede <hansg@...nel.org>
Cc: Bartosz Golaszewski <brgl@...nel.org>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
Subject: [PATCH 1/7] i2c: provide i2c_adapter_set_node()
Provide a wrapper around device_set_node() that takes the i2c_adapter as
argument. This allows us to hide more dereferencing of the embedded
struct device as part of working towards fixing the object lifetime
issues in i2c.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
---
include/linux/i2c.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 20fd41b51d5c85ee1665395c07345faafd8e2fca..38448bdfac671adcdf341adbe2f52341e5aec41a 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -29,6 +29,7 @@ extern const struct device_type i2c_client_type;
/* --- General options ------------------------------------------------ */
+struct fwnode_handle;
struct i2c_msg;
struct i2c_adapter;
struct i2c_client;
@@ -778,6 +779,12 @@ static inline void i2c_set_adapdata(struct i2c_adapter *adap, void *data)
dev_set_drvdata(&adap->dev, data);
}
+static inline void i2c_adapter_set_node(struct i2c_adapter *adap,
+ struct fwnode_handle *fwnode)
+{
+ device_set_node(&adap->dev, fwnode);
+}
+
static inline struct i2c_adapter *
i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
{
--
2.47.3
Powered by blists - more mailing lists