[PATCH 6/6] i2c: viai2c-zhaoxin: use i2c_adapter_dev()

Bartosz Golaszewski posted 6 patches 1 month, 2 weeks ago
[PATCH 6/6] i2c: viai2c-zhaoxin: use i2c_adapter_dev()
Posted by Bartosz Golaszewski 1 month, 2 weeks ago
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-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..d68c1f38806deeb3f233315e717092e96473c887 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));
+	ACPI_COMPANION_SET(i2c_adapter_dev(adap), ACPI_COMPANION(&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
Re: [PATCH 6/6] i2c: viai2c-zhaoxin: use i2c_adapter_dev()
Posted by Andy Shevchenko 1 month, 1 week ago
On Tue, Dec 23, 2025 at 11:08:23AM +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));

Same comment, use i2c_adapter_set_node().

-- 
With Best Regards,
Andy Shevchenko