Unverified Commit b6983779 authored by Abdurrahman Hussain's avatar Abdurrahman Hussain Committed by Andi Shyti
Browse files

i2c: xiic: cosmetic cleanup



Re-use dev pointer instead of referencing &pdev->dev everywhere.

Signed-off-by: default avatarAbdurrahman Hussain <abdurrahman@nexthop.ai>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260223-i2c-xiic-v12-4-b6c9ce4e4f3c@nexthop.ai
parent b621a966
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -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 = {