Commit 68357c7d authored by Chen, Jie's avatar Chen, Jie Committed by Greg Kroah-Hartman
Browse files

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: default avatarDavid Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: default avatarChen, Jie <jie.d.chen@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2a0b965c
Loading
Loading
Loading
Loading
+17 −18
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@


#include <linux/kthread.h>
#include <linux/kthread.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi.h>
#include <linux/pm.h>


#include "mrst_max3110.h"
#include "mrst_max3110.h"


@@ -494,19 +495,9 @@ static int serial_m3110_startup(struct uart_port *port)
	port->state->port.low_latency = 1;
	port->state->port.low_latency = 1;


	if (max->irq) {
	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 */
		/* Enable RX IRQ only */
		config |= WC_RXA_IRQ_ENABLE;
		config |= WC_RXA_IRQ_ENABLE;
		}
	} else {
	}

	if (max->irq == 0) {
		/* If IRQ is disabled, start a read thread for input data */
		/* If IRQ is disabled, start a read thread for input data */
		max->read_thread =
		max->read_thread =
			kthread_run(max3110_read_thread, max, "max3110_read");
			kthread_run(max3110_read_thread, max, "max3110_read");
@@ -520,8 +511,6 @@ static int serial_m3110_startup(struct uart_port *port)


	ret = max3110_out(max, config);
	ret = max3110_out(max, config);
	if (ret) {
	if (ret) {
		if (max->irq)
			free_irq(max->irq, max);
		if (max->read_thread)
		if (max->read_thread)
			kthread_stop(max->read_thread);
			kthread_stop(max->read_thread);
		max->read_thread = NULL;
		max->read_thread = NULL;
@@ -543,9 +532,6 @@ static void serial_m3110_shutdown(struct uart_port *port)
		max->read_thread = NULL;
		max->read_thread = NULL;
	}
	}


	if (max->irq)
		free_irq(max->irq, max);

	/* Disable interrupts from this port */
	/* Disable interrupts from this port */
	config = WC_TAG | WC_SW_SHDI;
	config = WC_TAG | WC_SW_SHDI;
	max3110_out(max, config);
	max3110_out(max, config);
@@ -846,6 +832,16 @@ static int serial_m3110_probe(struct spi_device *spi)
		goto err_kthread;
		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);
	spi_set_drvdata(spi, max);
	pmax = max;
	pmax = max;


@@ -873,6 +869,9 @@ static int serial_m3110_remove(struct spi_device *dev)


	free_page((unsigned long)max->con_xmit.buf);
	free_page((unsigned long)max->con_xmit.buf);


	if (max->irq)
		free_irq(max->irq, max);

	if (max->main_thread)
	if (max->main_thread)
		kthread_stop(max->main_thread);
		kthread_stop(max->main_thread);