Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 911373cc authored by Solomon Peachy's avatar Solomon Peachy Committed by John W. Linville
Browse files

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: default avatarSolomon Peachy <pizza@shaftnet.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3e817f08
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@
#include "bh.h"
#include "bh.h"
#include "hwio.h"
#include "hwio.h"
#include "wsm.h"
#include "wsm.h"
#include "sbus.h"
#include "hwbus.h"
#include "debug.h"
#include "debug.h"
#include "fwio.h"
#include "fwio.h"


@@ -103,7 +103,7 @@ void cw1200_irq_handler(struct cw1200_common *priv)
	pr_debug("[BH] irq.\n");
	pr_debug("[BH] irq.\n");


	/* Disable Interrupts! */
	/* Disable Interrupts! */
	/* NOTE:  sbus_ops->lock already held */
	/* NOTE:  hwbus_ops->lock already held */
	__cw1200_irq_enable(priv, 0);
	__cw1200_irq_enable(priv, 0);


	if (/* WARN_ON */(priv->bh_error))
	if (/* WARN_ON */(priv->bh_error))
@@ -265,8 +265,8 @@ static int cw1200_bh_rx_helper(struct cw1200_common *priv,
	 * to the NEXT Message length + 2 Bytes for SKB */
	 * to the NEXT Message length + 2 Bytes for SKB */
	read_len = read_len + 2;
	read_len = read_len + 2;


	alloc_len = priv->sbus_ops->align_size(
	alloc_len = priv->hwbus_ops->align_size(
		priv->sbus_priv, read_len);
		priv->hwbus_priv, read_len);


	/* Check if not exceeding CW1200 capabilities */
	/* Check if not exceeding CW1200 capabilities */
	if (WARN_ON_ONCE(alloc_len > EFFECTIVE_BUF_SIZE)) {
	if (WARN_ON_ONCE(alloc_len > EFFECTIVE_BUF_SIZE)) {
@@ -384,8 +384,8 @@ static int cw1200_bh_tx_helper(struct cw1200_common *priv,


	atomic_add(1, &priv->bh_tx);
	atomic_add(1, &priv->bh_tx);


	tx_len = priv->sbus_ops->align_size(
	tx_len = priv->hwbus_ops->align_size(
		priv->sbus_priv, tx_len);
		priv->hwbus_priv, tx_len);


	/* Check if not exceeding CW1200 capabilities */
	/* Check if not exceeding CW1200 capabilities */
	if (WARN_ON_ONCE(tx_len > EFFECTIVE_BUF_SIZE))
	if (WARN_ON_ONCE(tx_len > EFFECTIVE_BUF_SIZE))
@@ -597,15 +597,15 @@ static int cw1200_bh(void *arg)


	done:
	done:
		/* Re-enable device interrupts */
		/* Re-enable device interrupts */
		priv->sbus_ops->lock(priv->sbus_priv);
		priv->hwbus_ops->lock(priv->hwbus_priv);
		__cw1200_irq_enable(priv, 1);
		__cw1200_irq_enable(priv, 1);
		priv->sbus_ops->unlock(priv->sbus_priv);
		priv->hwbus_ops->unlock(priv->hwbus_priv);
	}
	}


	/* Explicitly disable device interrupts */
	/* Explicitly disable device interrupts */
	priv->sbus_ops->lock(priv->sbus_priv);
	priv->hwbus_ops->lock(priv->hwbus_priv);
	__cw1200_irq_enable(priv, 0);
	__cw1200_irq_enable(priv, 0);
	priv->sbus_ops->unlock(priv->sbus_priv);
	priv->hwbus_ops->unlock(priv->hwbus_priv);


	if (!term) {
	if (!term) {
		pr_err("[BH] Fatal error, exiting.\n");
		pr_err("[BH] Fatal error, exiting.\n");
+5 −5
Original line number Original line Diff line number Diff line
@@ -30,7 +30,7 @@
#include "pm.h"
#include "pm.h"


/* Forward declarations */
/* Forward declarations */
struct sbus_ops;
struct hwbus_ops;
struct task_struct;
struct task_struct;
struct cw1200_debug_priv;
struct cw1200_debug_priv;
struct firmware;
struct firmware;
@@ -109,8 +109,8 @@ struct cw1200_common {
	u8 mac_addr[ETH_ALEN];
	u8 mac_addr[ETH_ALEN];


	/* Hardware interface */
	/* Hardware interface */
	const struct sbus_ops		*sbus_ops;
	const struct hwbus_ops		*hwbus_ops;
	struct sbus_priv		*sbus_priv;
	struct hwbus_priv		*hwbus_priv;


	/* Hardware information */
	/* Hardware information */
	enum {
	enum {
@@ -298,8 +298,8 @@ struct cw1200_sta_priv {
};
};


/* interfaces for the drivers */
/* interfaces for the drivers */
int cw1200_core_probe(const struct sbus_ops *sbus_ops,
int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
		      struct sbus_priv *sbus,
		      struct hwbus_priv *hwbus,
		      struct device *pdev,
		      struct device *pdev,
		      struct cw1200_common **pself,
		      struct cw1200_common **pself,
		      int ref_clk, const u8 *macaddr,
		      int ref_clk, const u8 *macaddr,
+22 −22
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@
#include <net/mac80211.h>
#include <net/mac80211.h>


#include "cw1200.h"
#include "cw1200.h"
#include "sbus.h"
#include "hwbus.h"
#include <linux/cw1200_platform.h>
#include <linux/cw1200_platform.h>
#include "hwio.h"
#include "hwio.h"


@@ -29,7 +29,7 @@ MODULE_LICENSE("GPL");


#define SDIO_BLOCK_SIZE (512)
#define SDIO_BLOCK_SIZE (512)


struct sbus_priv {
struct hwbus_priv {
	struct sdio_func	*func;
	struct sdio_func	*func;
	struct cw1200_common	*core;
	struct cw1200_common	*core;
	const struct cw1200_platform_data_sdio *pdata;
	const struct cw1200_platform_data_sdio *pdata;
@@ -48,35 +48,35 @@ static const struct sdio_device_id cw1200_sdio_ids[] = {
	{ /* end: all zeroes */			},
	{ /* end: all zeroes */			},
};
};


/* sbus_ops implemetation */
/* hwbus_ops implemetation */


static int cw1200_sdio_memcpy_fromio(struct sbus_priv *self,
static int cw1200_sdio_memcpy_fromio(struct hwbus_priv *self,
				     unsigned int addr,
				     unsigned int addr,
				     void *dst, int count)
				     void *dst, int count)
{
{
	return sdio_memcpy_fromio(self->func, dst, addr, count);
	return sdio_memcpy_fromio(self->func, dst, addr, count);
}
}


static int cw1200_sdio_memcpy_toio(struct sbus_priv *self,
static int cw1200_sdio_memcpy_toio(struct hwbus_priv *self,
				   unsigned int addr,
				   unsigned int addr,
				   const void *src, int count)
				   const void *src, int count)
{
{
	return sdio_memcpy_toio(self->func, addr, (void *)src, count);
	return sdio_memcpy_toio(self->func, addr, (void *)src, count);
}
}


static void cw1200_sdio_lock(struct sbus_priv *self)
static void cw1200_sdio_lock(struct hwbus_priv *self)
{
{
	sdio_claim_host(self->func);
	sdio_claim_host(self->func);
}
}


static void cw1200_sdio_unlock(struct sbus_priv *self)
static void cw1200_sdio_unlock(struct hwbus_priv *self)
{
{
	sdio_release_host(self->func);
	sdio_release_host(self->func);
}
}


static void cw1200_sdio_irq_handler(struct sdio_func *func)
static void cw1200_sdio_irq_handler(struct sdio_func *func)
{
{
	struct sbus_priv *self = sdio_get_drvdata(func);
	struct hwbus_priv *self = sdio_get_drvdata(func);


	/* note:  sdio_host already claimed here. */
	/* note:  sdio_host already claimed here. */
	if (self->core)
	if (self->core)
@@ -90,7 +90,7 @@ static irqreturn_t cw1200_gpio_hardirq(int irq, void *dev_id)


static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
{
{
	struct sbus_priv *self = dev_id;
	struct hwbus_priv *self = dev_id;


	if (self->core) {
	if (self->core) {
		sdio_claim_host(self->func);
		sdio_claim_host(self->func);
@@ -102,7 +102,7 @@ static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
	}
	}
}
}


static int cw1200_request_irq(struct sbus_priv *self)
static int cw1200_request_irq(struct hwbus_priv *self)
{
{
	int ret;
	int ret;
	const struct resource *irq = self->pdata->irq;
	const struct resource *irq = self->pdata->irq;
@@ -140,7 +140,7 @@ err:
	return ret;
	return ret;
}
}


static int cw1200_sdio_irq_subscribe(struct sbus_priv *self)
static int cw1200_sdio_irq_subscribe(struct hwbus_priv *self)
{
{
	int ret = 0;
	int ret = 0;


@@ -155,7 +155,7 @@ static int cw1200_sdio_irq_subscribe(struct sbus_priv *self)
	return ret;
	return ret;
}
}


static int cw1200_sdio_irq_unsubscribe(struct sbus_priv *self)
static int cw1200_sdio_irq_unsubscribe(struct hwbus_priv *self)
{
{
	int ret = 0;
	int ret = 0;


@@ -237,7 +237,7 @@ static int cw1200_sdio_on(const struct cw1200_platform_data_sdio *pdata)
	return 0;
	return 0;
}
}


static size_t cw1200_sdio_align_size(struct sbus_priv *self, size_t size)
static size_t cw1200_sdio_align_size(struct hwbus_priv *self, size_t size)
{
{
	if (self->pdata->no_nptb)
	if (self->pdata->no_nptb)
		size = round_up(size, SDIO_BLOCK_SIZE);
		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)
	return size;
	return size;
}
}


static int cw1200_sdio_pm(struct sbus_priv *self, bool suspend)
static int cw1200_sdio_pm(struct hwbus_priv *self, bool suspend)
{
{
	int ret = 0;
	int ret = 0;


@@ -256,9 +256,9 @@ static int cw1200_sdio_pm(struct sbus_priv *self, bool suspend)
	return ret;
	return ret;
}
}


static struct sbus_ops cw1200_sdio_sbus_ops = {
static struct hwbus_ops cw1200_sdio_hwbus_ops = {
	.sbus_memcpy_fromio	= cw1200_sdio_memcpy_fromio,
	.hwbus_memcpy_fromio	= cw1200_sdio_memcpy_fromio,
	.sbus_memcpy_toio	= cw1200_sdio_memcpy_toio,
	.hwbus_memcpy_toio	= cw1200_sdio_memcpy_toio,
	.lock			= cw1200_sdio_lock,
	.lock			= cw1200_sdio_lock,
	.unlock			= cw1200_sdio_unlock,
	.unlock			= cw1200_sdio_unlock,
	.align_size		= cw1200_sdio_align_size,
	.align_size		= cw1200_sdio_align_size,
@@ -269,7 +269,7 @@ static struct sbus_ops cw1200_sdio_sbus_ops = {
static int cw1200_sdio_probe(struct sdio_func *func,
static int cw1200_sdio_probe(struct sdio_func *func,
				       const struct sdio_device_id *id)
				       const struct sdio_device_id *id)
{
{
	struct sbus_priv *self;
	struct hwbus_priv *self;
	int status;
	int status;


	pr_info("cw1200_wlan_sdio: Probe called\n");
	pr_info("cw1200_wlan_sdio: Probe called\n");
@@ -280,7 +280,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,


	self = kzalloc(sizeof(*self), GFP_KERNEL);
	self = kzalloc(sizeof(*self), GFP_KERNEL);
	if (!self) {
	if (!self) {
		pr_err("Can't allocate SDIO sbus_priv.\n");
		pr_err("Can't allocate SDIO hwbus_priv.\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}


@@ -295,7 +295,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,


	status = cw1200_sdio_irq_subscribe(self);
	status = cw1200_sdio_irq_subscribe(self);


	status = cw1200_core_probe(&cw1200_sdio_sbus_ops,
	status = cw1200_core_probe(&cw1200_sdio_hwbus_ops,
				   self, &func->dev, &self->core,
				   self, &func->dev, &self->core,
				   self->pdata->ref_clk,
				   self->pdata->ref_clk,
				   self->pdata->macaddr,
				   self->pdata->macaddr,
@@ -317,7 +317,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,
 * device is disconnected */
 * device is disconnected */
static void cw1200_sdio_disconnect(struct sdio_func *func)
static void cw1200_sdio_disconnect(struct sdio_func *func)
{
{
	struct sbus_priv *self = sdio_get_drvdata(func);
	struct hwbus_priv *self = sdio_get_drvdata(func);


	if (self) {
	if (self) {
		cw1200_sdio_irq_unsubscribe(self);
		cw1200_sdio_irq_unsubscribe(self);
@@ -338,7 +338,7 @@ static int cw1200_sdio_suspend(struct device *dev)
{
{
	int ret;
	int ret;
	struct sdio_func *func = dev_to_sdio_func(dev);
	struct sdio_func *func = dev_to_sdio_func(dev);
	struct sbus_priv *self = sdio_get_drvdata(func);
	struct hwbus_priv *self = sdio_get_drvdata(func);


	if (!cw1200_can_suspend(self->core))
	if (!cw1200_can_suspend(self->core))
		return -EAGAIN;
		return -EAGAIN;
+19 −19
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@
#include <linux/device.h>
#include <linux/device.h>


#include "cw1200.h"
#include "cw1200.h"
#include "sbus.h"
#include "hwbus.h"
#include <linux/cw1200_platform.h>
#include <linux/cw1200_platform.h>
#include "hwio.h"
#include "hwio.h"


@@ -35,7 +35,7 @@ MODULE_ALIAS("spi:cw1200_wlan_spi");


/* #define SPI_DEBUG */
/* #define SPI_DEBUG */


struct sbus_priv {
struct hwbus_priv {
	struct spi_device	*func;
	struct spi_device	*func;
	struct cw1200_common	*core;
	struct cw1200_common	*core;
	const struct cw1200_platform_data_spi *pdata;
	const struct cw1200_platform_data_spi *pdata;
@@ -58,7 +58,7 @@ struct sbus_priv {


*/
*/


static int cw1200_spi_memcpy_fromio(struct sbus_priv *self,
static int cw1200_spi_memcpy_fromio(struct hwbus_priv *self,
				     unsigned int addr,
				     unsigned int addr,
				     void *dst, int count)
				     void *dst, int count)
{
{
@@ -119,7 +119,7 @@ static int cw1200_spi_memcpy_fromio(struct sbus_priv *self,
	return ret;
	return ret;
}
}


static int cw1200_spi_memcpy_toio(struct sbus_priv *self,
static int cw1200_spi_memcpy_toio(struct hwbus_priv *self,
				   unsigned int addr,
				   unsigned int addr,
				   const void *src, int count)
				   const void *src, int count)
{
{
@@ -187,7 +187,7 @@ static int cw1200_spi_memcpy_toio(struct sbus_priv *self,
	return rval;
	return rval;
}
}


static void cw1200_spi_lock(struct sbus_priv *self)
static void cw1200_spi_lock(struct hwbus_priv *self)
{
{
	unsigned long flags;
	unsigned long flags;


@@ -209,7 +209,7 @@ static void cw1200_spi_lock(struct sbus_priv *self)
	return;
	return;
}
}


static void cw1200_spi_unlock(struct sbus_priv *self)
static void cw1200_spi_unlock(struct hwbus_priv *self)
{
{
	unsigned long flags;
	unsigned long flags;


@@ -221,7 +221,7 @@ static void cw1200_spi_unlock(struct sbus_priv *self)


static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id)
static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id)
{
{
	struct sbus_priv *self = dev_id;
	struct hwbus_priv *self = dev_id;


	if (self->core) {
	if (self->core) {
		cw1200_irq_handler(self->core);
		cw1200_irq_handler(self->core);
@@ -231,7 +231,7 @@ static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id)
	}
	}
}
}


static int cw1200_spi_irq_subscribe(struct sbus_priv *self)
static int cw1200_spi_irq_subscribe(struct hwbus_priv *self)
{
{
	int ret;
	int ret;


@@ -255,7 +255,7 @@ exit:
	return ret;
	return ret;
}
}


static int cw1200_spi_irq_unsubscribe(struct sbus_priv *self)
static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self)
{
{
	int ret = 0;
	int ret = 0;


@@ -331,19 +331,19 @@ static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata)
	return 0;
	return 0;
}
}


static size_t cw1200_spi_align_size(struct sbus_priv *self, size_t size)
static size_t cw1200_spi_align_size(struct hwbus_priv *self, size_t size)
{
{
	return size & 1 ? size + 1 : size;
	return size & 1 ? size + 1 : size;
}
}


static int cw1200_spi_pm(struct sbus_priv *self, bool suspend)
static int cw1200_spi_pm(struct hwbus_priv *self, bool suspend)
{
{
	return irq_set_irq_wake(self->func->irq, suspend);
	return irq_set_irq_wake(self->func->irq, suspend);
}
}


static struct sbus_ops cw1200_spi_sbus_ops = {
static struct hwbus_ops cw1200_spi_hwbus_ops = {
	.sbus_memcpy_fromio	= cw1200_spi_memcpy_fromio,
	.hwbus_memcpy_fromio	= cw1200_spi_memcpy_fromio,
	.sbus_memcpy_toio	= cw1200_spi_memcpy_toio,
	.hwbus_memcpy_toio	= cw1200_spi_memcpy_toio,
	.lock			= cw1200_spi_lock,
	.lock			= cw1200_spi_lock,
	.unlock			= cw1200_spi_unlock,
	.unlock			= cw1200_spi_unlock,
	.align_size		= cw1200_spi_align_size,
	.align_size		= cw1200_spi_align_size,
@@ -355,7 +355,7 @@ static int cw1200_spi_probe(struct spi_device *func)
{
{
	const struct cw1200_platform_data_spi *plat_data =
	const struct cw1200_platform_data_spi *plat_data =
		func->dev.platform_data;
		func->dev.platform_data;
	struct sbus_priv *self;
	struct hwbus_priv *self;
	int status;
	int status;


	/* Sanity check speed */
	/* Sanity check speed */
@@ -389,7 +389,7 @@ static int cw1200_spi_probe(struct spi_device *func)


	self = kzalloc(sizeof(*self), GFP_KERNEL);
	self = kzalloc(sizeof(*self), GFP_KERNEL);
	if (!self) {
	if (!self) {
		pr_err("Can't allocate SPI sbus_priv.");
		pr_err("Can't allocate SPI hwbus_priv.");
		return -ENOMEM;
		return -ENOMEM;
	}
	}


@@ -401,7 +401,7 @@ static int cw1200_spi_probe(struct spi_device *func)


	status = cw1200_spi_irq_subscribe(self);
	status = cw1200_spi_irq_subscribe(self);


	status = cw1200_core_probe(&cw1200_spi_sbus_ops,
	status = cw1200_core_probe(&cw1200_spi_hwbus_ops,
				   self, &func->dev, &self->core,
				   self, &func->dev, &self->core,
				   self->pdata->ref_clk,
				   self->pdata->ref_clk,
				   self->pdata->macaddr,
				   self->pdata->macaddr,
@@ -420,7 +420,7 @@ static int cw1200_spi_probe(struct spi_device *func)
/* Disconnect Function to be called by SPI stack when device is disconnected */
/* Disconnect Function to be called by SPI stack when device is disconnected */
static int cw1200_spi_disconnect(struct spi_device *func)
static int cw1200_spi_disconnect(struct spi_device *func)
{
{
	struct sbus_priv *self = spi_get_drvdata(func);
	struct hwbus_priv *self = spi_get_drvdata(func);


	if (self) {
	if (self) {
		cw1200_spi_irq_unsubscribe(self);
		cw1200_spi_irq_unsubscribe(self);
@@ -438,7 +438,7 @@ static int cw1200_spi_disconnect(struct spi_device *func)
#ifdef CONFIG_PM
#ifdef CONFIG_PM
static int cw1200_spi_suspend(struct device *dev, pm_message_t state)
static int cw1200_spi_suspend(struct device *dev, pm_message_t state)
{
{
	struct sbus_priv *self = spi_get_drvdata(to_spi_device(dev));
	struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev));


	if (!cw1200_can_suspend(self->core))
	if (!cw1200_can_suspend(self->core))
		return -EAGAIN;
		return -EAGAIN;
+5 −5
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@
#include "cw1200.h"
#include "cw1200.h"
#include "fwio.h"
#include "fwio.h"
#include "hwio.h"
#include "hwio.h"
#include "sbus.h"
#include "hwbus.h"
#include "bh.h"
#include "bh.h"


static int cw1200_get_hw_type(u32 config_reg_val, int *major_revision)
static int cw1200_get_hw_type(u32 config_reg_val, int *major_revision)
@@ -489,9 +489,9 @@ int cw1200_load_firmware(struct cw1200_common *priv)
	}
	}


	/* Enable interrupt signalling */
	/* Enable interrupt signalling */
	priv->sbus_ops->lock(priv->sbus_priv);
	priv->hwbus_ops->lock(priv->hwbus_priv);
	ret = __cw1200_irq_enable(priv, 1);
	ret = __cw1200_irq_enable(priv, 1);
	priv->sbus_ops->unlock(priv->sbus_priv);
	priv->hwbus_ops->unlock(priv->hwbus_priv);
	if (ret < 0)
	if (ret < 0)
		goto unsubscribe;
		goto unsubscribe;


@@ -518,8 +518,8 @@ out:


unsubscribe:
unsubscribe:
	/* Disable interrupt signalling */
	/* Disable interrupt signalling */
	priv->sbus_ops->lock(priv->sbus_priv);
	priv->hwbus_ops->lock(priv->hwbus_priv);
	ret = __cw1200_irq_enable(priv, 0);
	ret = __cw1200_irq_enable(priv, 0);
	priv->sbus_ops->unlock(priv->sbus_priv);
	priv->hwbus_ops->unlock(priv->hwbus_priv);
	return ret;
	return ret;
}
}
Loading