linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luciano Coelho <coelho@ti.com>
To: "juuso.oikarinen@nokia.com" <juuso.oikarinen@nokia.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wl12xx: Cleanup PLT mode when module is removed
Date: Fri, 14 Jan 2011 15:16:53 +0200	[thread overview]
Message-ID: <1295011013.1960.269.camel@pimenta> (raw)
In-Reply-To: <1295005726-10323-1-git-send-email-juuso.oikarinen@nokia.com>

Hi Juuso,

On Fri, 2011-01-14 at 12:48 +0100, juuso.oikarinen@nokia.com wrote:
> diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
> index 9076555..863e660 100644
> --- a/drivers/net/wireless/wl12xx/main.c
> +++ b/drivers/net/wireless/wl12xx/main.c
> @@ -917,12 +917,10 @@ out:
>  	return ret;
>  }
>  
> -int wl1271_plt_stop(struct wl1271 *wl)
> +int __wl1271_plt_stop(struct wl1271 *wl)
>  {
>  	int ret = 0;
>  
> -	mutex_lock(&wl->mutex);
> -
>  	wl1271_notice("power down");
>  
>  	if (wl->state != WL1271_STATE_PLT) {
> @@ -938,12 +936,21 @@ int wl1271_plt_stop(struct wl1271 *wl)
>  	wl->state = WL1271_STATE_OFF;
>  	wl->rx_counter = 0;
>  
> -out:
>  	mutex_unlock(&wl->mutex);
> -
>  	cancel_work_sync(&wl->irq_work);
>  	cancel_work_sync(&wl->recovery_work);
> +	mutex_lock(&wl->mutex);
> +out:
> +	return ret;
> +}

Again we have this kind of unlock-lock case.  Wouldn't it be better to
move the cancel_work calls outside this function and call them after
__wl1271_plt_stop() has returned? Yeah, there will be duplicate code if
we do this, but I think it's a bit safer, isn't it?

-- 
Cheers,
Luca.


  reply	other threads:[~2011-01-14 13:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-14 11:48 [PATCH] wl12xx: Cleanup PLT mode when module is removed juuso.oikarinen
2011-01-14 13:16 ` Luciano Coelho [this message]
2011-01-17  6:04   ` Juuso Oikarinen
2011-01-17  6:26     ` Juuso Oikarinen
2011-01-24 20:17 ` Luciano Coelho

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=1295011013.1960.269.camel@pimenta \
    --to=coelho@ti.com \
    --cc=juuso.oikarinen@nokia.com \
    --cc=linux-wireless@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 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).