linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
@ 2012-11-22  8:43 chao bi
  2012-11-22 11:06 ` Alan Cox
  0 siblings, 1 reply; 8+ messages in thread
From: chao bi @ 2012-11-22  8:43 UTC (permalink / raw)
  To: alan; +Cc: richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel


When shut down SPI port, it's possible that MRDY has been asserted and a SPI
timer was activated waiting for SRDY assert, in the case, it needs to delete
this timer.

Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
---
 drivers/tty/serial/ifx6x60.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 5b9bc19..467020b 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -552,7 +552,10 @@ static void ifx_port_shutdown(struct tty_port *port)
 		container_of(port, struct ifx_spi_device, tty_port);
 
 	mrdy_set_low(ifx_dev);
-	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
+	if (test_and_clear_bit(IFX_SPI_STATE_TIMER_PENDING,
+		&ifx_dev->flags)) {
+		del_timer(&ifx_dev->spi_timer);
+	}
 	tasklet_kill(&ifx_dev->io_work_tasklet);
 }
 
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
  2012-11-22  8:43 [PATCH] serial:ifx6x60:Delete SPI timer when shut down port chao bi
@ 2012-11-22 11:06 ` Alan Cox
  2012-11-23  1:25   ` chao bi
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Cox @ 2012-11-22 11:06 UTC (permalink / raw)
  To: chao bi; +Cc: richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel

On Thu, 22 Nov 2012 16:43:07 +0800
chao bi <chao.bi@intel.com> wrote:

> 
> When shut down SPI port, it's possible that MRDY has been asserted
> and a SPI timer was activated waiting for SRDY assert, in the case,
> it needs to delete this timer.
> 
> Signed-off-by: Chen Jun <jun.d.chen@intel.com>
> Signed-off-by: channing <chao.bi@intel.com>
> ---
>  drivers/tty/serial/ifx6x60.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/tty/serial/ifx6x60.c
> b/drivers/tty/serial/ifx6x60.c index 5b9bc19..467020b 100644
> --- a/drivers/tty/serial/ifx6x60.c
> +++ b/drivers/tty/serial/ifx6x60.c
> @@ -552,7 +552,10 @@ static void ifx_port_shutdown(struct tty_port
> *port) container_of(port, struct ifx_spi_device, tty_port);
>  
>  	mrdy_set_low(ifx_dev);
> -	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
> +	if (test_and_clear_bit(IFX_SPI_STATE_TIMER_PENDING,
> +		&ifx_dev->flags)) {
> +		del_timer(&ifx_dev->spi_timer);
> +	}

You don't actually need the test here as far as I can see. Providing a
timer has been initialised (init_timer) then running del_timer is safe
even if the timer is not currently queued or has completed.

Alan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
  2012-11-22 11:06 ` Alan Cox
