Re: [PATCH v5 7/7] i2c: designware: style changes in existing code
From: Andy Shevchenko
Date: Wed Dec 28 2016 - 10:53:32 EST
On Wed, 2016-12-28 at 14:43 +0000, Luis Oliveira wrote:
> Replaced all the return variables 'r' in the existing
> code by 'ret' to make the code easier to read (and
> more standard).
I'm not sure it makes sense as a separate change.
>
> Signed-off-by: Luis Oliveira <lolivei@xxxxxxxxxxxx>
> ---
> Changes V4->V5: (Andy Shevchenko)
> - Replaced all the old code using "r" as return to "ret". For
> consistencyÂ
> purposes.
>
> Âdrivers/i2c/busses/i2c-designware-master.cÂÂ| 30 ++++++++++++++----
> -----------
> Âdrivers/i2c/busses/i2c-designware-platdrv.c | 16 +++++++--------
> Â2 files changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-designware-master.c
> b/drivers/i2c/busses/i2c-designware-master.c
> index b55a7f4c5149..0d5aca6edb48 100644
> --- a/drivers/i2c/busses/i2c-designware-master.c
> +++ b/drivers/i2c/busses/i2c-designware-master.c
> @@ -644,18 +644,18 @@ EXPORT_SYMBOL_GPL(i2c_dw_read_comp_param);
> Âint i2c_dw_probe(struct dw_i2c_dev *dev)
> Â{
> Â struct i2c_adapter *adap = &dev->adapter;
> - int r;
> + int ret;
> Â u32 reg;
> Â
> Â init_completion(&dev->cmd_complete);
> Â
> - r = i2c_dw_init(dev);
> - if (r)
> - return r;
> + ret = i2c_dw_init(dev);
> + if (ret)
> + return ret;
> Â
> - r = i2c_dw_acquire_lock(dev);
> - if (r)
> - return r;
> + ret = i2c_dw_acquire_lock(dev);
> + if (ret)
> + return ret;
> Â
> Â /*
> Â Â* Test if dynamic TAR update is enabled in this controller
> by writing
> @@ -681,13 +681,13 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
> Â i2c_set_adapdata(adap, dev);
> Â
> Â i2c_dw_disable_int(dev);
> - r = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr,
> + ret = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr,
> Â ÂÂÂÂÂIRQF_SHARED | IRQF_COND_SUSPEND,
> Â ÂÂÂÂÂdev_name(dev->dev), dev);
> - if (r) {
> + if (ret) {
> Â dev_err(dev->dev, "failure requesting irq %i: %d\n",
> - dev->irq, r);
> - return r;
> + dev->irq, ret);
> + return ret;
> Â }
> Â
> Â /*
> @@ -697,12 +697,12 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
> Â Â* registered I2C slaves that do I2C transfers in their
> probe.
> Â Â*/
> Â pm_runtime_get_noresume(dev->dev);
> - r = i2c_add_numbered_adapter(adap);
> - if (r)
> - dev_err(dev->dev, "failure adding adapter: %d\n", r);
> + ret = i2c_add_numbered_adapter(adap);
> + if (ret)
> + dev_err(dev->dev, "failure adding adapter: %d\n",
> ret);
> Â pm_runtime_put_noidle(dev->dev);
> Â
> - return r;
> + return ret;
> Â}
> ÂEXPORT_SYMBOL_GPL(i2c_dw_probe);
> Â
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
> b/drivers/i2c/busses/i2c-designware-platdrv.c
> index ef75031f8a62..785f4380c9a9 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -234,7 +234,7 @@ static int dw_i2c_plat_probe(struct
> platform_device *pdev)
> Â struct fwnode_handle *child;
> Â u32 acpi_speed, ht = 0;
> Â struct resource *mem;
> - int irq, r;
> + int irq, ret;
> Â u32 reg;
> Â
> Â irq = platform_get_irq(pdev, 0);
> @@ -293,9 +293,9 @@ static int dw_i2c_plat_probe(struct
> platform_device *pdev)
> Â return -EINVAL;
> Â }
> Â
> - r = i2c_dw_eval_lock_support(dev);
> - if (r)
> - return r;
> + ret = i2c_dw_eval_lock_support(dev);
> + if (ret)
> + return ret;
> Â
> Â if (ACPI_HANDLE(&pdev->dev) == NULL) {
> Â device_for_each_child_node(&pdev->dev, child) {
> @@ -336,14 +336,14 @@ static int dw_i2c_plat_probe(struct
> platform_device *pdev)
> Â }
> Â
> Â if (dev->mode == DW_IC_SLAVE)
> - r = i2c_dw_probe_slave(dev);
> + ret = i2c_dw_probe_slave(dev);
> Â else
> - r = i2c_dw_probe(dev);
> + ret = i2c_dw_probe(dev);
> Â
> - if (r && !dev->pm_runtime_disabled)
> + if (ret && !dev->pm_runtime_disabled)
> Â pm_runtime_disable(&pdev->dev);
> Â
> - return r;
> + return ret;
> Â}
> Â
> Âstatic int dw_i2c_plat_remove(struct platform_device *pdev)
--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy