]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i2c: xiic: cosmetic cleanup
authorAbdurrahman Hussain <abdurrahman@nexthop.ai>
Mon, 23 Feb 2026 15:59:19 +0000 (15:59 +0000)
committerAndi Shyti <andi.shyti@kernel.org>
Wed, 1 Apr 2026 23:27:44 +0000 (01:27 +0200)
Re-use dev pointer instead of referencing &pdev->dev everywhere.

Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260223-i2c-xiic-v12-4-b6c9ce4e4f3c@nexthop.ai
drivers/i2c/busses/i2c-xiic.c

index c7f641e291a2353d1607564465d82cc9db88a431..463a207c6a76afa84d9c41d238aff2e15ce2248a 100644 (file)
@@ -1430,7 +1430,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
        u8 i;
        u32 sr;
 
-       i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL);
+       i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL);
        if (!i2c)
                return -ENOMEM;
 
@@ -1446,7 +1446,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
        if (irq < 0)
                return irq;
 
-       pdata = dev_get_platdata(&pdev->dev);
+       pdata = dev_get_platdata(dev);
 
        /* hook up driver to tree */
        platform_set_drvdata(pdev, i2c);
@@ -1468,9 +1468,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)
                return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
                                     "failed to enable input clock.\n");
 
-       i2c->dev = &pdev->dev;
-       pm_runtime_set_autosuspend_delay(i2c->dev, XIIC_PM_TIMEOUT);
-       pm_runtime_use_autosuspend(i2c->dev);
+       i2c->dev = dev;
+
+       pm_runtime_set_autosuspend_delay(dev, XIIC_PM_TIMEOUT);
+       pm_runtime_use_autosuspend(dev);
        ret = devm_pm_runtime_set_active_enabled(dev);
        if (ret)
                return ret;
@@ -1482,9 +1483,8 @@ static int xiic_i2c_probe(struct platform_device *pdev)
        if (ret || i2c->i2c_clk > I2C_MAX_FAST_MODE_PLUS_FREQ)
                i2c->i2c_clk = 0;
 
-       ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
-                                       xiic_process, IRQF_ONESHOT,
-                                       pdev->name, i2c);
+       ret = devm_request_threaded_irq(dev, irq, NULL, xiic_process,
+                                       IRQF_ONESHOT, pdev->name, i2c);
        if (ret)
                return ret;
 
@@ -1527,21 +1527,21 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 
 static void xiic_i2c_remove(struct platform_device *pdev)
 {
+       struct device *dev = &pdev->dev;
        struct xiic_i2c *i2c = platform_get_drvdata(pdev);
        int ret;
 
        /* remove adapter & data */
        i2c_del_adapter(&i2c->adap);
 
-       ret = pm_runtime_get_sync(i2c->dev);
-
+       ret = pm_runtime_get_sync(dev);
        if (ret < 0)
-               dev_warn(&pdev->dev, "Failed to activate device for removal (%pe)\n",
+               dev_warn(dev, "Failed to activate device for removal (%pe)\n",
                         ERR_PTR(ret));
        else
                xiic_deinit(i2c);
 
-       pm_runtime_put_sync(i2c->dev);
+       pm_runtime_put_sync(dev);
 }
 
 static const struct dev_pm_ops xiic_dev_pm_ops = {