linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Greg KH <gregkh@linuxfoundation.org>, linux-serial@vger.kernel.org
Cc: Feng Tang <feng.tang@intel.com>
Subject: [PATCH 1/2] serial: mrst_max3110: Check the irq number before enable/disabe irq in PM hooks
Date: Wed,  9 Oct 2013 10:39:16 +0800	[thread overview]
Message-ID: <1381286357-13346-1-git-send-email-feng.tang@intel.com> (raw)

We should check the validity of the irq number before calling
disable_irq() and enable_irq() in the suspend/resume function,
as "max->irq == 0" means the irq is not enabled for max3110
device, otherwise it will hurt device whose irq number is really 0.

Signed-off-by: Feng Tang <feng.tang@intel.com>
---
 drivers/tty/serial/mrst_max3110.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c
index a67e708..ee77e73 100644
--- a/drivers/tty/serial/mrst_max3110.c
+++ b/drivers/tty/serial/mrst_max3110.c
@@ -749,7 +749,8 @@ static int serial_m3110_suspend(struct device *dev)
 	struct spi_device *spi = to_spi_device(dev);
 	struct uart_max3110 *max = spi_get_drvdata(spi);
 
-	disable_irq(max->irq);
+	if (max->irq > 0)
+		disable_irq(max->irq);
 	uart_suspend_port(&serial_m3110_reg, &max->port);
 	max3110_out(max, max->cur_conf | WC_SW_SHDI);
 	return 0;
@@ -762,7 +763,8 @@ static int serial_m3110_resume(struct device *dev)
 
 	max3110_out(max, max->cur_conf);
 	uart_resume_port(&serial_m3110_reg, &max->port);
-	enable_irq(max->irq);
+	if (max->irq > 0)
+		enable_irq(max->irq);
 	return 0;
 }
 
-- 
1.7.0.4


             reply	other threads:[~2013-10-09  2:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-09  2:39 Feng Tang [this message]
2013-10-09  2:39 ` [PATCH 2/2] serial: mrst_max3110: Fix race condition between spi transfers Feng Tang

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=1381286357-13346-1-git-send-email-feng.tang@intel.com \
    --to=feng.tang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-serial@vger.kernel.org \
    /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).