summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/cw1200/cw1200_spi.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2013-06-02 09:53:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-06-03 15:54:55 -0400
commit6dd64a304eff76ca7dd41bf63df55efa965fa9ec (patch)
tree9fecf663307061ad6c35933b78c1a203552cad8b /drivers/net/wireless/cw1200/cw1200_spi.c
parent7b19bc2ca92ddda8f8e128593a2d523092ab4b14 (diff)
downloadblackbird-op-linux-6dd64a304eff76ca7dd41bf63df55efa965fa9ec.tar.gz
blackbird-op-linux-6dd64a304eff76ca7dd41bf63df55efa965fa9ec.zip
cw1200: Replace use of 'struct resource' with 'int' for GPIO fields.
The only advantage of 'struct resource' is that it lets us assign names as part of the platform data. Unfortunately since we are using platform data, we are already limited to a single instance of each driver, rendering this moot. So, replace the struct resources with ints, resulting in cleaner code. This was based on a suggestion from Arnd Bergmann. Signed-off-by: Solomon Peachy <pizza@shaftnet.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/cw1200/cw1200_spi.c')
-rw-r--r--drivers/net/wireless/cw1200/cw1200_spi.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/net/wireless/cw1200/cw1200_spi.c b/drivers/net/wireless/cw1200/cw1200_spi.c
index da5d24cc67db..d8dc7c6bb96d 100644
--- a/drivers/net/wireless/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/cw1200/cw1200_spi.c
@@ -268,12 +268,10 @@ static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self)
static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata)
{
- const struct resource *reset = pdata->reset;
-
- if (reset) {
- gpio_set_value(reset->start, 0);
+ if (pdata->reset) {
+ gpio_set_value(pdata->reset, 0);
msleep(30); /* Min is 2 * CLK32K cycles */
- gpio_free(reset->start);
+ gpio_free(pdata->reset);
}
if (pdata->power_ctrl)
@@ -286,19 +284,16 @@ static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata)
static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata)
{
- const struct resource *reset = pdata->reset;
- const struct resource *powerup = pdata->powerup;
-
/* Ensure I/Os are pulled low */
- if (reset) {
- gpio_request(reset->start, reset->name);
- gpio_direction_output(reset->start, 0);
+ if (pdata->reset) {
+ gpio_request(pdata->reset, "cw1200_wlan_reset");
+ gpio_direction_output(pdata->reset, 0);
}
- if (powerup) {
- gpio_request(powerup->start, powerup->name);
- gpio_direction_output(powerup->start, 0);
+ if (pdata->powerup) {
+ gpio_request(pdata->powerup, "cw1200_wlan_powerup");
+ gpio_direction_output(pdata->powerup, 0);
}
- if (reset || powerup)
+ if (pdata->reset || pdata->powerup)
msleep(10); /* Settle time? */
/* Enable 3v3 and 1v8 to hardware */
@@ -319,13 +314,13 @@ static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata)
}
/* Enable POWERUP signal */
- if (powerup) {
- gpio_set_value(powerup->start, 1);
+ if (pdata->powerup) {
+ gpio_set_value(pdata->powerup, 1);
msleep(250); /* or more..? */
}
/* Enable RSTn signal */
- if (reset) {
- gpio_set_value(reset->start, 1);
+ if (pdata->reset) {
+ gpio_set_value(pdata->reset, 1);
msleep(50); /* Or more..? */
}
return 0;
OpenPOWER on IntegriCloud