Linux wireless drivers development
 help / color / mirror / Atom feed
From: Luciano Coelho <coelho@ti.com>
To: coelho@ti.com
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] wl12xx: add chip_family to platform data struct
Date: Tue,  8 Nov 2011 16:43:44 +0200	[thread overview]
Message-ID: <1320763424-466-1-git-send-email-coelho@ti.com> (raw)

To abstract the bus modules from the actual driver that handles the
chip, we can pass the chip_family struct in the platform data.  This
string is used by the bus modules to name the platform device they
create.  The same string is used by the platform driver to get probed.

If not specified, we use "wl12xx" as default for backwards
compatibility.

Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/sdio.c   |    6 +++++-
 drivers/net/wireless/wl12xx/spi.c    |    6 +++++-
 drivers/net/wireless/wl12xx/wl12xx.h |    2 ++
 include/linux/wl12xx.h               |    3 +++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 468a505..e266a20 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -226,7 +226,11 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	/* Tell PM core that we don't need the card to be powered now */
 	pm_runtime_put_noidle(&func->dev);
 
-	glue->core = platform_device_alloc("wl12xx", -1);
+	/* get the chip family from pdata, if not available use default */
+	glue->core = platform_device_alloc(wlan_data->chip_family?
+					   wlan_data->chip_family:
+					   DEFAULT_CHIP_FAMILY,
+					   -1);
 	if (!glue->core) {
 		dev_err(glue->dev, "can't allocate platform_device");
 		ret = -ENOMEM;
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 9e6f7fa..6a83d9e 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -351,7 +351,11 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 		goto out_free_glue;
 	}
 
-	glue->core = platform_device_alloc("wl12xx", -1);
+	/* get the chip family from pdata, if not available use default */
+	glue->core = platform_device_alloc(wlan_data->chip_family?
+					   wlan_data->chip_family:
+					   DEFAULT_CHIP_FAMILY,
+					   -1);
 	if (!glue->core) {
 		dev_err(glue->dev, "can't allocate platform_device\n");
 		ret = -ENOMEM;
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index e58e801..2f35960 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -45,6 +45,8 @@
 #define WL127X_FW_NAME "ti-connectivity/wl127x-fw-3.bin"
 #define WL128X_FW_NAME "ti-connectivity/wl128x-fw-3.bin"
 
+#define DEFAULT_CHIP_FAMILY "wl12xx"
+
 /*
  * wl127x and wl128x are using the same NVS file name. However, the
  * ini parameters between them are different.  The driver validates
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 0d63731..adea8f8 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -53,6 +53,9 @@ struct wl12xx_platform_data {
 	bool use_eeprom;
 	int board_ref_clock;
 	int board_tcxo_clock;
+	const char *chip_family;
+
+	/* internal use */
 	unsigned long platform_quirks;
 	bool pwr_in_suspend;
 
-- 
1.7.4.1


             reply	other threads:[~2011-11-08 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08 14:43 Luciano Coelho [this message]
2011-12-01 10:08 ` [PATCH] wl12xx: add chip_family to platform data struct 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=1320763424-466-1-git-send-email-coelho@ti.com \
    --to=coelho@ti.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