From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH v2 1/1] serial: sh-sci: Respect deferred probe when getting IRQ
Date: Wed, 7 Apr 2021 13:17:13 +0300 [thread overview]
Message-ID: <20210407101713.8694-1-andriy.shevchenko@linux.intel.com> (raw)
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>
---
v2: fixed a typo: i -> 0
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..574f68ba50ff 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, 0);
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
next reply other threads:[~2021-04-07 10:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-07 10:17 Andy Shevchenko [this message]
2021-04-07 10:23 ` [PATCH v2 1/1] serial: sh-sci: Respect deferred probe when getting IRQ Greg Kroah-Hartman
2021-04-07 11:19 ` Andy Shevchenko
2021-04-07 13:11 ` Guenter Roeck
2021-04-07 13:39 ` Andy Shevchenko
2021-04-12 10:11 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210407101713.8694-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox