Search Linux Wireless

Re: [PATCH 1/2] mwifiex: sdio: create global list of adapters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andreas Fenkart <afenkart@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux