From 40a5679ab0fa00ae8ebcfd8f3c5c33feded91cf6 Mon Sep 17 00:00:00 2001 From: chao bi Date: Wed, 31 Oct 2012 16:54:07 +0800 Subject: [PATCH] --- yaml --- r: 338402 b: refs/heads/master c: 31fe99048859b13a87f476016e7bb5c2b5220c36 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/tty/serial/ifx6x60.c | 11 ++++++++++- trunk/drivers/tty/serial/ifx6x60.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index d96f48d410db..916defe56ace 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2ac4ad2a1468123f6bb439a547880a9c0d302e0a +refs/heads/master: 31fe99048859b13a87f476016e7bb5c2b5220c36 diff --git a/trunk/drivers/tty/serial/ifx6x60.c b/trunk/drivers/tty/serial/ifx6x60.c index e595c832be20..fbda37415f01 100644 --- a/trunk/drivers/tty/serial/ifx6x60.c +++ b/trunk/drivers/tty/serial/ifx6x60.c @@ -569,12 +569,19 @@ static int ifx_port_activate(struct tty_port *port, struct tty_struct *tty) /* clear any old data; can't do this in 'close' */ kfifo_reset(&ifx_dev->tx_fifo); + /* clear any flag which may be set in port shutdown procedure */ + clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags); + clear_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags); + /* put port data into this tty */ tty->driver_data = ifx_dev; /* allows flip string push from int context */ tty->low_latency = 1; + /* set flag to allows data transfer */ + set_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); + return 0; } @@ -590,6 +597,7 @@ static void ifx_port_shutdown(struct tty_port *port) struct ifx_spi_device *ifx_dev = container_of(port, struct ifx_spi_device, tty_port); + clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); mrdy_set_low(ifx_dev); clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); tasklet_kill(&ifx_dev->io_work_tasklet); @@ -745,7 +753,8 @@ static void ifx_spi_io(unsigned long data) int retval; struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *) data; - if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags)) { + if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags) && + test_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags)) { if (ifx_dev->gpio.unack_srdy_int_nb > 0) ifx_dev->gpio.unack_srdy_int_nb--; diff --git a/trunk/drivers/tty/serial/ifx6x60.h b/trunk/drivers/tty/serial/ifx6x60.h index d8869f5a4632..4fbddc297839 100644 --- a/trunk/drivers/tty/serial/ifx6x60.h +++ b/trunk/drivers/tty/serial/ifx6x60.h @@ -41,6 +41,7 @@ #define IFX_SPI_STATE_IO_IN_PROGRESS 1 #define IFX_SPI_STATE_IO_READY 2 #define IFX_SPI_STATE_TIMER_PENDING 3 +#define IFX_SPI_STATE_IO_AVAILABLE 4 /* flow control bitfields */ #define IFX_SPI_DCD 0