linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <alan@linux.intel.com>
To: chao bi <chao.bi@intel.com>
Cc: richardx.r.gorby@intel.com, jun.d.chen@intel.com,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
Date: Thu, 22 Nov 2012 11:06:40 +0000	[thread overview]
Message-ID: <20121122110640.3fd5ef9b@bob.linux.org.uk> (raw)
In-Reply-To: <1353573787.22077.8.camel@bichao>

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

  reply	other threads:[~2012-11-22 18:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22  8:43 [PATCH] serial:ifx6x60:Delete SPI timer when shut down port chao bi
2012-11-22 11:06 ` Alan Cox [this message]
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

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=20121122110640.3fd5ef9b@bob.linux.org.uk \
    --to=alan@linux.intel.com \
    --cc=chao.bi@intel.com \
    --cc=jun.d.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=richardx.r.gorby@intel.com \
    /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).