* [PATCH 1/2] i2c: mv64xxx: use platform_get_irq() instead of irq_of_parse_and_map()
@ 2017-05-16 12:07 Thomas Petazzoni
2017-05-16 12:07 ` [PATCH 2/2] i2c: mv64xxx: propagate the return value of platform_get_irq() Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2017-05-16 12:07 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Thomas Petazzoni
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.
Therefore, this commit moves the code filling drv_data->irq outside of
the non-DT vs. DT condition, and simply uses platform_get_irq().
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
drivers/i2c/busses/i2c-mv64xxx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index a50bd68..f0a4d15 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -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)) {
@@ -905,10 +904,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));
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] i2c: mv64xxx: propagate the return value of platform_get_irq()
2017-05-16 12:07 [PATCH 1/2] i2c: mv64xxx: use platform_get_irq() instead of irq_of_parse_and_map() Thomas Petazzoni
@ 2017-05-16 12:07 ` Thomas Petazzoni
2017-05-16 21:28 ` Wolfram Sang
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2017-05-16 12:07 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Thomas Petazzoni
platform_get_irq() returns an error code, so instead of inventing our
own error code (-ENXIO), return the one provided by
platform_get_irq(). Most notably, this allows an -EPROBE_DEFER
returned by platform_get_irq() to be propagate as the return value of
->probe(), which allows deferred probing of the interrupt controller.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
drivers/i2c/busses/i2c-mv64xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index f0a4d15..f0ddf7d 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -918,7 +918,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;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] i2c: mv64xxx: propagate the return value of platform_get_irq()
2017-05-16 12:07 ` [PATCH 2/2] i2c: mv64xxx: propagate the return value of platform_get_irq() Thomas Petazzoni
@ 2017-05-16 21:28 ` Wolfram Sang
2017-05-16 21:34 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2017-05-16 21:28 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
On Tue, May 16, 2017 at 02:07:25PM +0200, Thomas Petazzoni wrote:
> platform_get_irq() returns an error code, so instead of inventing our
> own error code (-ENXIO), return the one provided by
> platform_get_irq(). Most notably, this allows an -EPROBE_DEFER
> returned by platform_get_irq() to be propagate as the return value of
> ->probe(), which allows deferred probing of the interrupt controller.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thanks! I squashed the two commits into one because then I can count it
as a bugfix and apply it to for-current. I hope you are fine with this.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] i2c: mv64xxx: propagate the return value of platform_get_irq()
2017-05-16 21:28 ` Wolfram Sang
@ 2017-05-16 21:34 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2017-05-16 21:34 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement
Hello,
On Tue, 16 May 2017 23:28:12 +0200, Wolfram Sang wrote:
> On Tue, May 16, 2017 at 02:07:25PM +0200, Thomas Petazzoni wrote:
> > platform_get_irq() returns an error code, so instead of inventing our
> > own error code (-ENXIO), return the one provided by
> > platform_get_irq(). Most notably, this allows an -EPROBE_DEFER
> > returned by platform_get_irq() to be propagate as the return value of
> > ->probe(), which allows deferred probing of the interrupt controller.
> >
> > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>
> Thanks! I squashed the two commits into one because then I can count it
> as a bugfix and apply it to for-current. I hope you are fine with this.
Sounds good to me. Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-16 21:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 12:07 [PATCH 1/2] i2c: mv64xxx: use platform_get_irq() instead of irq_of_parse_and_map() Thomas Petazzoni
2017-05-16 12:07 ` [PATCH 2/2] i2c: mv64xxx: propagate the return value of platform_get_irq() Thomas Petazzoni
2017-05-16 21:28 ` Wolfram Sang
2017-05-16 21:34 ` Thomas Petazzoni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.