From: David Cohen <david.a.cohen@linux.intel.com>
To: gregkh@linuxfoundation.org, jslaby@suse.cz, ning.li@intel.com,
ivan.gorinov@intel.com
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
"Chen, Jie" <jie.d.chen@intel.com>,
David Cohen <david.a.cohen@linux.intel.com>
Subject: [PATCH 1/2] mrst_max3110: fix unbalanced IRQ issue during resume
Date: Tue, 22 Oct 2013 12:42:09 -0700 [thread overview]
Message-ID: <1382470930-13807-1-git-send-email-david.a.cohen@linux.intel.com> (raw)
From: "Chen, Jie" <jie.d.chen@intel.com>
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>
---
drivers/tty/serial/mrst_max3110.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c
index a67e708..6f618dd 100644
--- a/drivers/tty/serial/mrst_max3110.c
+++ b/drivers/tty/serial/mrst_max3110.c
@@ -43,6 +43,7 @@
#include <linux/kthread.h>
#include <linux/spi/spi.h>
+#include <linux/pm.h>
#include "mrst_max3110.h"
@@ -491,19 +492,9 @@ static int serial_m3110_startup(struct uart_port *port)
port->state->port.low_latency = 1;
if (max->irq) {
- max->read_thread = NULL;
- ret = request_irq(max->irq, serial_m3110_irq,
- IRQ_TYPE_EDGE_FALLING, "max3110", max);
- if (ret) {
- max->irq = 0;
- pr_err(PR_FMT "unable to allocate IRQ, polling\n");
- } else {
- /* Enable RX IRQ only */
- config |= WC_RXA_IRQ_ENABLE;
- }
- }
-
- if (max->irq == 0) {
+ /* Enable RX IRQ only */
+ config |= WC_RXA_IRQ_ENABLE;
+ } else {
/* If IRQ is disabled, start a read thread for input data */
max->read_thread =
kthread_run(max3110_read_thread, max, "max3110_read");
@@ -517,8 +508,6 @@ static int serial_m3110_startup(struct uart_port *port)
ret = max3110_out(max, config);
if (ret) {
- if (max->irq)
- free_irq(max->irq, max);
if (max->read_thread)
kthread_stop(max->read_thread);
max->read_thread = NULL;
@@ -540,9 +529,6 @@ static void serial_m3110_shutdown(struct uart_port *port)
max->read_thread = NULL;
}
- if (max->irq)
- free_irq(max->irq, max);
-
/* Disable interrupts from this port */
config = WC_TAG | WC_SW_SHDI;
max3110_out(max, config);
@@ -840,6 +826,16 @@ static int serial_m3110_probe(struct spi_device *spi)
goto err_kthread;
}
+ if (max->irq) {
+ ret = request_irq(max->irq, serial_m3110_irq,
+ IRQ_TYPE_EDGE_FALLING, "max3110", max);
+ if (ret) {
+ max->irq = 0;
+ dev_warn(&spi->dev,
+ "unable to allocate IRQ, will use polling method\n");
+ }
+ }
+
spi_set_drvdata(spi, max);
pmax = max;
@@ -867,6 +863,9 @@ static int serial_m3110_remove(struct spi_device *dev)
free_page((unsigned long)max->con_xmit.buf);
+ if (max->irq)
+ free_irq(max->irq, max);
+
if (max->main_thread)
kthread_stop(max->main_thread);
--
1.8.4.rc3
next reply other threads:[~2013-10-22 19:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 19:42 David Cohen [this message]
2013-10-22 19:42 ` [PATCH 2/2] mrst_max3110: fix SPI UART interrupt parameters David Cohen
2013-10-22 19:46 ` Alexander Shiyan
2013-10-22 20:30 ` David Cohen
2013-10-22 23:02 ` David Cohen
2013-10-23 6:27 ` Alexander Shiyan
2013-10-23 18:10 ` David Cohen
2013-10-23 18:21 ` Felipe Balbi
2013-10-23 18:23 ` Felipe Balbi
2013-10-23 18:38 ` David Cohen
2013-10-23 18:33 ` David Cohen
2013-10-23 18:33 ` Felipe Balbi
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=1382470930-13807-1-git-send-email-david.a.cohen@linux.intel.com \
--to=david.a.cohen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=ivan.gorinov@intel.com \
--cc=jie.d.chen@intel.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=ning.li@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).