From: Alan Cox <alan@linux.intel.com>
To: linux-serial@vger.kernel.org, greg@kroah.com
Subject: [PATCH 5/5] mrst_max3110: Make the IRQ option runtime
Date: Mon, 06 Sep 2010 13:40:34 +0100 [thread overview]
Message-ID: <20100906124011.1328.62220.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100906123843.1328.3930.stgit@localhost.localdomain>
And while we are at it allow it to fail to find one. Without this the IRQ
option will cause the 3110 driver to fail on 0.7 SFI firmware.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/serial/Kconfig | 7 -----
drivers/serial/mrst_max3110.c | 55 +++++++++++++++++++++--------------------
2 files changed, 28 insertions(+), 34 deletions(-)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 12900f7..ba4b390 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -717,13 +717,6 @@ config SERIAL_MRST_MAX3110
the Intel Moorestown platform. On other systems use the max3100
driver.
-config MRST_MAX3110_IRQ
- boolean "Enable GPIO IRQ for Max3110 over Moorestown"
- default n
- depends on SERIAL_MRST_MAX3110 && GPIO_LANGWELL
- help
- This has to be enabled after Moorestown GPIO driver is loaded
-
config SERIAL_MFD_HSU
tristate "Medfield High Speed UART support"
depends on PCI
diff --git a/drivers/serial/mrst_max3110.c b/drivers/serial/mrst_max3110.c
index 880dce3..bae2697 100644
--- a/drivers/serial/mrst_max3110.c
+++ b/drivers/serial/mrst_max3110.c
@@ -446,7 +446,6 @@ static int max3110_main_thread(void *_max)
return ret;
}
-#ifdef CONFIG_MRST_MAX3110_IRQ
static irqreturn_t serial_m3110_irq(int irq, void *dev_id)
{
struct uart_max3110 *max = dev_id;
@@ -458,7 +457,7 @@ static irqreturn_t serial_m3110_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
-#else
+
/* if don't use RX IRQ, then need a thread to polling read */
static int max3110_read_thread(void *_max)
{
@@ -481,7 +480,6 @@ static int max3110_read_thread(void *_max)
return 0;
}
-#endif
static int serial_m3110_startup(struct uart_port *port)
{
@@ -504,34 +502,38 @@ static int serial_m3110_startup(struct uart_port *port)
/* as we use thread to handle tx/rx, need set low latency */
port->state->port.tty->low_latency = 1;
-#ifdef CONFIG_MRST_MAX3110_IRQ
- ret = request_irq(max->irq, serial_m3110_irq,
+ if (max->irq) {
+ max->read_thread = NULL;
+ ret = request_irq(max->irq, serial_m3110_irq,
IRQ_TYPE_EDGE_FALLING, "max3110", max);
- if (ret)
- return ret;
+ 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;
+ }
+ }
- /* 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");
- if (IS_ERR(max->read_thread)) {
- ret = PTR_ERR(max->read_thread);
- max->read_thread = NULL;
- pr_err(PR_FMT "Can't create read thread!");
- return ret;
+ if (max->irq == 0) {
+ /* If IRQ is disabled, start a read thread for input data */
+ max->read_thread =
+ kthread_run(max3110_read_thread, max, "max3110_read");
+ if (IS_ERR(max->read_thread)) {
+ ret = PTR_ERR(max->read_thread);
+ max->read_thread = NULL;
+ pr_err(PR_FMT "Can't create read thread!\n");
+ return ret;
+ }
}
-#endif
ret = max3110_out(max, config);
if (ret) {
-#ifdef CONFIG_MRST_MAX3110_IRQ
- free_irq(max->irq, max);
-#else
- kthread_stop(max->read_thread);
+ if (max->irq)
+ free_irq(max->irq, max);
+ if (max->read_thread)
+ kthread_stop(max->read_thread);
max->read_thread = NULL;
-#endif
return ret;
}
@@ -550,9 +552,8 @@ static void serial_m3110_shutdown(struct uart_port *port)
max->read_thread = NULL;
}
-#ifdef CONFIG_MRST_MAX3110_IRQ
- free_irq(max->irq, max);
-#endif
+ if (max->irq)
+ free_irq(max->irq, max);
/* Disable interrupts from this port */
config = WC_TAG | WC_SW_SHDI;
prev parent reply other threads:[~2010-09-06 13:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-06 12:39 [PATCH 1/5] mrst_earlyprintk: add a kmsg_dumper to dump the printk buffer when panic Alan Cox
2010-09-06 12:39 ` [PATCH 2/5] hsu, earlyprintk: add early printk for hsu_port2 console Alan Cox
2010-09-06 14:17 ` Ingo Molnar
2010-09-06 14:15 ` Alan Cox
2010-09-06 16:18 ` Ingo Molnar
2010-09-07 1:28 ` Feng Tang
2010-09-06 12:39 ` [PATCH 3/5] hsu, earlyprintk: remove the GPIO work around Alan Cox
2010-09-06 12:40 ` [PATCH 4/5] serial: mrst_max3110: some code cleanup Alan Cox
2010-09-06 12:40 ` Alan Cox [this message]
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=20100906124011.1328.62220.stgit@localhost.localdomain \
--to=alan@linux.intel.com \
--cc=greg@kroah.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.