All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Arend van Spriel <arend@arend-vb-linux>
Cc: linux-wireless@vger.kernel.org,
	Arend van Spriel <arend@broadcom.com>,
	Kay Sievers <kay.sievers@vrfy.org>
Subject: Re: [RFC] brcm80211: smac: remove firmware requests from init_module syscall
Date: Mon, 20 Feb 2012 15:26:31 -0600	[thread overview]
Message-ID: <4F42BA87.9080005@lwfinger.net> (raw)
In-Reply-To: <1329770668-6484-1-git-send-email-arend@broadcom.com>

On 02/20/2012 02:44 PM, Arend van Spriel wrote:
> As indicated in [1] on netdev mailing list drivers should not block
> on the init_module() syscall. This patch defers the actual driver
> registration to a workqueue so the init_module() syscall can complete
> without delay.
>
> [1] http://article.gmane.org/gmane.linux.network/217729/
>
> Cc: Kay Sievers<kay.sievers@vrfy.org>
> Cc: Larry Finger<Larry.Finger@lwfinger.net>
> Signed-off-by: Arend van Spriel<arend@broadcom.com>
> ---
> Here is the patch I came up with to avoid udev blocking on init_module().
> It is pretty straightforward, but maybe I am overlooking things here. So
> feel free to comment.
>
> Gr. AvS

Arend,

Despite the simplicity, this patch looks right to me. As a side benefit, I 
learned about the DECLARE_WORK macro. Handy for this purpose.

Larry

> ---
>   .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |   17 ++++++++++-------
>   1 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
> index fec0f10..fe73451 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
> @@ -1173,21 +1173,24 @@ static struct bcma_driver brcms_bcma_driver = {
>    * and if so, performs a brcms_attach() on it.
>    *
>    */
> -static int __init brcms_module_init(void)
> +static void brcms_driver_init(struct work_struct *work)
>   {
>   	int error = -ENODEV;
>
> +	error = bcma_driver_register(&brcms_bcma_driver);
> +	pr_err("%s: register returned %d\n", __func__, error);
> +}
> +
> +DECLARE_WORK(brcms_driver_work, brcms_driver_init);
> +
> +static int __init brcms_module_init(void)
> +{
>   #ifdef DEBUG
>   	if (msglevel != 0xdeadbeef)
>   		brcm_msg_level = msglevel;
>   #endif				/* DEBUG */
>
> -	error = bcma_driver_register(&brcms_bcma_driver);
> -	pr_err("%s: register returned %d\n", __func__, error);
> -	if (!error)
> -		return 0;
> -
> -	return error;
> +	return schedule_work(&brcms_driver_work);
>   }
>
>   /**


           reply	other threads:[~2012-02-20 21:26 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1329770668-6484-1-git-send-email-arend@broadcom.com>]

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=4F42BA87.9080005@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=arend@arend-vb-linux \
    --cc=arend@broadcom.com \
    --cc=kay.sievers@vrfy.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.