ath9k: fix some ANI related stability issues
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 900-wl1251-split-wl251-platform-data-to-a-separate-structure.patch
1 Move the wl1251 part of the wl12xx platform data structure into a new
2 structure specifically for wl1251. Change the platform data built-in
3 block and board files accordingly.
4
5 Cc: Tony Lindgren <tony@atomide.com>
6 Signed-off-by: Luciano Coelho <coelho@ti.com>
7 Acked-by: Tony Lindgren <tony@atomide.com>
8 Reviewed-by: Felipe Balbi <balbi@ti.com>
9
10 --- a/drivers/net/wireless/ti/wilink_platform_data.c
11 +++ b/drivers/net/wireless/ti/wilink_platform_data.c
12 @@ -23,17 +23,17 @@
13 #include <linux/err.h>
14 #include <linux/wl12xx.h>
15
16 -static struct wl12xx_platform_data *platform_data;
17 +static struct wl12xx_platform_data *wl12xx_platform_data;
18
19 int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
20 {
21 - if (platform_data)
22 + if (wl12xx_platform_data)
23 return -EBUSY;
24 if (!data)
25 return -EINVAL;
26
27 - platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
28 - if (!platform_data)
29 + wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
30 + if (!wl12xx_platform_data)
31 return -ENOMEM;
32
33 return 0;
34 @@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(cons
35
36 struct wl12xx_platform_data *wl12xx_get_platform_data(void)
37 {
38 - if (!platform_data)
39 + if (!wl12xx_platform_data)
40 return ERR_PTR(-ENODEV);
41
42 - return platform_data;
43 + return wl12xx_platform_data;
44 }
45 EXPORT_SYMBOL(wl12xx_get_platform_data);
46 +
47 +static struct wl1251_platform_data *wl1251_platform_data;
48 +
49 +int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
50 +{
51 + if (wl1251_platform_data)
52 + return -EBUSY;
53 + if (!data)
54 + return -EINVAL;
55 +
56 + wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
57 + if (!wl1251_platform_data)
58 + return -ENOMEM;
59 +
60 + return 0;
61 +}
62 +
63 +struct wl1251_platform_data *wl1251_get_platform_data(void)
64 +{
65 + if (!wl1251_platform_data)
66 + return ERR_PTR(-ENODEV);
67 +
68 + return wl1251_platform_data;
69 +}
70 +EXPORT_SYMBOL(wl1251_get_platform_data);
71 --- a/drivers/net/wireless/ti/wl1251/sdio.c
72 +++ b/drivers/net/wireless/ti/wl1251/sdio.c
73 @@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio
74 struct wl1251 *wl;
75 struct ieee80211_hw *hw;
76 struct wl1251_sdio *wl_sdio;
77 - const struct wl12xx_platform_data *wl12xx_board_data;
78 + const struct wl1251_platform_data *wl1251_board_data;
79
80 hw = wl1251_alloc_hw();
81 if (IS_ERR(hw))
82 @@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio
83 wl->if_priv = wl_sdio;
84 wl->if_ops = &wl1251_sdio_ops;
85
86 - wl12xx_board_data = wl12xx_get_platform_data();
87 - if (!IS_ERR(wl12xx_board_data)) {
88 - wl->set_power = wl12xx_board_data->set_power;
89 - wl->irq = wl12xx_board_data->irq;
90 - wl->use_eeprom = wl12xx_board_data->use_eeprom;
91 + wl1251_board_data = wl1251_get_platform_data();
92 + if (!IS_ERR(wl1251_board_data)) {
93 + wl->set_power = wl1251_board_data->set_power;
94 + wl->irq = wl1251_board_data->irq;
95 + wl->use_eeprom = wl1251_board_data->use_eeprom;
96 }
97
98 if (wl->irq) {
99 --- a/drivers/net/wireless/ti/wl1251/spi.c
100 +++ b/drivers/net/wireless/ti/wl1251/spi.c
101 @@ -241,7 +241,7 @@ static const struct wl1251_if_operations
102
103 static int wl1251_spi_probe(struct spi_device *spi)
104 {
105 - struct wl12xx_platform_data *pdata;
106 + struct wl1251_platform_data *pdata;
107 struct ieee80211_hw *hw;
108 struct wl1251 *wl;
109 int ret;