summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-05-18 11:21:06 +0200
committerPaul Mundt <lethal@linux-sh.org>2012-05-18 11:21:06 +0200
commit0e8963de1fe95e7fbc30c79c1dbc7cb1ea0cf699 (patch)
tree73d4cd5d27b345751488f3b10799b6b4daf61bae /drivers
parentMerge branch 'sh/evt2irq-migration' into sh-latest (diff)
downloadlinux-0e8963de1fe95e7fbc30c79c1dbc7cb1ea0cf699.tar.xz
linux-0e8963de1fe95e7fbc30c79c1dbc7cb1ea0cf699.zip
serial: sh-sci: Fix for port types without BRI interrupts.
In doing the evt2irq() + muxed vector conversion for various port types it became apparent that some of the legacy port types will presently error out due to the irq requesting logic attempting to acquire the non-existent BRI IRQ. This adds some sanity checks to the request/free path to ensure that non-existence of a source in itself is not an error. This should restore functionality for legacy PORT_SCI ports. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/sh-sci.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index be31d85a50e3..4604153b7954 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1052,9 +1052,17 @@ static int sci_request_irq(struct sci_port *port)
if (SCIx_IRQ_IS_MUXED(port)) {
i = SCIx_MUX_IRQ;
irq = up->irq;
- } else
+ } else {
irq = port->cfg->irqs[i];
+ /*
+ * Certain port types won't support all of the
+ * available interrupt sources.
+ */
+ if (unlikely(!irq))
+ continue;
+ }
+
desc = sci_irq_desc + i;
port->irqstr[j] = kasprintf(GFP_KERNEL, "%s:%s",
dev_name(up->dev), desc->desc);
@@ -1094,6 +1102,15 @@ static void sci_free_irq(struct sci_port *port)
* IRQ first.
*/
for (i = 0; i < SCIx_NR_IRQS; i++) {
+ unsigned int irq = port->cfg->irqs[i];
+
+ /*
+ * Certain port types won't support all of the available
+ * interrupt sources.
+ */
+ if (unlikely(!irq))
+ continue;
+
free_irq(port->cfg->irqs[i], port);
kfree(port->irqstr[i]);