2010-09-15 23:27:38

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v6 0/7] native wl1271 support on ZOOM

This patchset adds wl1271 support on ZOOM2/3 boards.

Only basic support is included; power manipulation is submitted separately as SDIO Runtime PM support.

Changes since v5:
- rebase to wireless-testing
- remove 2nd copy from wl12xx_platform_data (keep the 1st one though)

Thanks,

Ohad Ben-Cohen (7):
wl12xx: make wl12xx.h common to both spi and sdio
wl1271: propagate set_power's return value
wl12xx: add platform data passing support
wl1271: take irq info from private board data
wl1271: make ref_clock configurable by board
omap: zoom: add fixed regulator device for wlan
omap: zoom: add mmc3/wl1271 device support

arch/arm/mach-omap2/board-zoom-peripherals.c | 54 ++++++++++++++++++++
drivers/net/wireless/Makefile | 2 +
drivers/net/wireless/wl12xx/Kconfig | 5 ++-
drivers/net/wireless/wl12xx/wl1251_sdio.c | 2 +-
drivers/net/wireless/wl12xx/wl1251_spi.c | 2 +-
drivers/net/wireless/wl12xx/wl1271.h | 3 +-
drivers/net/wireless/wl12xx/wl1271_boot.c | 11 +++--
drivers/net/wireless/wl12xx/wl1271_boot.h | 1 -
drivers/net/wireless/wl12xx/wl1271_io.h | 9 ++-
drivers/net/wireless/wl12xx/wl1271_main.c | 4 +-
drivers/net/wireless/wl12xx/wl1271_sdio.c | 31 +++++++-----
drivers/net/wireless/wl12xx/wl1271_spi.c | 8 ++-
drivers/net/wireless/wl12xx/wl12xx_platform_data.c | 28 ++++++++++
include/linux/spi/wl12xx.h | 34 ------------
include/linux/wl12xx.h | 38 ++++++++++++++
15 files changed, 170 insertions(+), 62 deletions(-)
create mode 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c
delete mode 100644 include/linux/spi/wl12xx.h
create mode 100644 include/linux/wl12xx.h



2010-09-15 23:27:41

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v6 1/7] wl12xx: make wl12xx.h common to both spi and sdio

Move wl12xx.h outside of the spi-specific location,
so it can be shared with both spi and sdio solutions.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1251_sdio.c | 2 +-
drivers/net/wireless/wl12xx/wl1251_spi.c | 2 +-
drivers/net/wireless/wl12xx/wl1271_spi.c | 2 +-
include/linux/spi/wl12xx.h | 34 -----------------------------
include/linux/wl12xx.h | 34 +++++++++++++++++++++++++++++
5 files changed, 37 insertions(+), 37 deletions(-)
delete mode 100644 include/linux/spi/wl12xx.h
create mode 100644 include/linux/wl12xx.h

diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c
index c0b68b0..74ba9ce 100644
--- a/drivers/net/wireless/wl12xx/wl1251_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c
@@ -24,7 +24,7 @@
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>
#include <linux/platform_device.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
#include <linux/irq.h>

#include "wl1251.h"
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c
index 334ded9..320de79 100644
--- a/drivers/net/wireless/wl12xx/wl1251_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1251_spi.c
@@ -24,7 +24,7 @@
#include <linux/slab.h>
#include <linux/crc7.h>
#include <linux/spi/spi.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>

#include "wl1251.h"
#include "wl1251_reg.h"
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 4cb99c5..c3fdab7 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -25,7 +25,7 @@
#include <linux/module.h>
#include <linux/crc7.h>
#include <linux/spi/spi.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
#include <linux/slab.h>

#include "wl1271.h"
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
deleted file mode 100644
index a20bccf..0000000
--- a/include/linux/spi/wl12xx.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of wl12xx
- *
- * Copyright (C) 2009 Nokia Corporation
- *
- * Contact: Luciano Coelho <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef _LINUX_SPI_WL12XX_H
-#define _LINUX_SPI_WL12XX_H
-
-struct wl12xx_platform_data {
- void (*set_power)(bool enable);
- /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
- int irq;
- bool use_eeprom;
-};
-
-#endif
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
new file mode 100644
index 0000000..015687a
--- /dev/null
+++ b/include/linux/wl12xx.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of wl12xx
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * Contact: Luciano Coelho <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef _LINUX_WL12XX_H
+#define _LINUX_WL12XX_H
+
+struct wl12xx_platform_data {
+ void (*set_power)(bool enable);
+ /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
+ int irq;
+ bool use_eeprom;
+};
+
+#endif
--
1.7.0.4


2010-09-16 19:57:49

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH v6 2/7] wl1271: propagate set_power's return value

On Thu, 2010-09-16 at 21:53 +0200, ext Ohad Ben-Cohen wrote:
> On Thu, Sep 16, 2010 at 9:40 PM, Luciano Coelho
> <[email protected]> wrote:
> >> + int ret = wl->if_ops->power(wl, true);
> >
> > I think it look nicer if you keep the "int ret" in one line by itself
> > and then do a ret = wl->if_ops... on another one.
>
> Fixed.
>
> >> +static int wl1271_sdio_power_on(struct wl1271 *wl)
> >> {
> >> struct sdio_func *func = wl_to_func(wl);
> >>
> >> sdio_claim_host(func);
> >> sdio_enable_func(func);
> >> sdio_release_host(func);
> >> +
> >> + return 0;
> >> }
> >
> > You seem to always return 0, so the whole chain to pass the value up
> > seems unnecessary. Is this just a preparation for a future patch?
>
> Yes, it's soon going to be:
>
> static int wl1271_sdio_power_on(struct wl1271 *wl)
> {
> struct sdio_func *func = wl_to_func(wl);
> int ret;
>
> ret = pm_runtime_get_sync(&func->dev);
> if (ret)
> goto out;
>
> sdio_claim_host(func);
> sdio_enable_func(func);
> sdio_release_host(func);
>
> out:
> return ret;
> }
>

Ok, that was the only explanation I could think of ;)

Acked-by: Luciano Coelho <[email protected]>

--
Cheers,
Luca.


2010-09-16 11:50:46

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v6 1/7] wl12xx: make wl12xx.h common to both spi and sdio

Hi John,

On Thu, Sep 16, 2010 at 1:16 PM, Ohad Ben-Cohen <[email protected]> wrote:
> Move wl12xx.h outside of the spi-specific location,
> so it can be shared with both spi and sdio solutions.
>
> Update all users of spi/wl12xx.h accordingly
>
> Signed-off-by: Ohad Ben-Cohen <[email protected]>
> ---

This updates the first patch in the patchset.

Please tell me if you prefer me to resubmit the whole set.

Thanks,
Ohad.

> ?MAINTAINERS ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?arch/arm/mach-omap2/board-omap3pandora.c ? ? | ? ?2 +-
> ?arch/arm/mach-omap2/board-rx51-peripherals.c | ? ?2 +-
> ?drivers/net/wireless/wl12xx/wl1251_sdio.c ? ?| ? ?2 +-
> ?drivers/net/wireless/wl12xx/wl1251_spi.c ? ? | ? ?2 +-
> ?drivers/net/wireless/wl12xx/wl1271_spi.c ? ? | ? ?2 +-
> ?include/linux/spi/wl12xx.h ? ? ? ? ? ? ? ? ? | ? 34 --------------------------
> ?include/linux/wl12xx.h ? ? ? ? ? ? ? ? ? ? ? | ? 34 ++++++++++++++++++++++++++
> ?8 files changed, 40 insertions(+), 40 deletions(-)
> ?delete mode 100644 include/linux/spi/wl12xx.h
> ?create mode 100644 include/linux/wl12xx.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 14ab8ca..b656c14 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6416,7 +6416,7 @@ W: ? ? ? ?http://wireless.kernel.org
> ?T: ? ? git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
> ?S: ? ? Maintained
> ?F: ? ? drivers/net/wireless/wl12xx/wl1271*
> -F: ? ? include/linux/spi/wl12xx.h
> +F: ? ? include/linux/wl12xx.h
>
> ?WL3501 WIRELESS PCMCIA CARD DRIVER
> ?M: ? ? Arnaldo Carvalho de Melo <[email protected]>
> diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
> index dd3af2b..7ea1eb4 100644
> --- a/arch/arm/mach-omap2/board-omap3pandora.c
> +++ b/arch/arm/mach-omap2/board-omap3pandora.c
> @@ -25,7 +25,7 @@
> ?#include <linux/spi/ads7846.h>
> ?#include <linux/regulator/machine.h>
> ?#include <linux/i2c/twl.h>
> -#include <linux/spi/wl12xx.h>
> +#include <linux/wl12xx.h>
> ?#include <linux/mtd/partitions.h>
> ?#include <linux/mtd/nand.h>
> ?#include <linux/leds.h>
> diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
> index 9a5eb87..ce28a85 100644
> --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> @@ -14,7 +14,7 @@
> ?#include <linux/input.h>
> ?#include <linux/input/matrix_keypad.h>
> ?#include <linux/spi/spi.h>
> -#include <linux/spi/wl12xx.h>
> +#include <linux/wl12xx.h>
> ?#include <linux/i2c.h>
> ?#include <linux/i2c/twl.h>
> ?#include <linux/clk.h>
> diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c
> index c0b68b0..74ba9ce 100644
> --- a/drivers/net/wireless/wl12xx/wl1251_sdio.c
> +++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c
> @@ -24,7 +24,7 @@
> ?#include <linux/mmc/sdio_func.h>
> ?#include <linux/mmc/sdio_ids.h>
> ?#include <linux/platform_device.h>
> -#include <linux/spi/wl12xx.h>
> +#include <linux/wl12xx.h>
> ?#include <linux/irq.h>
>
> ?#include "wl1251.h"
> diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c
> index 334ded9..320de79 100644
> --- a/drivers/net/wireless/wl12xx/wl1251_spi.c
> +++ b/drivers/net/wireless/wl12xx/wl1251_spi.c
> @@ -24,7 +24,7 @@
> ?#include <linux/slab.h>
> ?#include <linux/crc7.h>
> ?#include <linux/spi/spi.h>
> -#include <linux/spi/wl12xx.h>
> +#include <linux/wl12xx.h>
>
> ?#include "wl1251.h"
> ?#include "wl1251_reg.h"
> diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
> index 4cb99c5..c3fdab7 100644
> --- a/drivers/net/wireless/wl12xx/wl1271_spi.c
> +++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
> @@ -25,7 +25,7 @@
> ?#include <linux/module.h>
> ?#include <linux/crc7.h>
> ?#include <linux/spi/spi.h>
> -#include <linux/spi/wl12xx.h>
> +#include <linux/wl12xx.h>
> ?#include <linux/slab.h>
>
> ?#include "wl1271.h"
> diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
> deleted file mode 100644
> index a20bccf..0000000
> --- a/include/linux/spi/wl12xx.h
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -/*
> - * This file is part of wl12xx
> - *
> - * Copyright (C) 2009 Nokia Corporation
> - *
> - * Contact: Luciano Coelho <[email protected]>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * version 2 as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful, but
> - * WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the GNU
> - * General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA
> - *
> - */
> -
> -#ifndef _LINUX_SPI_WL12XX_H
> -#define _LINUX_SPI_WL12XX_H
> -
> -struct wl12xx_platform_data {
> - ? ? ? void (*set_power)(bool enable);
> - ? ? ? /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
> - ? ? ? int irq;
> - ? ? ? bool use_eeprom;
> -};
> -
> -#endif
> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> new file mode 100644
> index 0000000..015687a
> --- /dev/null
> +++ b/include/linux/wl12xx.h
> @@ -0,0 +1,34 @@
> +/*
> + * This file is part of wl12xx
> + *
> + * Copyright (C) 2009 Nokia Corporation
> + *
> + * Contact: Luciano Coelho <[email protected]>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA
> + *
> + */
> +
> +#ifndef _LINUX_WL12XX_H
> +#define _LINUX_WL12XX_H
> +
> +struct wl12xx_platform_data {
> + ? ? ? void (*set_power)(bool enable);
> + ? ? ? /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
> + ? ? ? int irq;
> + ? ? ? bool use_eeprom;
> +};
> +
> +#endif
> --
> 1.7.0.4
>
>

2010-09-16 19:57:18

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v6 01/17] wl12xx: make wl12xx.h common to both spi and sdio

On Thu, Sep 16, 2010 at 8:35 PM, Luciano Coelho
<[email protected]> wrote:
> Acked-by: Luciano Coelho <[email protected]>
>
> I just wonder why the wl12xx.h move wasn't detected as a rename. ?Did
> you forget to use the -M option in format-patch?

I thought it's because I stripped the SPI_ from the
#ifndef _LINUX_SPI_WL12XX_H, but it should be smarter than that.
Probably the -M.

Thanks,
Ohad.


>
> --
> Cheers,
> Luca.
>
>

2010-09-16 10:45:51

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v6 1/7] wl12xx: make wl12xx.h common to both spi and sdio

On Thu, Sep 16, 2010 at 12:17 PM, Teemu Paasikivi
<[email protected]> wrote:
> On Thu, 2010-09-16 at 01:22 +0200, ext Ohad Ben-Cohen wrote:
>> Move wl12xx.h outside of the spi-specific location,
>> so it can be shared with both spi and sdio solutions.
>>
>> Signed-off-by: Ohad Ben-Cohen <[email protected]>
>> ---
> Hi,
>
>
> wl12xx.h seems to be included also in
> arch/arm/mach-omap2/board-rx51-peripherals.c, so that should be changed
> too.

Thanks for catching this, I now see there are several spi/wl12xx.h
users (rx51, omap3pandora and MAINTAINERS).

An update is coming.

>
>
> Best Regards,
>
> Teemu Paasikivi
>
>
>

2010-09-16 18:36:52

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH v6 01/17] wl12xx: make wl12xx.h common to both spi and sdio

On Thu, 2010-09-16 at 13:16 +0200, ext Ohad Ben-Cohen wrote:
> Move wl12xx.h outside of the spi-specific location,
> so it can be shared with both spi and sdio solutions.
>
> Update all users of spi/wl12xx.h accordingly
>
> Signed-off-by: Ohad Ben-Cohen <[email protected]>
> ---

Acked-by: Luciano Coelho <[email protected]>

I just wonder why the wl12xx.h move wasn't detected as a rename. Did
you forget to use the -M option in format-patch?

--
Cheers,
Luca.


2010-09-16 19:54:01

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v6 2/7] wl1271: propagate set_power's return value

On Thu, Sep 16, 2010 at 9:40 PM, Luciano Coelho
<[email protected]> wrote:
>> + ? ? int ret = wl->if_ops->power(wl, true);
>
> I think it look nicer if you keep the "int ret" in one line by itself
> and then do a ret = wl->if_ops... on another one.

Fixed.

>> +static int wl1271_sdio_power_on(struct wl1271 *wl)
>> ?{
>> ? ? ? struct sdio_func *func = wl_to_func(wl);
>>
>> ? ? ? sdio_claim_host(func);
>> ? ? ? sdio_enable_func(func);
>> ? ? ? sdio_release_host(func);
>> +
>> + ? ? return 0;
>> ?}
>
> You seem to always return 0, so the whole chain to pass the value up
> seems unnecessary. ?Is this just a preparation for a future patch?

Yes, it's soon going to be:

static int wl1271_sdio_power_on(struct wl1271 *wl)
{
? ? ? struct sdio_func *func = wl_to_func(wl);
int ret;

ret = pm_runtime_get_sync(&func->dev);
if (ret)
goto out;

? ? ? sdio_claim_host(func);
? ? ? sdio_enable_func(func);
? ? ? sdio_release_host(func);

out:
? ? return ret;
}


Thanks,
Ohad.

>
> --
> Cheers,
> Luca.
>
>

2010-09-16 19:41:21

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH v6 2/7] wl1271: propagate set_power's return value

On Thu, 2010-09-16 at 01:22 +0200, ext Ohad Ben-Cohen wrote:
> Make it possible for the set power method to indicate a
> success/failure return value. This is needed to support
> more complex power on/off operations such as SDIO
> power manipulations.
>
> Signed-off-by: Ohad Ben-Cohen <[email protected]>
> ---

Some comments below.


> diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h
> index bc806c7..c1f92e6 100644
> --- a/drivers/net/wireless/wl12xx/wl1271_io.h
> +++ b/drivers/net/wireless/wl12xx/wl1271_io.h
> @@ -144,10 +144,13 @@ static inline void wl1271_power_off(struct wl1271 *wl)
> clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
> }
>
> -static inline void wl1271_power_on(struct wl1271 *wl)
> +static inline int wl1271_power_on(struct wl1271 *wl)
> {
> - wl->if_ops->power(wl, true);
> - set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
> + int ret = wl->if_ops->power(wl, true);

I think it look nicer if you keep the "int ret" in one line by itself
and then do a ret = wl->if_ops... on another one.


> + if (ret == 0)
> + set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
> +
> + return ret;
> }


> diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
> index b5d9565..1d5dc72 100644
> --- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
> +++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
> @@ -159,35 +159,38 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
> wl1271_error("sdio write failed (%d)", ret);
> }
>
> -static void wl1271_sdio_power_on(struct wl1271 *wl)
> +static int wl1271_sdio_power_on(struct wl1271 *wl)
> {
> struct sdio_func *func = wl_to_func(wl);
>
> sdio_claim_host(func);
> sdio_enable_func(func);
> sdio_release_host(func);
> +
> + return 0;
> }

You seem to always return 0, so the whole chain to pass the value up
seems unnecessary. Is this just a preparation for a future patch?

--
Cheers,
Luca.


2010-09-16 20:47:05

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH v6 01/17] wl12xx: make wl12xx.h common to both spi and sdio

* Luciano Coelho <[email protected]> [100916 11:28]:
> On Thu, 2010-09-16 at 13:16 +0200, ext Ohad Ben-Cohen wrote:
> > Move wl12xx.h outside of the spi-specific location,
> > so it can be shared with both spi and sdio solutions.
> >
> > Update all users of spi/wl12xx.h accordingly
> >
> > Signed-off-by: Ohad Ben-Cohen <[email protected]>
> > ---
>
> Acked-by: Luciano Coelho <[email protected]>

Looks good to me too:

Acked-by: Tony Lindgren <[email protected]>

2010-09-16 20:02:05

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH v6 01/17] wl12xx: make wl12xx.h common to both spi and sdio

On Thu, 2010-09-16 at 21:56 +0200, ext Ohad Ben-Cohen wrote:
> On Thu, Sep 16, 2010 at 8:35 PM, Luciano Coelho
> <[email protected]> wrote:
> > Acked-by: Luciano Coelho <[email protected]>
> >
> > I just wonder why the wl12xx.h move wasn't detected as a rename. Did
> > you forget to use the -M option in format-patch?
>
> I thought it's because I stripped the SPI_ from the
> #ifndef _LINUX_SPI_WL12XX_H, but it should be smarter than that.
> Probably the -M.

Yes, it is smarter than that. With small changes like this, -M will
still show it as a rename and show the diff instead of the whole file
-ed and +ed back ;)

--
Cheers,
Luca.


2010-09-16 10:18:54

by Teemu Paasikivi

[permalink] [raw]
Subject: Re: [PATCH v6 1/7] wl12xx: make wl12xx.h common to both spi and sdio

