All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mwifiex: sdio: create global list of adapters
@ 2015-04-13  9:18 Andreas Fenkart
  2015-04-13  9:18 ` [PATCH 2/2] mwifiex: sdio: bug: dead-lock in card reset Andreas Fenkart
  2015-04-28 15:58 ` [PATCH 1/2] mwifiex: sdio: create global list of adapters Kalle Valo
  0 siblings, 2 replies; 8+ messages in thread
From: Andreas Fenkart @ 2015-04-13  9:18 UTC (permalink / raw)
  To: linux-wireless; +Cc: Amitkumar Karwar, Avinash Patil, Andreas Fenkart

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);
+
 	adapter = card->adapter;
 	if (!adapter || !adapter->priv_num)
 		return;
diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h
index 957cca2..9be5650 100644
--- a/drivers/net/wireless/mwifiex/sdio.h
+++ b/drivers/net/wireless/mwifiex/sdio.h
@@ -260,6 +260,7 @@ struct sdio_mmc_card {
 
 	struct mwifiex_sdio_mpa_tx mpa_tx;
 	struct mwifiex_sdio_mpa_rx mpa_rx;
+	struct list_head next;
 };
 
 struct mwifiex_sdio_device {
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-28 21:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/2] mwifiex: sdio: create global list of adapters Kalle Valo

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.