All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Andreas Fenkart <afenkart@gmail.com>
Cc: linux-wireless@vger.kernel.org,
	Amitkumar Karwar <akarwar@marvell.com>,
	Avinash Patil <patila@marvell.com>
Subject: Re: [PATCH 1/2] mwifiex: sdio: create global list of adapters
Date: Tue, 28 Apr 2015 18:58:15 +0300	[thread overview]
Message-ID: <87mw1s5joo.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1428916704-9635-1-git-send-email-afenkart@gmail.com> (Andreas Fenkart's message of "Mon, 13 Apr 2015 11:18:23 +0200")

Andreas Fenkart <afenkart@gmail.com> writes:

> we need to verify that a an adapter pointer, still points to a
> valid adapter. this is not possible through other global structures,
> such as net_namespace_list. the problem with the net_namespace_list
> is that an adapter can have multiple interfaces, hence we had to
> de-reference the maybe invalid pointer to get the interface struct.
>
> Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
> ---
>  drivers/net/wireless/mwifiex/sdio.c | 14 ++++++++++++++
>  drivers/net/wireless/mwifiex/sdio.h |  1 +
>  2 files changed, 15 insertions(+)
>
> diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
> index 91e36cd..a70e114 100644
> --- a/drivers/net/wireless/mwifiex/sdio.c
> +++ b/drivers/net/wireless/mwifiex/sdio.c
> @@ -69,6 +69,12 @@ static struct memory_type_mapping mem_type_mapping_tbl[] = {
>  };
>  
>  /*
> + * list of active cards
> + */
> +static LIST_HEAD(cards);
> +static DEFINE_MUTEX(cards_mutex);
> +
> +/*
>   * SDIO probe.
>   *
>   * This function probes an mwifiex device and registers it. It allocates
> @@ -130,6 +136,10 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
>  		ret = -1;
>  	}
>  
> +	mutex_lock(&cards_mutex);
> +	list_add(&card->next, &cards);
> +	mutex_unlock(&cards_mutex);
> +
>  	return ret;
>  }
>  
> @@ -196,6 +206,10 @@ mwifiex_sdio_remove(struct sdio_func *func)
>  	if (!card)
>  		return;
>  
> +	mutex_lock(&cards_mutex);
> +	list_del(&card->next);
> +	mutex_unlock(&cards_mutex);

This is extremely ugly and the commit log doesn't even tell anything
about the issue you trying to fix so it's difficult to even suggest
anything else. For starters can you provide more information, please?
There has to be a better way to solve it.

-- 
Kalle Valo

      parent reply	other threads:[~2015-04-28 15:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13  9:18 [PATCH 1/2] mwifiex: sdio: create global list of adapters Andreas Fenkart
2015-04-13  9:18 ` [PATCH 2/2] mwifiex: sdio: bug: dead-lock in card reset Andreas Fenkart
2015-04-13 10:27   ` Amitkumar Karwar
2015-04-16  9:02     ` Andreas Fenkart
2015-04-16  9:59       ` Amitkumar Karwar
2015-04-28 16:04     ` Kalle Valo
2015-04-28 21:15       ` Andreas Fenkart
2015-04-28 15:58 ` Kalle Valo [this message]

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=87mw1s5joo.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@codeaurora.org \
    --cc=afenkart@gmail.com \
    --cc=akarwar@marvell.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=patila@marvell.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 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.