]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
i2c: mv64xxx: don't override deferred probing when getting irq
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 16 May 2017 12:07:24 +0000 (14:07 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 16 May 2017 21:19:00 +0000 (23:19 +0200)
There is no reason to use platform_get_irq() for non-DT probing and
irq_of_parse_and_map() for DT probing. Indeed, platform_get_irq()
works fine for both.

In addition, using platform_get_irq() properly returns -EPROBE_DEFER
when the interrupt controller is not yet available, so instead of
inventing our own error code (-ENXIO), return the one provided by
platform_get_irq().

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-mv64xxx.c

index cf737ec8563b873042a519e6f1337e3f095e10dd..5c4db65c5019b7692c645dfaec9d391623355a81 100644 (file)
@@ -819,7 +819,6 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
                rc = -EINVAL;
                goto out;
        }
-       drv_data->irq = irq_of_parse_and_map(np, 0);
 
        drv_data->rstc = devm_reset_control_get_optional(dev, NULL);
        if (IS_ERR(drv_data->rstc)) {
@@ -902,10 +901,11 @@ mv64xxx_i2c_probe(struct platform_device *pd)
        if (!IS_ERR(drv_data->clk))
                clk_prepare_enable(drv_data->clk);
 
+       drv_data->irq = platform_get_irq(pd, 0);
+
        if (pdata) {
                drv_data->freq_m = pdata->freq_m;
                drv_data->freq_n = pdata->freq_n;
-               drv_data->irq = platform_get_irq(pd, 0);
                drv_data->adapter.timeout = msecs_to_jiffies(pdata->timeout);
                drv_data->offload_enabled = false;
                memcpy(&drv_data->reg_offsets, &mv64xxx_i2c_regs_mv64xxx, sizeof(drv_data->reg_offsets));
@@ -915,7 +915,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
                        goto exit_clk;
        }
        if (drv_data->irq < 0) {
-               rc = -ENXIO;
+               rc = drv_data->irq;
                goto exit_reset;
        }