* [PATCH 1/7] i2c: provide i2c_adapter_set_node()
2025-12-23 10:06 [PATCH 0/7] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
@ 2025-12-23 10:06 ` Bartosz Golaszewski
2025-12-23 10:06 ` [PATCH 2/7] i2c: designware-common: use i2c_adapter_set_node() Bartosz Golaszewski
` (6 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:06 UTC (permalink / raw)
To: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc,
Bartosz Golaszewski
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@oss.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
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 2/7] i2c: designware-common: use i2c_adapter_set_node()
2025-12-23 10:06 [PATCH 0/7] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
2025-12-23 10:06 ` [PATCH 1/7] i2c: provide i2c_adapter_set_node() Bartosz Golaszewski
@ 2025-12-23 10:06 ` Bartosz Golaszewski
2025-12-30 10:29 ` Mika Westerberg
2025-12-23 10:06 ` [PATCH 3/7] i2c: gpio: " Bartosz Golaszewski
` (5 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:06 UTC (permalink / raw)
To: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc,
Bartosz Golaszewski
Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
This allows us to hide the dereferencing of the embedded struct device.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-designware-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index 5b1e8f74c4acf4ca875beb1fdc736a89e4a357b9..c9644c927b4adf29dccf7e377bfed744844c5512 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -743,7 +743,7 @@ EXPORT_SYMBOL_GPL(i2c_dw_disable);
int i2c_dw_probe(struct dw_i2c_dev *dev)
{
- device_set_node(&dev->adapter.dev, dev_fwnode(dev->dev));
+ i2c_adapter_set_node(&dev->adapter, dev_fwnode(dev->dev));
switch (dev->mode) {
case DW_IC_SLAVE:
--
2.47.3
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 2/7] i2c: designware-common: use i2c_adapter_set_node()
2025-12-23 10:06 ` [PATCH 2/7] i2c: designware-common: use i2c_adapter_set_node() Bartosz Golaszewski
@ 2025-12-30 10:29 ` Mika Westerberg
0 siblings, 0 replies; 17+ messages in thread
From: Mika Westerberg @ 2025-12-30 10:29 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Wolfram Sang, Andy Shevchenko, Jan Dabros, Andi Shyti, Lixu Zhang,
Sakari Ailus, Binbin Zhou, Fabrizio Castro, Israel Cepeda,
Hans de Goede, Bartosz Golaszewski, linux-i2c, linux-kernel,
linux-renesas-soc
On Tue, Dec 23, 2025 at 11:06:49AM +0100, Bartosz Golaszewski wrote:
> Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
> This allows us to hide the dereferencing of the embedded struct device.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/7] i2c: gpio: use i2c_adapter_set_node()
2025-12-23 10:06 [PATCH 0/7] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
2025-12-23 10:06 ` [PATCH 1/7] i2c: provide i2c_adapter_set_node() Bartosz Golaszewski
2025-12-23 10:06 ` [PATCH 2/7] i2c: designware-common: use i2c_adapter_set_node() Bartosz Golaszewski
@ 2025-12-23 10:06 ` Bartosz Golaszewski
2026-01-15 18:28 ` Wolfram Sang
2025-12-23 10:06 ` [PATCH 4/7] i2c: ljca: " Bartosz Golaszewski
` (4 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:06 UTC (permalink / raw)
To: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc,
Bartosz Golaszewski
Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
This allows us to hide the dereferencing of the embedded struct device.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index f4355b17bfbf15c402e71096ccbb99f5a35bb479..4984736969e1bf2d11620772214cb13ceb411b6a 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -426,7 +426,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)
adap->algo_data = bit_data;
adap->class = I2C_CLASS_HWMON;
adap->dev.parent = dev;
- device_set_node(&adap->dev, fwnode);
+ i2c_adapter_set_node(adap, fwnode);
adap->nr = pdev->id;
ret = i2c_bit_add_numbered_bus(adap);
--
2.47.3
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 3/7] i2c: gpio: use i2c_adapter_set_node()
2025-12-23 10:06 ` [PATCH 3/7] i2c: gpio: " Bartosz Golaszewski
@ 2026-01-15 18:28 ` Wolfram Sang
2026-01-16 11:31 ` Bartosz Golaszewski
0 siblings, 1 reply; 17+ messages in thread
From: Wolfram Sang @ 2026-01-15 18:28 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Mika Westerberg, Andy Shevchenko, Jan Dabros, Andi Shyti,
Lixu Zhang, Sakari Ailus, Binbin Zhou, Fabrizio Castro,
Israel Cepeda, Hans de Goede, Bartosz Golaszewski, linux-i2c,
linux-kernel, linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 467 bytes --]
On Tue, Dec 23, 2025 at 11:06:50AM +0100, Bartosz Golaszewski wrote:
> Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
> This allows us to hide the dereferencing of the embedded struct device.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Applying this patch fails for me. What is your base? I don't have the
commit referenced in the first patch series. I tried current top-of-tree
and current -next.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/7] i2c: gpio: use i2c_adapter_set_node()
2026-01-15 18:28 ` Wolfram Sang
@ 2026-01-16 11:31 ` Bartosz Golaszewski
0 siblings, 0 replies; 17+ messages in thread
From: Bartosz Golaszewski @ 2026-01-16 11:31 UTC (permalink / raw)
To: Wolfram Sang
Cc: Mika Westerberg, Andy Shevchenko, Jan Dabros, Andi Shyti,
Lixu Zhang, Sakari Ailus, Binbin Zhou, Fabrizio Castro,
Israel Cepeda, Hans de Goede, Bartosz Golaszewski, linux-i2c,
linux-kernel, linux-renesas-soc, Bartosz Golaszewski
On Thu, 15 Jan 2026 19:28:51 +0100, Wolfram Sang
<wsa+renesas@sang-engineering.com> said:
> On Tue, Dec 23, 2025 at 11:06:50AM +0100, Bartosz Golaszewski wrote:
>> Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
>> This allows us to hide the dereferencing of the embedded struct device.
>>
>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>
> Applying this patch fails for me. What is your base? I don't have the
> commit referenced in the first patch series. I tried current top-of-tree
> and current -next.
>
It's v6.19-rc2:
$ git show 9448598b22c50c8a5bb77a9103e2d49f134c9578
commit 9448598b22c50c8a5bb77a9103e2d49f134c9578 (tag: v6.19-rc2)
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun Dec 21 15:52:04 2025 -0800
Linux 6.19-rc2
Bart
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/7] i2c: ljca: use i2c_adapter_set_node()
2025-12-23 10:06 [PATCH 0/7] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (2 preceding siblings ...)
2025-12-23 10:06 ` [PATCH 3/7] i2c: gpio: " Bartosz Golaszewski
@ 2025-12-23 10:06 ` Bartosz Golaszewski
2025-12-30 0:40 ` Zhang, Lixu
2025-12-30 10:03 ` Sakari Ailus
2025-12-23 10:06 ` [PATCH 5/7] i2c: ls2x: " Bartosz Golaszewski
` (3 subsequent siblings)
7 siblings, 2 replies; 17+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:06 UTC (permalink / raw)
To: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc,
Bartosz Golaszewski
Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
This allows us to hide the dereferencing of the embedded struct device.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-ljca.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-ljca.c b/drivers/i2c/busses/i2c-ljca.c
index 93274f0c2d72166bf017f65af797f418743b6a57..fb45019b1a0c583f19bce3523983a79d632da3da 100644
--- a/drivers/i2c/busses/i2c-ljca.c
+++ b/drivers/i2c/busses/i2c-ljca.c
@@ -294,7 +294,7 @@ static int ljca_i2c_probe(struct auxiliary_device *auxdev,
dev_name(&auxdev->dev), dev_name(auxdev->dev.parent),
ljca_i2c->i2c_info->id);
- device_set_node(&ljca_i2c->adap.dev, dev_fwnode(&auxdev->dev));
+ i2c_adapter_set_node(&ljca_i2c->adap, dev_fwnode(&auxdev->dev));
i2c_set_adapdata(&ljca_i2c->adap, ljca_i2c);
auxiliary_set_drvdata(auxdev, ljca_i2c);
--
2.47.3
^ permalink raw reply related [flat|nested] 17+ messages in thread* RE: [PATCH 4/7] i2c: ljca: use i2c_adapter_set_node()
2025-12-23 10:06 ` [PATCH 4/7] i2c: ljca: " Bartosz Golaszewski
@ 2025-12-30 0:40 ` Zhang, Lixu
2025-12-30 10:03 ` Sakari Ailus
1 sibling, 0 replies; 17+ messages in thread
From: Zhang, Lixu @ 2025-12-30 0:40 UTC (permalink / raw)
To: Bartosz Golaszewski, Wolfram Sang, Mika Westerberg,
Andy Shevchenko, Jan Dabros, Andi Shyti, Sakari Ailus,
Binbin Zhou, Fabrizio Castro, Cepeda Lopez, Israel A,
Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org
>-----Original Message-----
>From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>Sent: Tuesday, December 23, 2025 6:07 PM
>To: Wolfram Sang <wsa+renesas@sang-engineering.com>; Mika Westerberg
><mika.westerberg@linux.intel.com>; Andy Shevchenko
><andriy.shevchenko@linux.intel.com>; Jan Dabros <jsd@semihalf.com>; Andi
>Shyti <andi.shyti@kernel.org>; Zhang, Lixu <lixu.zhang@intel.com>; Sakari
>Ailus <sakari.ailus@linux.intel.com>; Binbin Zhou <zhoubinbin@loongson.cn>;
>Fabrizio Castro <fabrizio.castro.jz@renesas.com>; Cepeda Lopez, Israel A
><israel.a.cepeda.lopez@intel.com>; Hans de Goede <hansg@kernel.org>
>Cc: Bartosz Golaszewski <brgl@kernel.org>; linux-i2c@vger.kernel.org; linux-
>kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org; Bartosz
>Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>Subject: [PATCH 4/7] i2c: ljca: use i2c_adapter_set_node()
>
>Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
>This allows us to hide the dereferencing of the embedded struct device.
>
>Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Zhang Lixu <lixu.zhang@intel.com>
Thanks,
Lixu
>---
> drivers/i2c/busses/i2c-ljca.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/i2c/busses/i2c-ljca.c b/drivers/i2c/busses/i2c-ljca.c index
>93274f0c2d72166bf017f65af797f418743b6a57..fb45019b1a0c583f19bce3523
>983a79d632da3da 100644
>--- a/drivers/i2c/busses/i2c-ljca.c
>+++ b/drivers/i2c/busses/i2c-ljca.c
>@@ -294,7 +294,7 @@ static int ljca_i2c_probe(struct auxiliary_device
>*auxdev,
> dev_name(&auxdev->dev), dev_name(auxdev->dev.parent),
> ljca_i2c->i2c_info->id);
>
>- device_set_node(&ljca_i2c->adap.dev, dev_fwnode(&auxdev->dev));
>+ i2c_adapter_set_node(&ljca_i2c->adap, dev_fwnode(&auxdev->dev));
>
> i2c_set_adapdata(&ljca_i2c->adap, ljca_i2c);
> auxiliary_set_drvdata(auxdev, ljca_i2c);
>
>--
>2.47.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/7] i2c: ljca: use i2c_adapter_set_node()
2025-12-23 10:06 ` [PATCH 4/7] i2c: ljca: " Bartosz Golaszewski
2025-12-30 0:40 ` Zhang, Lixu
@ 2025-12-30 10:03 ` Sakari Ailus
1 sibling, 0 replies; 17+ messages in thread
From: Sakari Ailus @ 2025-12-30 10:03 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Binbin Zhou, Fabrizio Castro,
Israel Cepeda, Hans de Goede, Bartosz Golaszewski, linux-i2c,
linux-kernel, linux-renesas-soc
On Tue, Dec 23, 2025 at 11:06:51AM +0100, Bartosz Golaszewski wrote:
> Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
> This allows us to hide the dereferencing of the embedded struct device.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 5/7] i2c: ls2x: use i2c_adapter_set_node()
2025-12-23 10:06 [PATCH 0/7] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (3 preceding siblings ...)
2025-12-23 10:06 ` [PATCH 4/7] i2c: ljca: " Bartosz Golaszewski
@ 2025-12-23 10:06 ` Bartosz Golaszewski
2025-12-30 10:39 ` Binbin Zhou
2025-12-23 10:06 ` [PATCH 6/7] i2c: rzv2m: " Bartosz Golaszewski
` (2 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:06 UTC (permalink / raw)
To: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc,
Bartosz Golaszewski
Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
This allows us to hide the dereferencing of the embedded struct device.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-ls2x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-ls2x.c b/drivers/i2c/busses/i2c-ls2x.c
index b475dd27b7af94a22537f1000e95606774d6c7f2..217a55d7d90b2e515ef33e9014263958d9258b00 100644
--- a/drivers/i2c/busses/i2c-ls2x.c
+++ b/drivers/i2c/busses/i2c-ls2x.c
@@ -312,7 +312,7 @@ static int ls2x_i2c_probe(struct platform_device *pdev)
adap->owner = THIS_MODULE;
adap->algo = &ls2x_i2c_algo;
adap->timeout = msecs_to_jiffies(100);
- device_set_node(&adap->dev, dev_fwnode(dev));
+ i2c_adapter_set_node(adap, dev_fwnode(dev));
i2c_set_adapdata(adap, priv);
strscpy(adap->name, pdev->name, sizeof(adap->name));
init_completion(&priv->cmd_complete);
--
2.47.3
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 5/7] i2c: ls2x: use i2c_adapter_set_node()
2025-12-23 10:06 ` [PATCH 5/7] i2c: ls2x: " Bartosz Golaszewski
@ 2025-12-30 10:39 ` Binbin Zhou
0 siblings, 0 replies; 17+ messages in thread
From: Binbin Zhou @ 2025-12-30 10:39 UTC (permalink / raw)
To: Bartosz Golaszewski, Wolfram Sang, Mika Westerberg,
Andy Shevchenko, Jan Dabros, Andi Shyti, Lixu Zhang, Sakari Ailus,
Fabrizio Castro, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc
On 2025/12/23 18:06, Bartosz Golaszewski wrote:
> Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
> This allows us to hide the dereferencing of the embedded struct device.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
> drivers/i2c/busses/i2c-ls2x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-ls2x.c b/drivers/i2c/busses/i2c-ls2x.c
> index b475dd27b7af94a22537f1000e95606774d6c7f2..217a55d7d90b2e515ef33e9014263958d9258b00 100644
> --- a/drivers/i2c/busses/i2c-ls2x.c
> +++ b/drivers/i2c/busses/i2c-ls2x.c
> @@ -312,7 +312,7 @@ static int ls2x_i2c_probe(struct platform_device *pdev)
> adap->owner = THIS_MODULE;
> adap->algo = &ls2x_i2c_algo;
> adap->timeout = msecs_to_jiffies(100);
> - device_set_node(&adap->dev, dev_fwnode(dev));
> + i2c_adapter_set_node(adap, dev_fwnode(dev));
> i2c_set_adapdata(adap, priv);
> strscpy(adap->name, pdev->name, sizeof(adap->name));
> init_completion(&priv->cmd_complete);
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 6/7] i2c: rzv2m: use i2c_adapter_set_node()
2025-12-23 10:06 [PATCH 0/7] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (4 preceding siblings ...)
2025-12-23 10:06 ` [PATCH 5/7] i2c: ls2x: " Bartosz Golaszewski
@ 2025-12-23 10:06 ` Bartosz Golaszewski
2026-01-05 9:14 ` Fabrizio Castro
2025-12-23 10:06 ` [PATCH 7/7] i2c: usbio: " Bartosz Golaszewski
2025-12-27 14:33 ` [PATCH 0/7] i2c: provide and " Andy Shevchenko
7 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:06 UTC (permalink / raw)
To: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc,
Bartosz Golaszewski
Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
This allows us to hide the dereferencing of the embedded struct device.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-rzv2m.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-rzv2m.c b/drivers/i2c/busses/i2c-rzv2m.c
index 2387148506736a65378809971bfbddfb436b6c4d..f31d5b90802477a3d27557a4a92ca2b26023e343 100644
--- a/drivers/i2c/busses/i2c-rzv2m.c
+++ b/drivers/i2c/busses/i2c-rzv2m.c
@@ -451,7 +451,7 @@ static int rzv2m_i2c_probe(struct platform_device *pdev)
adap->quirks = &rzv2m_i2c_quirks;
adap->dev.parent = dev;
adap->owner = THIS_MODULE;
- device_set_node(&adap->dev, dev_fwnode(dev));
+ i2c_adapter_set_node(adap, dev_fwnode(dev));
i2c_set_adapdata(adap, priv);
strscpy(adap->name, pdev->name, sizeof(adap->name));
init_completion(&priv->msg_tia_done);
--
2.47.3
^ permalink raw reply related [flat|nested] 17+ messages in thread* RE: [PATCH 6/7] i2c: rzv2m: use i2c_adapter_set_node()
2025-12-23 10:06 ` [PATCH 6/7] i2c: rzv2m: " Bartosz Golaszewski
@ 2026-01-05 9:14 ` Fabrizio Castro
0 siblings, 0 replies; 17+ messages in thread
From: Fabrizio Castro @ 2026-01-05 9:14 UTC (permalink / raw)
To: Bartosz Golaszewski, wsa+renesas, Mika Westerberg,
Andy Shevchenko, Jan Dabros, Andi Shyti, Lixu Zhang, Sakari Ailus,
Binbin Zhou, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org
> From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Sent: 23 December 2025 10:07
> To: wsa+renesas <wsa+renesas@sang-engineering.com>; Mika Westerberg <mika.westerberg@linux.intel.com>;
> Andy Shevchenko <andriy.shevchenko@linux.intel.com>; Jan Dabros <jsd@semihalf.com>; Andi Shyti
> <andi.shyti@kernel.org>; Lixu Zhang <lixu.zhang@intel.com>; Sakari Ailus
> <sakari.ailus@linux.intel.com>; Binbin Zhou <zhoubinbin@loongson.cn>; Fabrizio Castro
> <fabrizio.castro.jz@renesas.com>; Israel Cepeda <israel.a.cepeda.lopez@intel.com>; Hans de Goede
> <hansg@kernel.org>
> Cc: Bartosz Golaszewski <brgl@kernel.org>; linux-i2c@vger.kernel.org; linux-kernel@vger.kernel.org;
> linux-renesas-soc@vger.kernel.org; Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Subject: [PATCH 6/7] i2c: rzv2m: use i2c_adapter_set_node()
>
> Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
> This allows us to hide the dereferencing of the embedded struct device.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> ---
> drivers/i2c/busses/i2c-rzv2m.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-rzv2m.c b/drivers/i2c/busses/i2c-rzv2m.c
> index 2387148506736a65378809971bfbddfb436b6c4d..f31d5b90802477a3d27557a4a92ca2b26023e343 100644
> --- a/drivers/i2c/busses/i2c-rzv2m.c
> +++ b/drivers/i2c/busses/i2c-rzv2m.c
> @@ -451,7 +451,7 @@ static int rzv2m_i2c_probe(struct platform_device *pdev)
> adap->quirks = &rzv2m_i2c_quirks;
> adap->dev.parent = dev;
> adap->owner = THIS_MODULE;
> - device_set_node(&adap->dev, dev_fwnode(dev));
> + i2c_adapter_set_node(adap, dev_fwnode(dev));
> i2c_set_adapdata(adap, priv);
> strscpy(adap->name, pdev->name, sizeof(adap->name));
> init_completion(&priv->msg_tia_done);
>
> --
> 2.47.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 7/7] i2c: usbio: use i2c_adapter_set_node()
2025-12-23 10:06 [PATCH 0/7] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (5 preceding siblings ...)
2025-12-23 10:06 ` [PATCH 6/7] i2c: rzv2m: " Bartosz Golaszewski
@ 2025-12-23 10:06 ` Bartosz Golaszewski
2025-12-30 10:04 ` Sakari Ailus
2025-12-27 14:33 ` [PATCH 0/7] i2c: provide and " Andy Shevchenko
7 siblings, 1 reply; 17+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:06 UTC (permalink / raw)
To: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede
Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc,
Bartosz Golaszewski
Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
This allows us to hide the dereferencing of the embedded struct device.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-usbio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-usbio.c b/drivers/i2c/busses/i2c-usbio.c
index e7799abf67877906c7787235bddb28ac23168077..4824d61fc85d7b23fd7f6a8c2be5809ad9fe2613 100644
--- a/drivers/i2c/busses/i2c-usbio.c
+++ b/drivers/i2c/busses/i2c-usbio.c
@@ -278,7 +278,7 @@ static int usbio_i2c_probe(struct auxiliary_device *adev,
snprintf(i2c->adap.name, sizeof(i2c->adap.name), "%s.%d",
USBIO_I2C_CLIENT, i2c->adev->id);
- device_set_node(&i2c->adap.dev, dev_fwnode(&adev->dev));
+ i2c_adapter_set_node(&i2c->adap, dev_fwnode(&adev->dev));
auxiliary_set_drvdata(adev, i2c);
i2c_set_adapdata(&i2c->adap, i2c);
--
2.47.3
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 7/7] i2c: usbio: use i2c_adapter_set_node()
2025-12-23 10:06 ` [PATCH 7/7] i2c: usbio: " Bartosz Golaszewski
@ 2025-12-30 10:04 ` Sakari Ailus
0 siblings, 0 replies; 17+ messages in thread
From: Sakari Ailus @ 2025-12-30 10:04 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Wolfram Sang, Mika Westerberg, Andy Shevchenko, Jan Dabros,
Andi Shyti, Lixu Zhang, Binbin Zhou, Fabrizio Castro,
Israel Cepeda, Hans de Goede, Bartosz Golaszewski, linux-i2c,
linux-kernel, linux-renesas-soc
On Tue, Dec 23, 2025 at 11:06:54AM +0100, Bartosz Golaszewski wrote:
> Use the dedicated wrapper for setting the fwnode of the i2c_adapter.
> This allows us to hide the dereferencing of the embedded struct device.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/7] i2c: provide and use i2c_adapter_set_node()
2025-12-23 10:06 [PATCH 0/7] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (6 preceding siblings ...)
2025-12-23 10:06 ` [PATCH 7/7] i2c: usbio: " Bartosz Golaszewski
@ 2025-12-27 14:33 ` Andy Shevchenko
7 siblings, 0 replies; 17+ messages in thread
From: Andy Shevchenko @ 2025-12-27 14:33 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Wolfram Sang, Mika Westerberg, Jan Dabros, Andi Shyti, Lixu Zhang,
Sakari Ailus, Binbin Zhou, Fabrizio Castro, Israel Cepeda,
Hans de Goede, Bartosz Golaszewski, linux-i2c, linux-kernel,
linux-renesas-soc
On Tue, Dec 23, 2025 at 11:06:47AM +0100, Bartosz Golaszewski wrote:
> It's been another year of discussing the object life-time problems at
> conferences. I2C is one of the offenders and its problems are more
> complex than those of some other subsystems. It seems the revocable[1]
> API may make its way into the kernel this year but even with it in
> place, I2C won't be able to use it as there's currently nothing to
> *revoke*. The struct device is embedded within the i2c_adapter struct
> whose lifetime is tied to the provider device being bound to its driver.
>
> Fixing this won't be fast and easy but nothing's going to happen if we
> don't start chipping away at it. The ultimate goal in order to be able
> to use an SRCU-based solution (revocable or otherwise) is to convert the
> embedded struct device in struct i2c_adapter into an __rcu pointer that
> can be *revoked*. To that end we need to hide all dereferences of
> adap->dev in drivers.
>
> I2C drivers use device_set_node() to assign a firmware node directly to
> the struct device embedded in i2c_adapter. In order to hide the direct
> dereferencing: provide a dedicated interface that wraps the call to
> device_set_node() but takes the adapter as argument instead.
> [1] https://lore.kernel.org/all/20251106152330.11733-1-tzungbi@kernel.org/
Can be also made as a Link tag and some people use `b4 shazam`, that uses the
above test as a merge commit message where other tags are also being
recognized.
Have no objection and code looks good,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 17+ messages in thread