AA: mac80211: backport package from trunk r39886
[12.09/openwrt.git] / package / mac80211 / patches / 900-wl1251-split-wl251-platform-data-to-a-separate-structure.patch
diff --git a/package/mac80211/patches/900-wl1251-split-wl251-platform-data-to-a-separate-structure.patch b/package/mac80211/patches/900-wl1251-split-wl251-platform-data-to-a-separate-structure.patch
new file mode 100644 (file)
index 0000000..a8af257
--- /dev/null
@@ -0,0 +1,109 @@
+Move the wl1251 part of the wl12xx platform data structure into a new
+structure specifically for wl1251.  Change the platform data built-in
+block and board files accordingly.
+
+Cc: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Luciano Coelho <coelho@ti.com>
+Acked-by: Tony Lindgren <tony@atomide.com>
+Reviewed-by: Felipe Balbi <balbi@ti.com>
+
+--- a/drivers/net/wireless/ti/wilink_platform_data.c
++++ b/drivers/net/wireless/ti/wilink_platform_data.c
+@@ -23,17 +23,17 @@
+ #include <linux/err.h>
+ #include <linux/wl12xx.h>
+-static struct wl12xx_platform_data *platform_data;
++static struct wl12xx_platform_data *wl12xx_platform_data;
+ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
+ {
+-      if (platform_data)
++      if (wl12xx_platform_data)
+               return -EBUSY;
+       if (!data)
+               return -EINVAL;
+-      platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+-      if (!platform_data)
++      wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
++      if (!wl12xx_platform_data)
+               return -ENOMEM;
+       return 0;
+@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(cons
+ struct wl12xx_platform_data *wl12xx_get_platform_data(void)
+ {
+-      if (!platform_data)
++      if (!wl12xx_platform_data)
+               return ERR_PTR(-ENODEV);
+-      return platform_data;
++      return wl12xx_platform_data;
+ }
+ EXPORT_SYMBOL(wl12xx_get_platform_data);
++
++static struct wl1251_platform_data *wl1251_platform_data;
++
++int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
++{
++      if (wl1251_platform_data)
++              return -EBUSY;
++      if (!data)
++              return -EINVAL;
++
++      wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
++      if (!wl1251_platform_data)
++              return -ENOMEM;
++
++      return 0;
++}
++
++struct wl1251_platform_data *wl1251_get_platform_data(void)
++{
++      if (!wl1251_platform_data)
++              return ERR_PTR(-ENODEV);
++
++      return wl1251_platform_data;
++}
++EXPORT_SYMBOL(wl1251_get_platform_data);
+--- a/drivers/net/wireless/ti/wl1251/sdio.c
++++ b/drivers/net/wireless/ti/wl1251/sdio.c
+@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio
+       struct wl1251 *wl;
+       struct ieee80211_hw *hw;
+       struct wl1251_sdio *wl_sdio;
+-      const struct wl12xx_platform_data *wl12xx_board_data;
++      const struct wl1251_platform_data *wl1251_board_data;
+       hw = wl1251_alloc_hw();
+       if (IS_ERR(hw))
+@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio
+       wl->if_priv = wl_sdio;
+       wl->if_ops = &wl1251_sdio_ops;
+-      wl12xx_board_data = wl12xx_get_platform_data();
+-      if (!IS_ERR(wl12xx_board_data)) {
+-              wl->set_power = wl12xx_board_data->set_power;
+-              wl->irq = wl12xx_board_data->irq;
+-              wl->use_eeprom = wl12xx_board_data->use_eeprom;
++      wl1251_board_data = wl1251_get_platform_data();
++      if (!IS_ERR(wl1251_board_data)) {
++              wl->set_power = wl1251_board_data->set_power;
++              wl->irq = wl1251_board_data->irq;
++              wl->use_eeprom = wl1251_board_data->use_eeprom;
+       }
+       if (wl->irq) {
+--- a/drivers/net/wireless/ti/wl1251/spi.c
++++ b/drivers/net/wireless/ti/wl1251/spi.c
+@@ -241,7 +241,7 @@ static const struct wl1251_if_operations
+ static int wl1251_spi_probe(struct spi_device *spi)
+ {
+-      struct wl12xx_platform_data *pdata;
++      struct wl1251_platform_data *pdata;
+       struct ieee80211_hw *hw;
+       struct wl1251 *wl;
+       int ret;