aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2013-06-01 08:08:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-06-03 15:54:37 -0400
commit911373cca1b45571b62938f8f19cec24cb102471 (patch)
tree9488898d55ff341723ac352c3f7eae1c2ede4a75 /drivers
parent3e817f086f06069a23b797ee2279bbae638d5edc (diff)
cw1200: Rename 'sbus' to 'hwbus'
This avoids problems when building on SPARC targets due to the driver calling the bus abstraction layer 'sbus'. Not that any SBUS-sporting SPARC targets are likely to have an SDIO controller, but this is the correct thing to do. See http://kisskb.ellerman.id.au/kisskb/buildresult/8846508/ Signed-off-by: Solomon Peachy <pizza@shaftnet.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/cw1200/bh.c20
-rw-r--r--drivers/net/wireless/cw1200/cw1200.h10
-rw-r--r--drivers/net/wireless/cw1200/cw1200_sdio.c44
-rw-r--r--drivers/net/wireless/cw1200/cw1200_spi.c38
-rw-r--r--drivers/net/wireless/cw1200/fwio.c10
-rw-r--r--drivers/net/wireless/cw1200/hwbus.h33
-rw-r--r--drivers/net/wireless/cw1200/hwio.c30
-rw-r--r--drivers/net/wireless/cw1200/main.c14
-rw-r--r--drivers/net/wireless/cw1200/pm.c6
-rw-r--r--drivers/net/wireless/cw1200/sbus.h37
10 files changed, 119 insertions, 123 deletions
diff --git a/drivers/net/wireless/cw1200/bh.c b/drivers/net/wireless/cw1200/bh.c
index cf7375f92fb3..324b57001da0 100644
--- a/drivers/net/wireless/cw1200/bh.c
+++ b/drivers/net/wireless/cw1200/bh.c
@@ -23,7 +23,7 @@
23#include "bh.h" 23#include "bh.h"
24#include "hwio.h" 24#include "hwio.h"
25#include "wsm.h" 25#include "wsm.h"
26#include "sbus.h" 26#include "hwbus.h"
27#include "debug.h" 27#include "debug.h"
28#include "fwio.h" 28#include "fwio.h"
29 29
@@ -103,7 +103,7 @@ void cw1200_irq_handler(struct cw1200_common *priv)
103 pr_debug("[BH] irq.\n"); 103 pr_debug("[BH] irq.\n");
104 104
105 /* Disable Interrupts! */ 105 /* Disable Interrupts! */
106 /* NOTE: sbus_ops->lock already held */ 106 /* NOTE: hwbus_ops->lock already held */
107 __cw1200_irq_enable(priv, 0); 107 __cw1200_irq_enable(priv, 0);
108 108
109 if (/* WARN_ON */(priv->bh_error)) 109 if (/* WARN_ON */(priv->bh_error))
@@ -265,8 +265,8 @@ static int cw1200_bh_rx_helper(struct cw1200_common *priv,
265 * to the NEXT Message length + 2 Bytes for SKB */ 265 * to the NEXT Message length + 2 Bytes for SKB */
266 read_len = read_len + 2; 266 read_len = read_len + 2;
267 267
268 alloc_len = priv->sbus_ops->align_size( 268 alloc_len = priv->hwbus_ops->align_size(
269 priv->sbus_priv, read_len); 269 priv->hwbus_priv, read_len);
270 270
271 /* Check if not exceeding CW1200 capabilities */ 271 /* Check if not exceeding CW1200 capabilities */
272 if (WARN_ON_ONCE(alloc_len > EFFECTIVE_BUF_SIZE)) { 272 if (WARN_ON_ONCE(alloc_len > EFFECTIVE_BUF_SIZE)) {
@@ -384,8 +384,8 @@ static int cw1200_bh_tx_helper(struct cw1200_common *priv,
384 384
385 atomic_add(1, &priv->bh_tx); 385 atomic_add(1, &priv->bh_tx);
386 386
387 tx_len = priv->sbus_ops->align_size( 387 tx_len = priv->hwbus_ops->align_size(
388 priv->sbus_priv, tx_len); 388 priv->hwbus_priv, tx_len);
389 389
390 /* Check if not exceeding CW1200 capabilities */ 390 /* Check if not exceeding CW1200 capabilities */
391 if (WARN_ON_ONCE(tx_len > EFFECTIVE_BUF_SIZE)) 391 if (WARN_ON_ONCE(tx_len > EFFECTIVE_BUF_SIZE))
@@ -597,15 +597,15 @@ static int cw1200_bh(void *arg)
597 597
598 done: 598 done:
599 /* Re-enable device interrupts */ 599 /* Re-enable device interrupts */
600 priv->sbus_ops->lock(priv->sbus_priv); 600 priv->hwbus_ops->lock(priv->hwbus_priv);
601 __cw1200_irq_enable(priv, 1); 601 __cw1200_irq_enable(priv, 1);
602 priv->sbus_ops->unlock(priv->sbus_priv); 602 priv->hwbus_ops->unlock(priv->hwbus_priv);
603 } 603 }
604 604
605 /* Explicitly disable device interrupts */ 605 /* Explicitly disable device interrupts */
606 priv->sbus_ops->lock(priv->sbus_priv); 606 priv->hwbus_ops->lock(priv->hwbus_priv);
607 __cw1200_irq_enable(priv, 0); 607 __cw1200_irq_enable(priv, 0);
608 priv->sbus_ops->unlock(priv->sbus_priv); 608 priv->hwbus_ops->unlock(priv->hwbus_priv);
609 609
610 if (!term) { 610 if (!term) {
611 pr_err("[BH] Fatal error, exiting.\n"); 611 pr_err("[BH] Fatal error, exiting.\n");
diff --git a/drivers/net/wireless/cw1200/cw1200.h b/drivers/net/wireless/cw1200/cw1200.h
index e9424e635883..95320f2b25eb 100644
--- a/drivers/net/wireless/cw1200/cw1200.h
+++ b/drivers/net/wireless/cw1200/cw1200.h
@@ -30,7 +30,7 @@
30#include "pm.h" 30#include "pm.h"
31 31
32/* Forward declarations */ 32/* Forward declarations */
33struct sbus_ops; 33struct hwbus_ops;
34struct task_struct; 34struct task_struct;
35struct cw1200_debug_priv; 35struct cw1200_debug_priv;
36struct firmware; 36struct firmware;
@@ -109,8 +109,8 @@ struct cw1200_common {
109 u8 mac_addr[ETH_ALEN]; 109 u8 mac_addr[ETH_ALEN];
110 110
111 /* Hardware interface */ 111 /* Hardware interface */
112 const struct sbus_ops *sbus_ops; 112 const struct hwbus_ops *hwbus_ops;
113 struct sbus_priv *sbus_priv; 113 struct hwbus_priv *hwbus_priv;
114 114
115 /* Hardware information */ 115 /* Hardware information */
116 enum { 116 enum {
@@ -298,8 +298,8 @@ struct cw1200_sta_priv {
298}; 298};
299 299
300/* interfaces for the drivers */ 300/* interfaces for the drivers */
301int cw1200_core_probe(const struct sbus_ops *sbus_ops, 301int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
302 struct sbus_priv *sbus, 302 struct hwbus_priv *hwbus,
303 struct device *pdev, 303 struct device *pdev,
304 struct cw1200_common **pself, 304 struct cw1200_common **pself,
305 int ref_clk, const u8 *macaddr, 305 int ref_clk, const u8 *macaddr,
diff --git a/drivers/net/wireless/cw1200/cw1200_sdio.c b/drivers/net/wireless/cw1200/cw1200_sdio.c
index 863510d062fb..78c3bc55cd0b 100644
--- a/drivers/net/wireless/cw1200/cw1200_sdio.c
+++ b/drivers/net/wireless/cw1200/cw1200_sdio.c
@@ -19,7 +19,7 @@
19#include <net/mac80211.h> 19#include <net/mac80211.h>
20 20
21#include "cw1200.h" 21#include "cw1200.h"
22#include "sbus.h" 22#include "hwbus.h"
23#include <linux/cw1200_platform.h> 23#include <linux/cw1200_platform.h>
24#include "hwio.h" 24#include "hwio.h"
25 25
@@ -29,7 +29,7 @@ MODULE_LICENSE("GPL");
29 29
30#define SDIO_BLOCK_SIZE (512) 30#define SDIO_BLOCK_SIZE (512)
31 31
32struct sbus_priv { 32struct hwbus_priv {
33 struct sdio_func *func; 33 struct sdio_func *func;
34 struct cw1200_common *core; 34 struct cw1200_common *core;
35 const struct cw1200_platform_data_sdio *pdata; 35 const struct cw1200_platform_data_sdio *pdata;
@@ -48,35 +48,35 @@ static const struct sdio_device_id cw1200_sdio_ids[] = {
48 { /* end: all zeroes */ }, 48 { /* end: all zeroes */ },
49}; 49};
50 50
51/* sbus_ops implemetation */ 51/* hwbus_ops implemetation */
52 52
53static int cw1200_sdio_memcpy_fromio(struct sbus_priv *self, 53static int cw1200_sdio_memcpy_fromio(struct hwbus_priv *self,
54 unsigned int addr, 54 unsigned int addr,
55 void *dst, int count) 55 void *dst, int count)
56{ 56{
57 return sdio_memcpy_fromio(self->func, dst, addr, count); 57 return sdio_memcpy_fromio(self->func, dst, addr, count);
58} 58}
59 59
60static int cw1200_sdio_memcpy_toio(struct sbus_priv *self, 60static int cw1200_sdio_memcpy_toio(struct hwbus_priv *self,
61 unsigned int addr, 61 unsigned int addr,
62 const void *src, int count) 62 const void *src, int count)
63{ 63{
64 return sdio_memcpy_toio(self->func, addr, (void *)src, count); 64 return sdio_memcpy_toio(self->func, addr, (void *)src, count);
65} 65}
66 66
67static void cw1200_sdio_lock(struct sbus_priv *self) 67static void cw1200_sdio_lock(struct hwbus_priv *self)
68{ 68{
69 sdio_claim_host(self->func); 69 sdio_claim_host(self->func);
70} 70}
71 71
72static void cw1200_sdio_unlock(struct sbus_priv *self) 72static void cw1200_sdio_unlock(struct hwbus_priv *self)
73{ 73{
74 sdio_release_host(self->func); 74 sdio_release_host(self->func);
75} 75}
76 76
77static void cw1200_sdio_irq_handler(struct sdio_func *func) 77static void cw1200_sdio_irq_handler(struct sdio_func *func)
78{ 78{
79 struct sbus_priv *self = sdio_get_drvdata(func); 79 struct hwbus_priv *self = sdio_get_drvdata(func);
80 80
81 /* note: sdio_host already claimed here. */ 81 /* note: sdio_host already claimed here. */
82 if (self->core) 82 if (self->core)
@@ -90,7 +90,7 @@ static irqreturn_t cw1200_gpio_hardirq(int irq, void *dev_id)
90 90
91static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id) 91static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
92{ 92{
93 struct sbus_priv *self = dev_id; 93 struct hwbus_priv *self = dev_id;
94 94
95 if (self->core) { 95 if (self->core) {
96 sdio_claim_host(self->func); 96 sdio_claim_host(self->func);
@@ -102,7 +102,7 @@ static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
102 } 102 }
103} 103}
104 104
105static int cw1200_request_irq(struct sbus_priv *self) 105static int cw1200_request_irq(struct hwbus_priv *self)
106{ 106{
107 int ret; 107 int ret;
108 const struct resource *irq = self->pdata->irq; 108 const struct resource *irq = self->pdata->irq;
@@ -140,7 +140,7 @@ err:
140 return ret; 140 return ret;
141} 141}
142 142
143static int cw1200_sdio_irq_subscribe(struct sbus_priv *self) 143static int cw1200_sdio_irq_subscribe(struct hwbus_priv *self)
144{ 144{
145 int ret = 0; 145 int ret = 0;
146 146
@@ -155,7 +155,7 @@ static int cw1200_sdio_irq_subscribe(struct sbus_priv *self)
155 return ret; 155 return ret;
156} 156}
157 157
158static int cw1200_sdio_irq_unsubscribe(struct sbus_priv *self) 158static int cw1200_sdio_irq_unsubscribe(struct hwbus_priv *self)
159{ 159{
160 int ret = 0; 160 int ret = 0;
161 161
@@ -237,7 +237,7 @@ static int cw1200_sdio_on(const struct cw1200_platform_data_sdio *pdata)
237 return 0; 237 return 0;
238} 238}
239 239
240static size_t cw1200_sdio_align_size(struct sbus_priv *self, size_t size) 240static size_t cw1200_sdio_align_size(struct hwbus_priv *self, size_t size)
241{ 241{
242 if (self->pdata->no_nptb) 242 if (self->pdata->no_nptb)
243 size = round_up(size, SDIO_BLOCK_SIZE); 243 size = round_up(size, SDIO_BLOCK_SIZE);
@@ -247,7 +247,7 @@ static size_t cw1200_sdio_align_size(struct sbus_priv *self, size_t size)
247 return size; 247 return size;
248} 248}
249 249
250static int cw1200_sdio_pm(struct sbus_priv *self, bool suspend) 250static int cw1200_sdio_pm(struct hwbus_priv *self, bool suspend)
251{ 251{
252 int ret = 0; 252 int ret = 0;
253 253
@@ -256,9 +256,9 @@ static int cw1200_sdio_pm(struct sbus_priv *self, bool suspend)
256 return ret; 256 return ret;
257} 257}
258 258
259static struct sbus_ops cw1200_sdio_sbus_ops = { 259static struct hwbus_ops cw1200_sdio_hwbus_ops = {
260 .sbus_memcpy_fromio = cw1200_sdio_memcpy_fromio, 260 .hwbus_memcpy_fromio = cw1200_sdio_memcpy_fromio,
261 .sbus_memcpy_toio = cw1200_sdio_memcpy_toio, 261 .hwbus_memcpy_toio = cw1200_sdio_memcpy_toio,
262 .lock = cw1200_sdio_lock, 262 .lock = cw1200_sdio_lock,
263 .unlock = cw1200_sdio_unlock, 263 .unlock = cw1200_sdio_unlock,
264 .align_size = cw1200_sdio_align_size, 264 .align_size = cw1200_sdio_align_size,
@@ -269,7 +269,7 @@ static struct sbus_ops cw1200_sdio_sbus_ops = {
269static int cw1200_sdio_probe(struct sdio_func *func, 269static int cw1200_sdio_probe(struct sdio_func *func,
270 const struct sdio_device_id *id) 270 const struct sdio_device_id *id)
271{ 271{
272 struct sbus_priv *self; 272 struct hwbus_priv *self;
273 int status; 273 int status;
274 274
275 pr_info("cw1200_wlan_sdio: Probe called\n"); 275 pr_info("cw1200_wlan_sdio: Probe called\n");
@@ -280,7 +280,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,
280 280
281 self = kzalloc(sizeof(*self), GFP_KERNEL); 281 self = kzalloc(sizeof(*self), GFP_KERNEL);
282 if (!self) { 282 if (!self) {
283 pr_err("Can't allocate SDIO sbus_priv.\n"); 283 pr_err("Can't allocate SDIO hwbus_priv.\n");
284 return -ENOMEM; 284 return -ENOMEM;
285 } 285 }
286 286
@@ -295,7 +295,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,
295 295
296 status = cw1200_sdio_irq_subscribe(self); 296 status = cw1200_sdio_irq_subscribe(self);
297 297
298 status = cw1200_core_probe(&cw1200_sdio_sbus_ops, 298 status = cw1200_core_probe(&cw1200_sdio_hwbus_ops,
299 self, &func->dev, &self->core, 299 self, &func->dev, &self->core,
300 self->pdata->ref_clk, 300 self->pdata->ref_clk,
301 self->pdata->macaddr, 301 self->pdata->macaddr,
@@ -317,7 +317,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,
317 * device is disconnected */ 317 * device is disconnected */
318static void cw1200_sdio_disconnect(struct sdio_func *func) 318static void cw1200_sdio_disconnect(struct sdio_func *func)
319{ 319{
320 struct sbus_priv *self = sdio_get_drvdata(func); 320 struct hwbus_priv *self = sdio_get_drvdata(func);
321 321
322 if (self) { 322 if (self) {
323 cw1200_sdio_irq_unsubscribe(self); 323 cw1200_sdio_irq_unsubscribe(self);
@@ -338,7 +338,7 @@ static int cw1200_sdio_suspend(struct device *dev)
338{ 338{
339 int ret; 339 int ret;
340 struct sdio_func *func = dev_to_sdio_func(dev); 340 struct sdio_func *func = dev_to_sdio_func(dev);
341 struct sbus_priv *self = sdio_get_drvdata(func); 341 struct hwbus_priv *self = sdio_get_drvdata(func);
342 342
343 if (!cw1200_can_suspend(self->core)) 343 if (!cw1200_can_suspend(self->core))
344 return -EAGAIN; 344 return -EAGAIN;
diff --git a/drivers/net/wireless/cw1200/cw1200_spi.c b/drivers/net/wireless/cw1200/cw1200_spi.c
index 75adef0c0cfd..75efe54e495f 100644
--- a/drivers/net/wireless/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/cw1200/cw1200_spi.c
@@ -24,7 +24,7 @@
24#include <linux/device.h> 24#include <linux/device.h>
25 25
26#include "cw1200.h" 26#include "cw1200.h"
27#include "sbus.h" 27#include "hwbus.h"
28#include <linux/cw1200_platform.h> 28#include <linux/cw1200_platform.h>
29#include "hwio.h" 29#include "hwio.h"
30 30
@@ -35,7 +35,7 @@ MODULE_ALIAS("spi:cw1200_wlan_spi");
35 35
36/* #define SPI_DEBUG */ 36/* #define SPI_DEBUG */
37 37
38struct sbus_priv { 38struct hwbus_priv {
39 struct spi_device *func; 39 struct spi_device *func;
40 struct cw1200_common *core; 40 struct cw1200_common *core;
41 const struct cw1200_platform_data_spi *pdata; 41 const struct cw1200_platform_data_spi *pdata;
@@ -58,7 +58,7 @@ struct sbus_priv {
58 58
59*/ 59*/
60 60
61static int cw1200_spi_memcpy_fromio(struct sbus_priv *self, 61static int cw1200_spi_memcpy_fromio(struct hwbus_priv *self,
62 unsigned int addr, 62 unsigned int addr,
63 void *dst, int count) 63 void *dst, int count)
64{ 64{
@@ -119,7 +119,7 @@ static int cw1200_spi_memcpy_fromio(struct sbus_priv *self,
119 return ret; 119 return ret;
120} 120}
121 121
122static int cw1200_spi_memcpy_toio(struct sbus_priv *self, 122static int cw1200_spi_memcpy_toio(struct hwbus_priv *self,
123 unsigned int addr, 123 unsigned int addr,
124 const void *src, int count) 124 const void *src, int count)
125{ 125{
@@ -187,7 +187,7 @@ static int cw1200_spi_memcpy_toio(struct sbus_priv *self,
187 return rval; 187 return rval;
188} 188}
189 189
190static void cw1200_spi_lock(struct sbus_priv *self) 190static void cw1200_spi_lock(struct hwbus_priv *self)
191{ 191{
192 unsigned long flags; 192 unsigned long flags;
193 193
@@ -209,7 +209,7 @@ static void cw1200_spi_lock(struct sbus_priv *self)
209 return; 209 return;
210} 210}
211 211
212static void cw1200_spi_unlock(struct sbus_priv *self) 212static void cw1200_spi_unlock(struct hwbus_priv *self)
213{ 213{
214 unsigned long flags; 214 unsigned long flags;
215 215
@@ -221,7 +221,7 @@ static void cw1200_spi_unlock(struct sbus_priv *self)
221 221
222static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id) 222static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id)
223{ 223{
224 struct sbus_priv *self = dev_id; 224 struct hwbus_priv *self = dev_id;
225 225
226 if (self->core) { 226 if (self->core) {
227 cw1200_irq_handler(self->core); 227 cw1200_irq_handler(self->core);
@@ -231,7 +231,7 @@ static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id)
231 } 231 }
232} 232}
233 233
234static int cw1200_spi_irq_subscribe(struct sbus_priv *self) 234static int cw1200_spi_irq_subscribe(struct hwbus_priv *self)
235{ 235{
236 int ret; 236 int ret;
237 237
@@ -255,7 +255,7 @@ exit:
255 return ret; 255 return ret;
256} 256}
257 257
258static int cw1200_spi_irq_unsubscribe(struct sbus_priv *self) 258static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self)
259{ 259{
260 int ret = 0; 260 int ret = 0;
261 261
@@ -331,19 +331,19 @@ static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata)
331 return 0; 331 return 0;
332} 332}
333 333
334static size_t cw1200_spi_align_size(struct sbus_priv *self, size_t size) 334static size_t cw1200_spi_align_size(struct hwbus_priv *self, size_t size)
335{ 335{
336 return size & 1 ? size + 1 : size; 336 return size & 1 ? size + 1 : size;
337} 337}
338 338
339static int cw1200_spi_pm(struct sbus_priv *self, bool suspend) 339static int cw1200_spi_pm(struct hwbus_priv *self, bool suspend)
340{ 340{
341 return irq_set_irq_wake(self->func->irq, suspend); 341 return irq_set_irq_wake(self->func->irq, suspend);
342} 342}
343 343
344static struct sbus_ops cw1200_spi_sbus_ops = { 344static struct hwbus_ops cw1200_spi_hwbus_ops = {
345 .sbus_memcpy_fromio = cw1200_spi_memcpy_fromio, 345 .hwbus_memcpy_fromio = cw1200_spi_memcpy_fromio,
346 .sbus_memcpy_toio = cw1200_spi_memcpy_toio, 346 .hwbus_memcpy_toio = cw1200_spi_memcpy_toio,
347 .lock = cw1200_spi_lock, 347 .lock = cw1200_spi_lock,
348 .unlock = cw1200_spi_unlock, 348 .unlock = cw1200_spi_unlock,
349 .align_size = cw1200_spi_align_size, 349 .align_size = cw1200_spi_align_size,
@@ -355,7 +355,7 @@ static int cw1200_spi_probe(struct spi_device *func)
355{ 355{
356 const struct cw1200_platform_data_spi *plat_data = 356 const struct cw1200_platform_data_spi *plat_data =
357 func->dev.platform_data; 357 func->dev.platform_data;
358 struct sbus_priv *self; 358 struct hwbus_priv *self;
359 int status; 359 int status;
360 360
361 /* Sanity check speed */ 361 /* Sanity check speed */
@@ -389,7 +389,7 @@ static int cw1200_spi_probe(struct spi_device *func)
389 389
390 self = kzalloc(sizeof(*self), GFP_KERNEL); 390 self = kzalloc(sizeof(*self), GFP_KERNEL);
391 if (!self) { 391 if (!self) {
392 pr_err("Can't allocate SPI sbus_priv."); 392 pr_err("Can't allocate SPI hwbus_priv.");
393 return -ENOMEM; 393 return -ENOMEM;
394 } 394 }
395 395
@@ -401,7 +401,7 @@ static int cw1200_spi_probe(struct spi_device *func)
401 401
402 status = cw1200_spi_irq_subscribe(self); 402 status = cw1200_spi_irq_subscribe(self);
403 403
404 status = cw1200_core_probe(&cw1200_spi_sbus_ops, 404 status = cw1200_core_probe(&cw1200_spi_hwbus_ops,
405 self, &func->dev, &self->core, 405 self, &func->dev, &self->core,
406 self->pdata->ref_clk, 406 self->pdata->ref_clk,
407 self->pdata->macaddr, 407 self->pdata->macaddr,
@@ -420,7 +420,7 @@ static int cw1200_spi_probe(struct spi_device *func)
420/* Disconnect Function to be called by SPI stack when device is disconnected */ 420/* Disconnect Function to be called by SPI stack when device is disconnected */
421static int cw1200_spi_disconnect(struct spi_device *func) 421static int cw1200_spi_disconnect(struct spi_device *func)
422{ 422{
423 struct sbus_priv *self = spi_get_drvdata(func); 423 struct hwbus_priv *self = spi_get_drvdata(func);
424 424
425 if (self) { 425 if (self) {
426 cw1200_spi_irq_unsubscribe(self); 426 cw1200_spi_irq_unsubscribe(self);
@@ -438,7 +438,7 @@ static int cw1200_spi_disconnect(struct spi_device *func)
438#ifdef CONFIG_PM 438#ifdef CONFIG_PM
439static int cw1200_spi_suspend(struct device *dev, pm_message_t state) 439static int cw1200_spi_suspend(struct device *dev, pm_message_t state)
440{ 440{
441 struct sbus_priv *self = spi_get_drvdata(to_spi_device(dev)); 441 struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev));
442 442
443 if (!cw1200_can_suspend(self->core)) 443 if (!cw1200_can_suspend(self->core))
444 return -EAGAIN; 444 return -EAGAIN;
diff --git a/drivers/net/wireless/cw1200/fwio.c b/drivers/net/wireless/cw1200/fwio.c
index ad01cd2a59ec..427c9f24b94e 100644
--- a/drivers/net/wireless/cw1200/fwio.c
+++ b/drivers/net/wireless/cw1200/fwio.c
@@ -22,7 +22,7 @@
22#include "cw1200.h" 22#include "cw1200.h"
23#include "fwio.h" 23#include "fwio.h"
24#include "hwio.h" 24#include "hwio.h"
25#include "sbus.h" 25#include "hwbus.h"
26#include "bh.h" 26#include "bh.h"
27 27
28static int cw1200_get_hw_type(u32 config_reg_val, int *major_revision) 28static int cw1200_get_hw_type(u32 config_reg_val, int *major_revision)
@@ -489,9 +489,9 @@ int cw1200_load_firmware(struct cw1200_common *priv)
489 } 489 }
490 490
491 /* Enable interrupt signalling */ 491 /* Enable interrupt signalling */
492 priv->sbus_ops->lock(priv->sbus_priv); 492 priv->hwbus_ops->lock(priv->hwbus_priv);
493 ret = __cw1200_irq_enable(priv, 1); 493 ret = __cw1200_irq_enable(priv, 1);
494 priv->sbus_ops->unlock(priv->sbus_priv); 494 priv->hwbus_ops->unlock(priv->hwbus_priv);
495 if (ret < 0) 495 if (ret < 0)
496 goto unsubscribe; 496 goto unsubscribe;
497 497
@@ -518,8 +518,8 @@ out:
518 518
519unsubscribe: 519unsubscribe:
520 /* Disable interrupt signalling */ 520 /* Disable interrupt signalling */
521 priv->sbus_ops->lock(priv->sbus_priv); 521 priv->hwbus_ops->lock(priv->hwbus_priv);
522 ret = __cw1200_irq_enable(priv, 0); 522 ret = __cw1200_irq_enable(priv, 0);
523 priv->sbus_ops->unlock(priv->sbus_priv); 523 priv->hwbus_ops->unlock(priv->hwbus_priv);
524 return ret; 524 return ret;
525} 525}
diff --git a/drivers/net/wireless/cw1200/hwbus.h b/drivers/net/wireless/cw1200/hwbus.h
new file mode 100644
index 000000000000..8b2fc831c3de
--- /dev/null
+++ b/drivers/net/wireless/cw1200/hwbus.h
@@ -0,0 +1,33 @@
1/*
2 * Common hwbus abstraction layer interface for cw1200 wireless driver
3 *
4 * Copyright (c) 2010, ST-Ericsson
5 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef CW1200_HWBUS_H
13#define CW1200_HWBUS_H
14
15struct hwbus_priv;
16
17void cw1200_irq_handler(struct cw1200_common *priv);
18
19/* This MUST be wrapped with hwbus_ops->lock/unlock! */
20int __cw1200_irq_enable(struct cw1200_common *priv, int enable);
21
22struct hwbus_ops {
23 int (*hwbus_memcpy_fromio)(struct hwbus_priv *self, unsigned int addr,
24 void *dst, int count);
25 int (*hwbus_memcpy_toio)(struct hwbus_priv *self, unsigned int addr,
26 const void *src, int count);
27 void (*lock)(struct hwbus_priv *self);
28 void (*unlock)(struct hwbus_priv *self);
29 size_t (*align_size)(struct hwbus_priv *self, size_t size);
30 int (*power_mgmt)(struct hwbus_priv *self, bool suspend);
31};
32
33#endif /* CW1200_HWBUS_H */
diff --git a/drivers/net/wireless/cw1200/hwio.c b/drivers/net/wireless/cw1200/hwio.c
index 1af7b3d421b2..142f45efa204 100644
--- a/drivers/net/wireless/cw1200/hwio.c
+++ b/drivers/net/wireless/cw1200/hwio.c
@@ -18,7 +18,7 @@
18 18
19#include "cw1200.h" 19#include "cw1200.h"
20#include "hwio.h" 20#include "hwio.h"
21#include "sbus.h" 21#include "hwbus.h"
22 22
23 /* Sdio addr is 4*spi_addr */ 23 /* Sdio addr is 4*spi_addr */
24#define SPI_REG_ADDR_TO_SDIO(spi_reg_addr) ((spi_reg_addr) << 2) 24#define SPI_REG_ADDR_TO_SDIO(spi_reg_addr) ((spi_reg_addr) << 2)
@@ -46,7 +46,7 @@ static int __cw1200_reg_read(struct cw1200_common *priv, u16 addr,
46 addr_sdio = SPI_REG_ADDR_TO_SDIO(addr); 46 addr_sdio = SPI_REG_ADDR_TO_SDIO(addr);
47 sdio_reg_addr_17bit = SDIO_ADDR17BIT(buf_id, 0, 0, addr_sdio); 47 sdio_reg_addr_17bit = SDIO_ADDR17BIT(buf_id, 0, 0, addr_sdio);
48 48
49 return priv->sbus_ops->sbus_memcpy_fromio(priv->sbus_priv, 49 return priv->hwbus_ops->hwbus_memcpy_fromio(priv->hwbus_priv,
50 sdio_reg_addr_17bit, 50 sdio_reg_addr_17bit,
51 buf, buf_len); 51 buf, buf_len);
52} 52}
@@ -61,7 +61,7 @@ static int __cw1200_reg_write(struct cw1200_common *priv, u16 addr,
61 addr_sdio = SPI_REG_ADDR_TO_SDIO(addr); 61 addr_sdio = SPI_REG_ADDR_TO_SDIO(addr);
62 sdio_reg_addr_17bit = SDIO_ADDR17BIT(buf_id, 0, 0, addr_sdio); 62 sdio_reg_addr_17bit = SDIO_ADDR17BIT(buf_id, 0, 0, addr_sdio);
63 63
64 return priv->sbus_ops->sbus_memcpy_toio(priv->sbus_priv, 64 return priv->hwbus_ops->hwbus_memcpy_toio(priv->hwbus_priv,
65 sdio_reg_addr_17bit, 65 sdio_reg_addr_17bit,
66 buf, buf_len); 66 buf, buf_len);
67} 67}
@@ -100,9 +100,9 @@ int cw1200_reg_read(struct cw1200_common *priv, u16 addr, void *buf,
100 size_t buf_len) 100 size_t buf_len)
101{ 101{
102 int ret; 102 int ret;
103 priv->sbus_ops->lock(priv->sbus_priv); 103 priv->hwbus_ops->lock(priv->hwbus_priv);
104 ret = __cw1200_reg_read(priv, addr, buf, buf_len, 0); 104 ret = __cw1200_reg_read(priv, addr, buf, buf_len, 0);
105 priv->sbus_ops->unlock(priv->sbus_priv); 105 priv->hwbus_ops->unlock(priv->hwbus_priv);
106 return ret; 106 return ret;
107} 107}
108 108
@@ -110,9 +110,9 @@ int cw1200_reg_write(struct cw1200_common *priv, u16 addr, const void *buf,
110 size_t buf_len) 110 size_t buf_len)
111{ 111{
112 int ret; 112 int ret;
113 priv->sbus_ops->lock(priv->sbus_priv); 113 priv->hwbus_ops->lock(priv->hwbus_priv);
114 ret = __cw1200_reg_write(priv, addr, buf, buf_len, 0); 114 ret = __cw1200_reg_write(priv, addr, buf, buf_len, 0);
115 priv->sbus_ops->unlock(priv->sbus_priv); 115 priv->hwbus_ops->unlock(priv->hwbus_priv);
116 return ret; 116 return ret;
117} 117}
118 118
@@ -121,7 +121,7 @@ int cw1200_data_read(struct cw1200_common *priv, void *buf, size_t buf_len)
121 int ret, retry = 1; 121 int ret, retry = 1;
122 int buf_id_rx = priv->buf_id_rx; 122 int buf_id_rx = priv->buf_id_rx;
123 123
124 priv->sbus_ops->lock(priv->sbus_priv); 124 priv->hwbus_ops->lock(priv->hwbus_priv);
125 125
126 while (retry <= MAX_RETRY) { 126 while (retry <= MAX_RETRY) {
127 ret = __cw1200_reg_read(priv, 127 ret = __cw1200_reg_read(priv,
@@ -138,7 +138,7 @@ int cw1200_data_read(struct cw1200_common *priv, void *buf, size_t buf_len)
138 } 138 }
139 } 139 }
140 140
141 priv->sbus_ops->unlock(priv->sbus_priv); 141 priv->hwbus_ops->unlock(priv->hwbus_priv);
142 return ret; 142 return ret;
143} 143}
144 144
@@ -148,7 +148,7 @@ int cw1200_data_write(struct cw1200_common *priv, const void *buf,
148 int ret, retry = 1; 148 int ret, retry = 1;
149 int buf_id_tx = priv->buf_id_tx; 149 int buf_id_tx = priv->buf_id_tx;
150 150
151 priv->sbus_ops->lock(priv->sbus_priv); 151 priv->hwbus_ops->lock(priv->hwbus_priv);
152 152
153 while (retry <= MAX_RETRY) { 153 while (retry <= MAX_RETRY) {
154 ret = __cw1200_reg_write(priv, 154 ret = __cw1200_reg_write(priv,
@@ -165,7 +165,7 @@ int cw1200_data_write(struct cw1200_common *priv, const void *buf,
165 } 165 }
166 } 166 }
167 167
168 priv->sbus_ops->unlock(priv->sbus_priv); 168 priv->hwbus_ops->unlock(priv->hwbus_priv);
169 return ret; 169 return ret;
170} 170}
171 171
@@ -181,7 +181,7 @@ int cw1200_indirect_read(struct cw1200_common *priv, u32 addr, void *buf,
181 goto out; 181 goto out;
182 } 182 }
183 183
184 priv->sbus_ops->lock(priv->sbus_priv); 184 priv->hwbus_ops->lock(priv->hwbus_priv);
185 /* Write address */ 185 /* Write address */
186 ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr); 186 ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr);
187 if (ret < 0) { 187 if (ret < 0) {
@@ -230,7 +230,7 @@ int cw1200_indirect_read(struct cw1200_common *priv, u32 addr, void *buf,
230 } 230 }
231 231
232out: 232out:
233 priv->sbus_ops->unlock(priv->sbus_priv); 233 priv->hwbus_ops->unlock(priv->hwbus_priv);
234 return ret; 234 return ret;
235} 235}
236 236
@@ -244,7 +244,7 @@ int cw1200_apb_write(struct cw1200_common *priv, u32 addr, const void *buf,
244 return -EINVAL; 244 return -EINVAL;
245 } 245 }
246 246
247 priv->sbus_ops->lock(priv->sbus_priv); 247 priv->hwbus_ops->lock(priv->hwbus_priv);
248 248
249 /* Write address */ 249 /* Write address */
250 ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr); 250 ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr);
@@ -262,7 +262,7 @@ int cw1200_apb_write(struct cw1200_common *priv, u32 addr, const void *buf,
262 } 262 }
263 263
264out: 264out:
265 priv->sbus_ops->unlock(priv->sbus_priv); 265 priv->hwbus_ops->unlock(priv->hwbus_priv);
266 return ret; 266 return ret;
267} 267}
268 268
diff --git a/drivers/net/wireless/cw1200/main.c b/drivers/net/wireless/cw1200/main.c
index ef4b0b915f87..2ea1bada7207 100644
--- a/drivers/net/wireless/cw1200/main.c
+++ b/drivers/net/wireless/cw1200/main.c
@@ -31,7 +31,7 @@
31 31
32#include "cw1200.h" 32#include "cw1200.h"
33#include "txrx.h" 33#include "txrx.h"
34#include "sbus.h" 34#include "hwbus.h"
35#include "fwio.h" 35#include "fwio.h"
36#include "hwio.h" 36#include "hwio.h"
37#include "bh.h" 37#include "bh.h"
@@ -528,8 +528,8 @@ u32 cw1200_dpll_from_clk(u16 clk_khz)
528 } 528 }
529} 529}
530 530
531int cw1200_core_probe(const struct sbus_ops *sbus_ops, 531int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
532 struct sbus_priv *sbus, 532 struct hwbus_priv *hwbus,
533 struct device *pdev, 533 struct device *pdev,
534 struct cw1200_common **core, 534 struct cw1200_common **core,
535 int ref_clk, const u8 *macaddr, 535 int ref_clk, const u8 *macaddr,
@@ -556,8 +556,8 @@ int cw1200_core_probe(const struct sbus_ops *sbus_ops,
556 if (cw1200_sdd_path) 556 if (cw1200_sdd_path)
557 priv->sdd_path = cw1200_sdd_path; 557 priv->sdd_path = cw1200_sdd_path;
558 558
559 priv->sbus_ops = sbus_ops; 559 priv->hwbus_ops = hwbus_ops;
560 priv->sbus_priv = sbus; 560 priv->hwbus_priv = hwbus;
561 priv->pdev = pdev; 561 priv->pdev = pdev;
562 SET_IEEE80211_DEV(priv->hw, pdev); 562 SET_IEEE80211_DEV(priv->hw, pdev);
563 563
@@ -616,9 +616,9 @@ EXPORT_SYMBOL_GPL(cw1200_core_probe);
616void cw1200_core_release(struct cw1200_common *self) 616void cw1200_core_release(struct cw1200_common *self)
617{ 617{
618 /* Disable device interrupts */ 618 /* Disable device interrupts */
619 self->sbus_ops->lock(self->sbus_priv); 619 self->hwbus_ops->lock(self->hwbus_priv);
620 __cw1200_irq_enable(self, 0); 620 __cw1200_irq_enable(self, 0);
621 self->sbus_ops->unlock(self->sbus_priv); 621 self->hwbus_ops->unlock(self->hwbus_priv);
622 622
623 /* And then clean up */ 623 /* And then clean up */
624 cw1200_unregister_common(self->hw); 624 cw1200_unregister_common(self->hw);
diff --git a/drivers/net/wireless/cw1200/pm.c b/drivers/net/wireless/cw1200/pm.c
index 79edfb93b292..b37abb9f0453 100644
--- a/drivers/net/wireless/cw1200/pm.c
+++ b/drivers/net/wireless/cw1200/pm.c
@@ -15,7 +15,7 @@
15#include "pm.h" 15#include "pm.h"
16#include "sta.h" 16#include "sta.h"
17#include "bh.h" 17#include "bh.h"
18#include "sbus.h" 18#include "hwbus.h"
19 19
20#define CW1200_BEACON_SKIPPING_MULTIPLIER 3 20#define CW1200_BEACON_SKIPPING_MULTIPLIER 3
21 21
@@ -264,7 +264,7 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
264 pm_state->suspend_state = state; 264 pm_state->suspend_state = state;
265 265
266 /* Enable IRQ wake */ 266 /* Enable IRQ wake */
267 ret = priv->sbus_ops->power_mgmt(priv->sbus_priv, true); 267 ret = priv->hwbus_ops->power_mgmt(priv->hwbus_priv, true);
268 if (ret) { 268 if (ret) {
269 wiphy_err(priv->hw->wiphy, 269 wiphy_err(priv->hw->wiphy,
270 "PM request failed: %d. WoW is disabled.\n", ret); 270 "PM request failed: %d. WoW is disabled.\n", ret);
@@ -313,7 +313,7 @@ int cw1200_wow_resume(struct ieee80211_hw *hw)
313 pm_state->suspend_state = NULL; 313 pm_state->suspend_state = NULL;
314 314
315 /* Disable IRQ wake */ 315 /* Disable IRQ wake */
316 priv->sbus_ops->power_mgmt(priv->sbus_priv, false); 316 priv->hwbus_ops->power_mgmt(priv->hwbus_priv, false);
317 317
318 /* Scan.lock must be released before BH is resumed other way 318 /* Scan.lock must be released before BH is resumed other way
319 * in case when BSS_LOST command arrived the processing of the 319 * in case when BSS_LOST command arrived the processing of the
diff --git a/drivers/net/wireless/cw1200/sbus.h b/drivers/net/wireless/cw1200/sbus.h
deleted file mode 100644
index 603fd25eaa4a..000000000000
--- a/drivers/net/wireless/cw1200/sbus.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Common sbus abstraction layer interface for cw1200 wireless driver
3 *
4 * Copyright (c) 2010, ST-Ericsson
5 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef CW1200_SBUS_H
13#define CW1200_SBUS_H
14
15/*
16 * sbus priv forward definition.
17 * Implemented and instantiated in particular modules.
18 */
19struct sbus_priv;
20
21void cw1200_irq_handler(struct cw1200_common *priv);
22
23/* This MUST be wrapped with sbus_ops->lock/unlock! */
24int __cw1200_irq_enable(struct cw1200_common *priv, int enable);
25
26struct sbus_ops {
27 int (*sbus_memcpy_fromio)(struct sbus_priv *self, unsigned int addr,
28 void *dst, int count);
29 int (*sbus_memcpy_toio)(struct sbus_priv *self, unsigned int addr,
30 const void *src, int count);
31 void (*lock)(struct sbus_priv *self);
32 void (*unlock)(struct sbus_priv *self);
33 size_t (*align_size)(struct sbus_priv *self, size_t size);
34 int (*power_mgmt)(struct sbus_priv *self, bool suspend);
35};
36
37#endif /* CW1200_SBUS_H */