public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] serial: sh-sci: Respect deferred probe when getting IRQ
@ 2021-04-07 10:05 Andy Shevchenko
  2021-04-07 10:16 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-04-07 10:05 UTC (permalink / raw)
  To: linux-serial, linux-kernel
  Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko, Guenter Roeck

With platform_get_irq() and its optional variant it's possible to get
a deferred probe error code. Since the commit ed7027fdf4ec ("driver core:
platform: Make platform_get_irq_optional() optional") the error code
can be distinguished from no IRQ case. With this, rewrite IRQ resource
handling in sh-sci driver to follow above and allow to respect deferred
probe.

Fixes: ed7027fdf4ec ("driver core: platform: Make platform_get_irq_optional() optional")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/sh-sci.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index ad2c189e8fc8..539c1c2d50b1 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2899,13 +2899,6 @@ static int sci_init_single(struct platform_device *dev,
 	port->mapbase = res->start;
 	sci_port->reg_size = resource_size(res);
 
-	for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) {
-		if (i)
-			sci_port->irqs[i] = platform_get_irq_optional(dev, i);
-		else
-			sci_port->irqs[i] = platform_get_irq(dev, i);
-	}
-
 	/* The SCI generates several interrupts. They can be muxed together or
 	 * connected to different interrupt lines. In the muxed case only one
 	 * interrupt resource is specified as there is only one interrupt ID.
@@ -2913,12 +2906,17 @@ static int sci_init_single(struct platform_device *dev,
 	 * from the SCI, however those signals might have their own individual
 	 * interrupt ID numbers, or muxed together with another interrupt.
 	 */
+	sci_port->irqs[0] = platform_get_irq(dev, i);
 	if (sci_port->irqs[0] < 0)
-		return -ENXIO;
+		return sci_port->irqs[0];
 
-	if (sci_port->irqs[1] < 0)
-		for (i = 1; i < ARRAY_SIZE(sci_port->irqs); i++)
+	for (i = 1; i < ARRAY_SIZE(sci_port->irqs); ++i) {
+		sci_port->irqs[i] = platform_get_irq_optional(dev, i);
+		if (sci_port->irqs[i] < 0)
+			return sci_port->irqs[i];
+		if (sci_port->irqs[i] == 0)
 			sci_port->irqs[i] = sci_port->irqs[0];
+	}
 
 	sci_port->params = sci_probe_regmap(p);
 	if (unlikely(sci_port->params == NULL))
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] serial: sh-sci: Respect deferred probe when getting IRQ
  2021-04-07 10:05 [PATCH v1 1/1] serial: sh-sci: Respect deferred probe when getting IRQ Andy Shevchenko
@ 2021-04-07 10:16 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2021-04-07 10:16 UTC (permalink / raw)
  To: linux-serial, linux-kernel; +Cc: Greg Kroah-Hartman, Jiri Slaby, Guenter Roeck

On Wed, Apr 07, 2021 at 01:05:56PM +0300, Andy Shevchenko wrote:
> With platform_get_irq() and its optional variant it's possible to get
> a deferred probe error code. Since the commit ed7027fdf4ec ("driver core:
> platform: Make platform_get_irq_optional() optional") the error code
> can be distinguished from no IRQ case. With this, rewrite IRQ resource
> handling in sh-sci driver to follow above and allow to respect deferred
> probe.


It has a typo, i'll send a v2.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-07 10:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-07 10:05 [PATCH v1 1/1] serial: sh-sci: Respect deferred probe when getting IRQ Andy Shevchenko
2021-04-07 10:16 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox