Use i2c_adapter_dev() where applicable in order to avoid direct
dereferencing of struct device embedded within struct i2c_adapter.
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 450793d5f83921ac9a8c6d00414890779da49c07..67772bccb71927e870c11fa88340caabcb07f264 100644
--- a/drivers/i2c/busses/i2c-designware-amdisp.c
+++ b/drivers/i2c/busses/i2c-designware-amdisp.c
@@ -64,7 +64,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));
+ ACPI_COMPANION_SET(i2c_adapter_dev(adap), ACPI_COMPANION(&pdev->dev));
adap->dev.of_node = pdev->dev.of_node;
/* use dynamically allocated adapter id */
adap->nr = -1;
--
2.47.3
On 12/23/2025 5:08 AM, Bartosz Golaszewski wrote: > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. > > > Use i2c_adapter_dev() where applicable in order to avoid direct > dereferencing of struct device embedded within struct i2c_adapter. > > Signed-off-by: Bartosz Golaszewski<bartosz.golaszewski@oss.qualcomm.com> Acked-by: Pratap Nirujogi<pratap.nirujogi@amd.com> (I'm assuming Andy's suggestion to use i2c_adapter_set_node() will be covered in the other patch series) Thanks, Pratap > --- > 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 450793d5f83921ac9a8c6d00414890779da49c07..67772bccb71927e870c11fa88340caabcb07f264 100644 > --- a/drivers/i2c/busses/i2c-designware-amdisp.c > +++ b/drivers/i2c/busses/i2c-designware-amdisp.c > @@ -64,7 +64,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)); > + ACPI_COMPANION_SET(i2c_adapter_dev(adap), ACPI_COMPANION(&pdev->dev)); > adap->dev.of_node = pdev->dev.of_node; > /* use dynamically allocated adapter id */ > adap->nr = -1; > > -- > 2.47.3 >
On Mon, Jan 05, 2026 at 02:26:06PM -0500, Nirujogi, Pratap wrote: > On 12/23/2025 5:08 AM, Bartosz Golaszewski wrote: > > Use i2c_adapter_dev() where applicable in order to avoid direct > > dereferencing of struct device embedded within struct i2c_adapter. > > > > Signed-off-by: Bartosz Golaszewski<bartosz.golaszewski@oss.qualcomm.com> > > Acked-by: Pratap Nirujogi<pratap.nirujogi@amd.com> > > (I'm assuming Andy's suggestion to use i2c_adapter_set_node() will be covered > in the other patch series) With that done, this patch won't be needed at all. -- With Best Regards, Andy Shevchenko
On Tue, Dec 23, 2025 at 11:08:21AM +0100, Bartosz Golaszewski wrote: > Use i2c_adapter_dev() where applicable in order to avoid direct > dereferencing of struct device embedded within struct i2c_adapter. ... > - ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev)); > + ACPI_COMPANION_SET(i2c_adapter_dev(adap), ACPI_COMPANION(&pdev->dev)); > adap->dev.of_node = pdev->dev.of_node; Why not just replace these with i2c_dev_set_node()? -- With Best Regards, Andy Shevchenko
On Sat, Dec 27, 2025 at 04:29:43PM +0200, Andy Shevchenko wrote: > On Tue, Dec 23, 2025 at 11:08:21AM +0100, Bartosz Golaszewski wrote: ... > > - ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev)); > > + ACPI_COMPANION_SET(i2c_adapter_dev(adap), ACPI_COMPANION(&pdev->dev)); > > adap->dev.of_node = pdev->dev.of_node; > > Why not just replace these with i2c_dev_set_node()? Oh, I meant the i2c_adapter_set_node() that you just introduced in the previous series. Effectively this makes a patch of that series. -- With Best Regards, Andy Shevchenko
© 2016 - 2026 Red Hat, Inc.