On Thu, 2010-09-16 at 01:22 +0200, ext Ohad Ben-Cohen wrote:
> Move wl12xx.h outside of the spi-specific location,
> so it can be shared with both spi and sdio solutions.
>
> Signed-off-by: Ohad Ben-Cohen <[email protected]>
> ---
Hi,


wl12xx.h seems to be included also in
arch/arm/mach-omap2/board-rx51-peripherals.c, so that should be changed
too.


Best Regards,

Teemu Paasikivi



2010-09-15 23:27:44

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v6 2/7] wl1271: propagate set_power's return value

Make it possible for the set power method to indicate a
success/failure return value. This is needed to support
more complex power on/off operations such as SDIO
power manipulations.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271.h | 2 +-
drivers/net/wireless/wl12xx/wl1271_io.h | 9 ++++++---
drivers/net/wireless/wl12xx/wl1271_main.c | 4 +++-
drivers/net/wireless/wl12xx/wl1271_sdio.c | 15 +++++++++------
drivers/net/wireless/wl12xx/wl1271_spi.c | 4 +++-
5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index dd3cee6..faa5925 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -313,7 +313,7 @@ struct wl1271_if_operations {
bool fixed);
void (*reset)(struct wl1271 *wl);
void (*init)(struct wl1271 *wl);
- void (*power)(struct wl1271 *wl, bool enable);
+ int (*power)(struct wl1271 *wl, bool enable);
struct device* (*dev)(struct wl1271 *wl);
void (*enable_irq)(struct wl1271 *wl);
void (*disable_irq)(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h
index bc806c7..c1f92e6 100644
--- a/drivers/net/wireless/wl12xx/wl1271_io.h
+++ b/drivers/net/wireless/wl12xx/wl1271_io.h
@@ -144,10 +144,13 @@ static inline void wl1271_power_off(struct wl1271 *wl)
clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
}

-static inline void wl1271_power_on(struct wl1271 *wl)
+static inline int wl1271_power_on(struct wl1271 *wl)
{
- wl->if_ops->power(wl, true);
- set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
+ int ret = wl->if_ops->power(wl, true);
+ if (ret == 0)
+ set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
+
+ return ret;
}


diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 8e55cf8..af26150 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -621,7 +621,9 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
int ret = 0;

msleep(WL1271_PRE_POWER_ON_SLEEP);
- wl1271_power_on(wl);
+ ret = wl1271_power_on(wl);
+ if (ret < 0)
+ goto out;
msleep(WL1271_POWER_ON_SLEEP);
wl1271_io_reset(wl);
wl1271_io_init(wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index b5d9565..1d5dc72 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -159,35 +159,38 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
wl1271_error("sdio write failed (%d)", ret);
}

-static void wl1271_sdio_power_on(struct wl1271 *wl)
+static int wl1271_sdio_power_on(struct wl1271 *wl)
{
struct sdio_func *func = wl_to_func(wl);

sdio_claim_host(func);
sdio_enable_func(func);
sdio_release_host(func);
+
+ return 0;
}

-static void wl1271_sdio_power_off(struct wl1271 *wl)
+static int wl1271_sdio_power_off(struct wl1271 *wl)
{
struct sdio_func *func = wl_to_func(wl);

sdio_claim_host(func);
sdio_disable_func(func);
sdio_release_host(func);
+
+ return 0;
}

-static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
+static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
{
/* Let the SDIO stack handle wlan_enable control, so we
* keep host claimed while wlan is in use to keep wl1271
* alive.
*/
if (enable)
- wl1271_sdio_power_on(wl);
+ return wl1271_sdio_power_on(wl);
else
- wl1271_sdio_power_off(wl);
-
+ return wl1271_sdio_power_off(wl);
}

static struct wl1271_if_operations sdio_ops = {
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index c3fdab7..de56d8d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -312,10 +312,12 @@ static irqreturn_t wl1271_irq(int irq, void *cookie)
return IRQ_HANDLED;
}

-static void wl1271_spi_set_power(struct wl1271 *wl, bool enable)
+static int wl1271_spi_set_power(struct wl1271 *wl, bool enable)
{
if (wl->set_power)
wl->set_power(enable);
+
+ return 0;
}

static struct wl1271_if_operations spi_ops = {
--
1.7.0.4


2010-09-16 11:15:40

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v6 01/17] wl12xx: make wl12xx.h common to both spi and sdio

Move wl12xx.h outside of the spi-specific location,
so it can be shared with both spi and sdio solutions.

Update all users of spi/wl12xx.h accordingly

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
MAINTAINERS | 2 +-
arch/arm/mach-omap2/board-omap3pandora.c | 2 +-
arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +-
drivers/net/wireless/wl12xx/wl1251_sdio.c | 2 +-
drivers/net/wireless/wl12xx/wl1251_spi.c | 2 +-
drivers/net/wireless/wl12xx/wl1271_spi.c | 2 +-
include/linux/spi/wl12xx.h | 34 --------------------------
include/linux/wl12xx.h | 34 ++++++++++++++++++++++++++
8 files changed, 40 insertions(+), 40 deletions(-)
delete mode 100644 include/linux/spi/wl12xx.h
create mode 100644 include/linux/wl12xx.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 14ab8ca..b656c14 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6416,7 +6416,7 @@ W: http://wireless.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
S: Maintained
F: drivers/net/wireless/wl12xx/wl1271*
-F: include/linux/spi/wl12xx.h
+F: include/linux/wl12xx.h

WL3501 WIRELESS PCMCIA CARD DRIVER
M: Arnaldo Carvalho de Melo <[email protected]>
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index dd3af2b..7ea1eb4 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -25,7 +25,7 @@
#include <linux/spi/ads7846.h>
#include <linux/regulator/machine.h>
#include <linux/i2c/twl.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/nand.h>
#include <linux/leds.h>
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 9a5eb87..ce28a85 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -14,7 +14,7 @@
#include <linux/input.h>
#include <linux/input/matrix_keypad.h>
#include <linux/spi/spi.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
#include <linux/i2c.h>
#include <linux/i2c/twl.h>
#include <linux/clk.h>
diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c
index c0b68b0..74ba9ce 100644
--- a/drivers/net/wireless/wl12xx/wl1251_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c
@@ -24,7 +24,7 @@
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>
#include <linux/platform_device.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
#include <linux/irq.h>

#include "wl1251.h"
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c
index 334ded9..320de79 100644
--- a/drivers/net/wireless/wl12xx/wl1251_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1251_spi.c
@@ -24,7 +24,7 @@
#include <linux/slab.h>
#include <linux/crc7.h>
#include <linux/spi/spi.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>

#include "wl1251.h"
#include "wl1251_reg.h"
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 4cb99c5..c3fdab7 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -25,7 +25,7 @@
#include <linux/module.h>
#include <linux/crc7.h>
#include <linux/spi/spi.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
#include <linux/slab.h>

#include "wl1271.h"
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
deleted file mode 100644
index a20bccf..0000000
--- a/include/linux/spi/wl12xx.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of wl12xx
- *
- * Copyright (C) 2009 Nokia Corporation
- *
- * Contact: Luciano Coelho <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef _LINUX_SPI_WL12XX_H
-#define _LINUX_SPI_WL12XX_H
-
-struct wl12xx_platform_data {
- void (*set_power)(bool enable);
- /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
- int irq;
- bool use_eeprom;
-};
-
-#endif
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
new file mode 100644
index 0000000..015687a
--- /dev/null
+++ b/include/linux/wl12xx.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of wl12xx
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * Contact: Luciano Coelho <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef _LINUX_WL12XX_H
+#define _LINUX_WL12XX_H
+
+struct wl12xx_platform_data {
+ void (*set_power)(bool enable);
+ /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
+ int irq;
+ bool use_eeprom;
+};
+
+#endif
--
1.7.0.4