* [PATCH v2 1/9] i2c: provide i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 2/9] i2c: designware-common: use i2c_adapter_set_node() Bartosz Golaszewski
` (8 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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] 14+ messages in thread* [PATCH v2 2/9] i2c: designware-common: use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 1/9] i2c: provide i2c_adapter_set_node() Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 3/9] i2c: gpio: " Bartosz Golaszewski
` (7 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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 4dc57fd561703bc12a0c40889841571fd2943e70..3c761c4d818c12eb9721893d43a443374b8766d9 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -882,7 +882,7 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
unsigned long irq_flags;
int ret;
- device_set_node(&dev->adapter.dev, dev_fwnode(dev->dev));
+ i2c_adapter_set_node(adap, dev_fwnode(dev->dev));
ret = i2c_dw_init_regmap(dev);
if (ret)
--
2.47.3
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2 3/9] i2c: gpio: use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 1/9] i2c: provide i2c_adapter_set_node() Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 2/9] i2c: designware-common: use i2c_adapter_set_node() Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 4/9] i2c: ljca: " Bartosz Golaszewski
` (6 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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] 14+ messages in thread* [PATCH v2 4/9] i2c: ljca: use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (2 preceding siblings ...)
2026-02-23 9:08 ` [PATCH v2 3/9] i2c: gpio: " Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 5/9] i2c: ls2x: " Bartosz Golaszewski
` (5 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Zhang Lixu <lixu.zhang@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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] 14+ messages in thread* [PATCH v2 5/9] i2c: ls2x: use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (3 preceding siblings ...)
2026-02-23 9:08 ` [PATCH v2 4/9] i2c: ljca: " Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 6/9] i2c: rzv2m: " Bartosz Golaszewski
` (4 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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] 14+ messages in thread* [PATCH v2 6/9] i2c: rzv2m: use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (4 preceding siblings ...)
2026-02-23 9:08 ` [PATCH v2 5/9] i2c: ls2x: " Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 7/9] i2c: usbio: " Bartosz Golaszewski
` (3 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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] 14+ messages in thread* [PATCH v2 7/9] i2c: usbio: use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (5 preceding siblings ...)
2026-02-23 9:08 ` [PATCH v2 6/9] i2c: rzv2m: " Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-23 9:08 ` [PATCH v2 8/9] i2c: designware-amdisp: " Bartosz Golaszewski
` (2 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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] 14+ messages in thread* [PATCH v2 8/9] i2c: designware-amdisp: use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (6 preceding siblings ...)
2026-02-23 9:08 ` [PATCH v2 7/9] i2c: usbio: " Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-23 11:46 ` Andy Shevchenko
2026-02-23 9:08 ` [PATCH v2 9/9] i2c: viai2c-zhaoxin: " Bartosz Golaszewski
2026-02-26 20:25 ` [PATCH v2 0/9] i2c: provide and " Wolfram Sang
9 siblings, 1 reply; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-designware-amdisp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-designware-amdisp.c b/drivers/i2c/busses/i2c-designware-amdisp.c
index c48728ad9f6f25174515defe55603d67b2491b72..7cbfd441bb16ec1045a2546d55af3cce774b462a 100644
--- a/drivers/i2c/busses/i2c-designware-amdisp.c
+++ b/drivers/i2c/busses/i2c-designware-amdisp.c
@@ -61,7 +61,7 @@ static int amd_isp_dw_i2c_plat_probe(struct platform_device *pdev)
adap = &isp_i2c_dev->adapter;
adap->owner = THIS_MODULE;
scnprintf(adap->name, sizeof(adap->name), AMDISP_I2C_ADAP_NAME);
- ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
+ i2c_adapter_set_node(adap, dev_fwnode(&pdev->dev));
adap->dev.of_node = pdev->dev.of_node;
/* use dynamically allocated adapter id */
adap->nr = -1;
--
2.47.3
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2 8/9] i2c: designware-amdisp: use i2c_adapter_set_node()
2026-02-23 9:08 ` [PATCH v2 8/9] i2c: designware-amdisp: " Bartosz Golaszewski
@ 2026-02-23 11:46 ` Andy Shevchenko
2026-02-23 12:23 ` Bartosz Golaszewski
0 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2026-02-23 11:46 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, Nirujogi Pratap, Bin Du, Hans Hu,
Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc
On Mon, Feb 23, 2026 at 10:08:26AM +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.
This should be united with patch 2.
For this kind of patches I would not make the split like this.
But if Andi is okay to take as is, I won't object (this is minor thing).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 8/9] i2c: designware-amdisp: use i2c_adapter_set_node()
2026-02-23 11:46 ` Andy Shevchenko
@ 2026-02-23 12:23 ` Bartosz Golaszewski
2026-02-26 20:24 ` Wolfram Sang
0 siblings, 1 reply; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 12:23 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Wolfram Sang, Mika Westerberg, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede, Nirujogi Pratap,
Bin Du, Hans Hu, linux-i2c, linux-kernel, linux-renesas-soc
On Mon, Feb 23, 2026 at 12:47 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Feb 23, 2026 at 10:08:26AM +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.
>
> This should be united with patch 2.
> For this kind of patches I would not make the split like this.
>
> But if Andi is okay to take as is, I won't object (this is minor thing).
>
Gah, I folded this into this series but forgot to squash it into the
original designware patch. It can be squashed in-tree by Wolfram or I
can resend it.
Bart
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 8/9] i2c: designware-amdisp: use i2c_adapter_set_node()
2026-02-23 12:23 ` Bartosz Golaszewski
@ 2026-02-26 20:24 ` Wolfram Sang
0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2026-02-26 20:24 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Andy Shevchenko, Bartosz Golaszewski, Mika Westerberg, Jan Dabros,
Andi Shyti, Lixu Zhang, Sakari Ailus, Binbin Zhou,
Fabrizio Castro, Israel Cepeda, Hans de Goede, Nirujogi Pratap,
Bin Du, Hans Hu, linux-i2c, linux-kernel, linux-renesas-soc
> Gah, I folded this into this series but forgot to squash it into the
> original designware patch. It can be squashed in-tree by Wolfram or I
> can resend it.
Everything got squashed anyhow ;)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 9/9] i2c: viai2c-zhaoxin: use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (7 preceding siblings ...)
2026-02-23 9:08 ` [PATCH v2 8/9] i2c: designware-amdisp: " Bartosz Golaszewski
@ 2026-02-23 9:08 ` Bartosz Golaszewski
2026-02-26 20:25 ` [PATCH v2 0/9] i2c: provide and " Wolfram Sang
9 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:08 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, Nirujogi Pratap,
Bin Du, Hans Hu
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.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-viai2c-zhaoxin.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-viai2c-zhaoxin.c b/drivers/i2c/busses/i2c-viai2c-zhaoxin.c
index 95dc64902b7cdb01beea04acf7bad8f20133d965..87ba7367473d117f8cb7d4bd422ae49f0bfb6881 100644
--- a/drivers/i2c/busses/i2c-viai2c-zhaoxin.c
+++ b/drivers/i2c/busses/i2c-viai2c-zhaoxin.c
@@ -323,7 +323,7 @@ static int zxi2c_probe(struct platform_device *pdev)
adap->algo = &zxi2c_algorithm;
adap->quirks = &zxi2c_quirks;
adap->dev.parent = &pdev->dev;
- ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
+ i2c_adapter_set_node(adap, dev_fwnode(&pdev->dev));
snprintf(adap->name, sizeof(adap->name), "zhaoxin-%s-%s",
dev_name(pdev->dev.parent), dev_name(i2c->dev));
i2c_set_adapdata(adap, i2c);
--
2.47.3
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node()
2026-02-23 9:08 [PATCH v2 0/9] i2c: provide and use i2c_adapter_set_node() Bartosz Golaszewski
` (8 preceding siblings ...)
2026-02-23 9:08 ` [PATCH v2 9/9] i2c: viai2c-zhaoxin: " Bartosz Golaszewski
@ 2026-02-26 20:25 ` Wolfram Sang
9 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2026-02-26 20:25 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, Nirujogi Pratap, Bin Du, Hans Hu,
Bartosz Golaszewski, linux-i2c, linux-kernel, linux-renesas-soc
On Mon, Feb 23, 2026 at 10:08:18AM +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.
>
> Link: https://lore.kernel.org/all/20251106152330.11733-1-tzungbi@kernel.org/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Applied to for-current, squashed...
> ---
> Changes in v2:
> - add patches replacing ACPI_COMPANION_SET() with i2c_adapter_set_node()
> - rebased on top of v7.0-rc1
... and resolved another merge conflict :/
But despite this minor hickup, thanks a ton for your work! Looking
forward to your follow-up patches.
Happy hacking!
^ permalink raw reply [flat|nested] 14+ messages in thread