diff options
author | Chen, Jie <jie.d.chen@intel.com> | 2013-10-22 15:42:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-29 19:26:54 -0400 |
commit | 68357c7d3f0a5930b48dcbe6d10e5324fdbd8c7a (patch) | |
tree | 569b5bf6fb89f5c5120a4fc0b4210c2a644554ef /drivers/tty/serial/mrst_max3110.c | |
parent | 2a0b965cfb6efc667228831fc3a30308b4f94a87 (diff) |
mrst_max3110: fix unbalanced IRQ issue during resume
During resume, a startup will request_irq again, meantime resume function's
enable_irq will cause unbalanced IRQ issue.
Fix this issue by moving request_irq to probe function.
Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Chen, Jie <jie.d.chen@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/mrst_max3110.c')
-rw-r--r-- | drivers/tty/serial/mrst_max3110.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c index 565779dc7aac..db0448ae59dc 100644 --- a/drivers/tty/serial/mrst_max3110.c +++ b/drivers/tty/serial/mrst_max3110.c | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | #include <linux/kthread.h> | 44 | #include <linux/kthread.h> |
45 | #include <linux/spi/spi.h> | 45 | #include <linux/spi/spi.h> |
46 | #include <linux/pm.h> | ||
46 | 47 | ||
47 | #include "mrst_max3110.h" | 48 | #include "mrst_max3110.h" |
48 | 49 | ||
@@ -494,19 +495,9 @@ static int serial_m3110_startup(struct uart_port *port) | |||
494 | port->state->port.low_latency = 1; | 495 | port->state->port.low_latency = 1; |
495 | 496 | ||
496 | if (max->irq) { | 497 | if (max->irq) { |
497 | max->read_thread = NULL; | 498 | /* Enable RX IRQ only */ |
498 | ret = request_irq(max->irq, serial_m3110_irq, | 499 | config |= WC_RXA_IRQ_ENABLE; |
499 | IRQ_TYPE_EDGE_FALLING, "max3110", max); | 500 | } else { |
500 | if (ret) { | ||
501 | max->irq = 0; | ||
502 | pr_err(PR_FMT "unable to allocate IRQ, polling\n"); | ||
503 | } else { | ||
504 | /* Enable RX IRQ only */ | ||
505 | config |= WC_RXA_IRQ_ENABLE; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | if (max->irq == 0) { | ||
510 | /* If IRQ is disabled, start a read thread for input data */ | 501 | /* If IRQ is disabled, start a read thread for input data */ |
511 | max->read_thread = | 502 | max->read_thread = |
512 | kthread_run(max3110_read_thread, max, "max3110_read"); | 503 | kthread_run(max3110_read_thread, max, "max3110_read"); |
@@ -520,8 +511,6 @@ static int serial_m3110_startup(struct uart_port *port) | |||
520 | 511 | ||
521 | ret = max3110_out(max, config); | 512 | ret = max3110_out(max, config); |
522 | if (ret) { | 513 | if (ret) { |
523 | if (max->irq) | ||
524 | free_irq(max->irq, max); | ||
525 | if (max->read_thread) | 514 | if (max->read_thread) |
526 | kthread_stop(max->read_thread); | 515 | kthread_stop(max->read_thread); |
527 | max->read_thread = NULL; | 516 | max->read_thread = NULL; |
@@ -543,9 +532,6 @@ static void serial_m3110_shutdown(struct uart_port *port) | |||
543 | max->read_thread = NULL; | 532 | max->read_thread = NULL; |
544 | } | 533 | } |
545 | 534 | ||
546 | if (max->irq) | ||
547 | free_irq(max->irq, max); | ||
548 | |||
549 | /* Disable interrupts from this port */ | 535 | /* Disable interrupts from this port */ |
550 | config = WC_TAG | WC_SW_SHDI; | 536 | config = WC_TAG | WC_SW_SHDI; |
551 | max3110_out(max, config); | 537 | max3110_out(max, config); |
@@ -846,6 +832,16 @@ static int serial_m3110_probe(struct spi_device *spi) | |||
846 | goto err_kthread; | 832 | goto err_kthread; |
847 | } | 833 | } |
848 | 834 | ||
835 | if (max->irq) { | ||
836 | ret = request_irq(max->irq, serial_m3110_irq, | ||
837 | IRQ_TYPE_EDGE_FALLING, "max3110", max); | ||
838 | if (ret) { | ||
839 | max->irq = 0; | ||
840 | dev_warn(&spi->dev, | ||
841 | "unable to allocate IRQ, will use polling method\n"); | ||
842 | } | ||
843 | } | ||
844 | |||
849 | spi_set_drvdata(spi, max); | 845 | spi_set_drvdata(spi, max); |
850 | pmax = max; | 846 | pmax = max; |
851 | 847 | ||
@@ -873,6 +869,9 @@ static int serial_m3110_remove(struct spi_device *dev) | |||
873 | 869 | ||
874 | free_page((unsigned long)max->con_xmit.buf); | 870 | free_page((unsigned long)max->con_xmit.buf); |
875 | 871 | ||
872 | if (max->irq) | ||
873 | free_irq(max->irq, max); | ||
874 | |||
876 | if (max->main_thread) | 875 | if (max->main_thread) |
877 | kthread_stop(max->main_thread); | 876 | kthread_stop(max->main_thread); |
878 | 877 | ||