@ 2012-11-23  1:25   ` chao bi
  0 siblings, 0 replies; 8+ messages in thread
From: chao bi @ 2012-11-23  1:25 UTC (permalink / raw)
  To: Alan Cox; +Cc: richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel

On Thu, 2012-11-22 at 11:06 +0000, Alan Cox wrote:
> > --- a/drivers/tty/serial/ifx6x60.c
> > +++ b/drivers/tty/serial/ifx6x60.c
> > @@ -552,7 +552,10 @@ static void ifx_port_shutdown(struct tty_port
> > *port) container_of(port, struct ifx_spi_device, tty_port);
> >  
> >  	mrdy_set_low(ifx_dev);
> > -	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
> > +	if (test_and_clear_bit(IFX_SPI_STATE_TIMER_PENDING,
> > +		&ifx_dev->flags)) {
> > +		del_timer(&ifx_dev->spi_timer);
> > +	}
> 
> You don't actually need the test here as far as I can see. Providing a
> timer has been initialised (init_timer) then running del_timer is safe
> even if the timer is not currently queued or has completed.
> 
> Alan

Yes, thanks. I'll update it.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
@ 2013-01-10  5:06 channing
  0 siblings, 0 replies; 8+ messages in thread
From: channing @ 2013-01-10  5:06 UTC (permalink / raw)
  To: alan; +Cc: greg, richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel


When shut down SPI port, it's possible that MRDY has been asserted and a SPI
timer was activated waiting for SRDY assert, in the case, it needs to delete
this timer.

Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
---
 drivers/tty/serial/ifx6x60.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 675d94a..7eed323 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -637,6 +637,7 @@ static void ifx_port_shutdown(struct tty_port *port)
 
 	clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags);
 	mrdy_set_low(ifx_dev);
+	del_timer(&ifx_dev->spi_timer);
 	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
 	tasklet_kill(&ifx_dev->io_work_tasklet);
 }
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
@ 2012-12-12  3:40 chao bi
  0 siblings, 0 replies; 8+ messages in thread
From: chao bi @ 2012-12-12  3:40 UTC (permalink / raw)
  To: Alan Cox; +Cc: richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel


When shut down SPI port, it's possible that MRDY has been asserted and a SPI
timer was activated waiting for SRDY assert, in the case, it needs to delete
this timer.

Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
---
 drivers/tty/serial/ifx6x60.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 675d94a..7eed323 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -637,6 +637,7 @@ static void ifx_port_shutdown(struct tty_port *port)
 
 	clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags);
 	mrdy_set_low(ifx_dev);
+	del_timer(&ifx_dev->spi_timer);
 	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
 	tasklet_kill(&ifx_dev->io_work_tasklet);
 }
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
@ 2012-11-27  5:30 chao bi
  0 siblings, 0 replies; 8+ messages in thread
From: chao bi @ 2012-11-27  5:30 UTC (permalink / raw)
  To: Alan Cox; +Cc: richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel


When shut down SPI port, it's possible that MRDY has been asserted and a SPI
timer was activated waiting for SRDY assert, in the case, it needs to delete
this timer.

Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
---
 drivers/tty/serial/ifx6x60.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 5b9bc19..f5e9666 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -552,6 +552,7 @@ static void ifx_port_shutdown(struct tty_port *port)
 		container_of(port, struct ifx_spi_device, tty_port);
 
 	mrdy_set_low(ifx_dev);
+	del_timer(&ifx_dev->spi_timer);
 	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
 	tasklet_kill(&ifx_dev->io_work_tasklet);
 }
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
  2012-11-23  1:33 chao bi
@ 2012-11-26 23:45 ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2012-11-26 23:45 UTC (permalink / raw)
  To: chao bi
  Cc: Alan Cox, richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel

On Fri, Nov 23, 2012 at 09:33:33AM +0800, chao bi wrote:
> 
> When shut down SPI port, it's possible that MRDY has been asserted and a SPI
> timer was activated waiting for SRDY assert, in the case, it needs to delete
> this timer.

This doesn't apply without fuzz, so I don't know what tree you are
working against here.

Please redo it against the latest version of the tty-next tree.

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
@ 2012-11-23  1:33 chao bi
  2012-11-26 23:45 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: chao bi @ 2012-11-23  1:33 UTC (permalink / raw)
  To: Alan Cox; +Cc: richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel


When shut down SPI port, it's possible that MRDY has been asserted and a SPI
timer was activated waiting for SRDY assert, in the case, it needs to delete
this timer.

Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
---
 drivers/tty/serial/ifx6x60.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 5b9bc19..f5e9666 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -552,6 +552,7 @@ static void ifx_port_shutdown(struct tty_port *port)
 		container_of(port, struct ifx_spi_device, tty_port);
 
 	mrdy_set_low(ifx_dev);
+	del_timer(&ifx_dev->spi_timer);
 	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
 	tasklet_kill(&ifx_dev->io_work_tasklet);
 }
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-01-10  4:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22  8:43 [PATCH] serial:ifx6x60:Delete SPI timer when shut down port chao bi
2012-11-22 11:06 ` Alan Cox
2012-11-23  1:25   ` chao bi
2012-11-23  1:33 chao bi
2012-11-26 23:45 ` Greg KH
2012-11-27  5:30 chao bi
2012-12-12  3:40 chao bi
2013-01-10  5:06 channing

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).