[PATCH 5/7] i2c: ls2x: use i2c_adapter_set_node()

Bartosz Golaszewski posted 7 patches 1 month, 2 weeks ago
[PATCH 5/7] i2c: ls2x: use i2c_adapter_set_node()
Posted by Bartosz Golaszewski 1 month, 2 weeks ago
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
Re: [PATCH 5/7] i2c: ls2x: use i2c_adapter_set_node()
Posted by Binbin Zhou 1 month, 1 week ago
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);
>