aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/ath6kl/hif
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/ath6kl/hif')
-rw-r--r--drivers/staging/ath6kl/hif/common/hif_sdio_common.h4
-rw-r--r--drivers/staging/ath6kl/hif/sdio/linux_sdio/include/hif_internal.h48
-rw-r--r--drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c261
-rw-r--r--drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c70
4 files changed, 190 insertions, 193 deletions
diff --git a/drivers/staging/ath6kl/hif/common/hif_sdio_common.h b/drivers/staging/ath6kl/hif/common/hif_sdio_common.h
index 0f4e913..93a2adc 100644
--- a/drivers/staging/ath6kl/hif/common/hif_sdio_common.h
+++ b/drivers/staging/ath6kl/hif/common/hif_sdio_common.h
@@ -58,7 +58,7 @@
#define HIF_DEFAULT_IO_BLOCK_SIZE 128
/* set extended MBOX window information for SDIO interconnects */
-static INLINE void SetExtendedMboxWindowInfo(A_UINT16 Manfid, HIF_DEVICE_MBOX_INFO *pInfo)
+static INLINE void SetExtendedMboxWindowInfo(u16 Manfid, struct hif_device_mbox_info *pInfo)
{
switch (Manfid & MANUFACTURER_ID_AR6K_BASE_MASK) {
case MANUFACTURER_ID_AR6002_BASE :
@@ -74,7 +74,7 @@ static INLINE void SetExtendedMboxWindowInfo(A_UINT16 Manfid, HIF_DEVICE_MBOX_IN
pInfo->GMboxSize = HIF_GMBOX_WIDTH;
break;
default:
- A_ASSERT(FALSE);
+ A_ASSERT(false);
break;
}
}
diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/include/hif_internal.h b/drivers/staging/ath6kl/hif/sdio/linux_sdio/include/hif_internal.h
index 857f35f..6341560 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/include/hif_internal.h
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/include/hif_internal.h
@@ -47,19 +47,17 @@
#define HIF_MBOX2_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
#define HIF_MBOX3_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
-struct _HIF_SCATTER_REQ_PRIV;
-
typedef struct bus_request {
struct bus_request *next; /* link list of available requests */
struct bus_request *inusenext; /* link list of in use requests */
struct semaphore sem_req;
- A_UINT32 address; /* request data */
- A_UCHAR *buffer;
- A_UINT32 length;
- A_UINT32 request;
+ u32 address; /* request data */
+ u8 *buffer;
+ u32 length;
+ u32 request;
void *context;
- A_STATUS status;
- struct _HIF_SCATTER_REQ_PRIV *pScatterReq; /* this request is a scatter request */
+ int status;
+ struct hif_scatter_req_priv *pScatterReq; /* this request is a scatter request */
} BUS_REQUEST;
struct hif_device {
@@ -76,11 +74,11 @@ struct hif_device {
BUS_REQUEST busRequest[BUS_REQUEST_MAX_NUM]; /* available bus requests */
void *claimedContext;
HTC_CALLBACKS htcCallbacks;
- A_UINT8 *dma_buffer;
- DL_LIST ScatterReqHead; /* scatter request list head */
- A_BOOL scatter_enabled; /* scatter enabled flag */
- A_BOOL is_suspend;
- A_BOOL is_disabled;
+ u8 *dma_buffer;
+ struct dl_list ScatterReqHead; /* scatter request list head */
+ bool scatter_enabled; /* scatter enabled flag */
+ bool is_suspend;
+ bool is_disabled;
atomic_t irqHandling;
HIF_DEVICE_POWER_CHANGE_TYPE powerConfig;
const struct sdio_device_id *id;
@@ -90,9 +88,9 @@ struct hif_device {
#define CMD53_FIXED_ADDRESS 1
#define CMD53_INCR_ADDRESS 2
-BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device);
-void hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest);
-void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest);
+BUS_REQUEST *hifAllocateBusRequest(struct hif_device *device);
+void hifFreeBusRequest(struct hif_device *device, BUS_REQUEST *busrequest);
+void AddToAsyncList(struct hif_device *device, BUS_REQUEST *busrequest);
#ifdef HIF_LINUX_MMC_SCATTER_SUPPORT
@@ -100,28 +98,28 @@ void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest);
#define MAX_SCATTER_ENTRIES_PER_REQ 16
#define MAX_SCATTER_REQ_TRANSFER_SIZE 32*1024
-typedef struct _HIF_SCATTER_REQ_PRIV {
- HIF_SCATTER_REQ *pHifScatterReq; /* HIF scatter request with allocated entries */
- HIF_DEVICE *device; /* this device */
+struct hif_scatter_req_priv {
+ struct hif_scatter_req *pHifScatterReq; /* HIF scatter request with allocated entries */
+ struct hif_device *device; /* this device */
BUS_REQUEST *busrequest; /* request associated with request */
/* scatter list for linux */
struct scatterlist sgentries[MAX_SCATTER_ENTRIES_PER_REQ];
-} HIF_SCATTER_REQ_PRIV;
+};
#define ATH_DEBUG_SCATTER ATH_DEBUG_MAKE_MODULE_MASK(0)
-A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo);
-void CleanupHIFScatterResources(HIF_DEVICE *device);
-A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest);
+int SetupHIFScatterSupport(struct hif_device *device, struct hif_device_scatter_support_info *pInfo);
+void CleanupHIFScatterResources(struct hif_device *device);
+int DoHifReadWriteScatter(struct hif_device *device, BUS_REQUEST *busrequest);
#else // HIF_LINUX_MMC_SCATTER_SUPPORT
-static inline A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo)
+static inline int SetupHIFScatterSupport(struct hif_device *device, struct hif_device_scatter_support_info *pInfo)
{
return A_ENOTSUP;
}
-static inline A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
+static inline int DoHifReadWriteScatter(struct hif_device *device, BUS_REQUEST *busrequest)
{
return A_ENOTSUP;
}
diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
index e96662b..e6d9cd8 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
@@ -46,7 +46,7 @@
*/
#define BUFFER_NEEDS_BOUNCE(buffer) (((unsigned long)(buffer) & 0x3) || !virt_addr_valid((buffer)))
#else
-#define BUFFER_NEEDS_BOUNCE(buffer) (FALSE)
+#define BUFFER_NEEDS_BOUNCE(buffer) (false)
#endif
/* ATHENV */
@@ -58,16 +58,16 @@ static int hifDeviceResume(struct device *dev);
#endif /* CONFIG_PM */
static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id);
static void hifDeviceRemoved(struct sdio_func *func);
-static HIF_DEVICE *addHifDevice(struct sdio_func *func);
-static HIF_DEVICE *getHifDevice(struct sdio_func *func);
-static void delHifDevice(HIF_DEVICE * device);
+static struct hif_device *addHifDevice(struct sdio_func *func);
+static struct hif_device *getHifDevice(struct sdio_func *func);
+static void delHifDevice(struct hif_device * device);
static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte);
static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsigned char *byte);
int reset_sdio_on_unload = 0;
module_param(reset_sdio_on_unload, int, 0644);
-extern A_UINT32 nohifscattersupport;
+extern u32 nohifscattersupport;
/* ------ Static Variables ------ */
@@ -102,13 +102,13 @@ static struct dev_pm_ops ar6k_device_pm_ops = {
static int registered = 0;
OSDRV_CALLBACKS osdrvCallbacks;
-extern A_UINT32 onebitmode;
-extern A_UINT32 busspeedlow;
-extern A_UINT32 debughif;
+extern u32 onebitmode;
+extern u32 busspeedlow;
+extern u32 debughif;
static void ResetAllCards(void);
-static A_STATUS hifDisableFunc(HIF_DEVICE *device, struct sdio_func *func);
-static A_STATUS hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func);
+static int hifDisableFunc(struct hif_device *device, struct sdio_func *func);
+static int hifEnableFunc(struct hif_device *device, struct sdio_func *func);
#ifdef DEBUG
@@ -123,7 +123,7 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(hif,
/* ------ Functions ------ */
-A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks)
+int HIFInit(OSDRV_CALLBACKS *callbacks)
{
int status;
AR_DEBUG_ASSERT(callbacks != NULL);
@@ -148,23 +148,23 @@ A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks)
return A_ERROR;
}
- return A_OK;
+ return 0;
}
-static A_STATUS
-__HIFReadWrite(HIF_DEVICE *device,
- A_UINT32 address,
- A_UCHAR *buffer,
- A_UINT32 length,
- A_UINT32 request,
+static int
+__HIFReadWrite(struct hif_device *device,
+ u32 address,
+ u8 *buffer,
+ u32 length,
+ u32 request,
void *context)
{
- A_UINT8 opcode;
- A_STATUS status = A_OK;
+ u8 opcode;
+ int status = 0;
int ret;
- A_UINT8 *tbuffer;
- A_BOOL bounced = FALSE;
+ u8 *tbuffer;
+ bool bounced = false;
AR_DEBUG_ASSERT(device != NULL);
AR_DEBUG_ASSERT(device->func != NULL);
@@ -243,7 +243,7 @@ __HIFReadWrite(HIF_DEVICE *device,
/* copy the write data to the dma buffer */
AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE);
memcpy(tbuffer, buffer, length);
- bounced = TRUE;
+ bounced = true;
} else {
tbuffer = buffer;
}
@@ -265,7 +265,7 @@ __HIFReadWrite(HIF_DEVICE *device,
AR_DEBUG_ASSERT(device->dma_buffer != NULL);
AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE);
tbuffer = device->dma_buffer;
- bounced = TRUE;
+ bounced = true;
} else {
tbuffer = buffer;
}
@@ -299,12 +299,12 @@ __HIFReadWrite(HIF_DEVICE *device,
("AR6000: SDIO bus operation failed! MMC stack returned : %d \n", ret));
status = A_ERROR;
}
- } while (FALSE);
+ } while (false);
return status;
}
-void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest)
+void AddToAsyncList(struct hif_device *device, BUS_REQUEST *busrequest)
{
unsigned long flags;
BUS_REQUEST *async;
@@ -329,15 +329,15 @@ void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest)
/* queue a read/write request */
-A_STATUS
-HIFReadWrite(HIF_DEVICE *device,
- A_UINT32 address,
- A_UCHAR *buffer,
- A_UINT32 length,
- A_UINT32 request,
+int
+HIFReadWrite(struct hif_device *device,
+ u32 address,
+ u8 *buffer,
+ u32 length,
+ u32 request,
void *context)
{
- A_STATUS status = A_OK;
+ int status = 0;
BUS_REQUEST *busrequest;
@@ -375,7 +375,7 @@ HIFReadWrite(HIF_DEVICE *device,
/* interrupted, exit */
return A_ERROR;
} else {
- A_STATUS status = busrequest->status;
+ int status = busrequest->status;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: sync return freeing 0x%lX: 0x%X\n",
(unsigned long)busrequest, busrequest->status));
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: freeing req: 0x%X\n", (unsigned int)request));
@@ -400,12 +400,12 @@ HIFReadWrite(HIF_DEVICE *device,
/* thread to serialize all requests, both sync and async */
static int async_task(void *param)
{
- HIF_DEVICE *device;
+ struct hif_device *device;
BUS_REQUEST *request;
- A_STATUS status;
+ int status;
unsigned long flags;
- device = (HIF_DEVICE *)param;
+ device = (struct hif_device *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async task\n"));
set_current_state(TASK_INTERRUPTIBLE);
while(!device->async_shutdown) {
@@ -465,10 +465,10 @@ static int async_task(void *param)
return 0;
}
-static A_INT32 IssueSDCommand(HIF_DEVICE *device, A_UINT32 opcode, A_UINT32 arg, A_UINT32 flags, A_UINT32 *resp)
+static s32 IssueSDCommand(struct hif_device *device, u32 opcode, u32 arg, u32 flags, u32 *resp)
{
struct mmc_command cmd;
- A_INT32 err;
+ s32 err;
struct mmc_host *host;
struct sdio_func *func;
@@ -488,14 +488,14 @@ static A_INT32 IssueSDCommand(HIF_DEVICE *device, A_UINT32 opcode, A_UINT32 arg,
return err;
}
-A_STATUS ReinitSDIO(HIF_DEVICE *device)
+int ReinitSDIO(struct hif_device *device)
{
- A_INT32 err;
+ s32 err;
struct mmc_host *host;
struct mmc_card *card;
struct sdio_func *func;
- A_UINT8 cmd52_resp;
- A_UINT32 clock;
+ u8 cmd52_resp;
+ u32 clock;
func = device->func;
card = func->card;
@@ -506,9 +506,9 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device)
do {
if (!device->is_suspend) {
- A_UINT32 resp;
- A_UINT16 rca;
- A_UINT32 i;
+ u32 resp;
+ u16 rca;
+ u32 i;
int bit = fls(host->ocr_avail) - 1;
/* emulate the mmc_power_up(...) */
host->ios.vdd = bit;
@@ -644,13 +644,13 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device)
sdio_release_host(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -ReinitSDIO \n"));
- return (err) ? A_ERROR : A_OK;
+ return (err) ? A_ERROR : 0;
}
-A_STATUS
-PowerStateChangeNotify(HIF_DEVICE *device, HIF_DEVICE_POWER_CHANGE_TYPE config)
+int
+PowerStateChangeNotify(struct hif_device *device, HIF_DEVICE_POWER_CHANGE_TYPE config)
{
- A_STATUS status = A_OK;
+ int status = 0;
#if defined(CONFIG_PM)
struct sdio_func *func = device->func;
int old_reset_val;
@@ -678,7 +678,7 @@ PowerStateChangeNotify(HIF_DEVICE *device, HIF_DEVICE_POWER_CHANGE_TYPE config)
if (device->powerConfig == HIF_DEVICE_POWER_CUT) {
status = ReinitSDIO(device);
}
- if (status == A_OK) {
+ if (status == 0) {
status = hifEnableFunc(device, func);
}
break;
@@ -690,29 +690,29 @@ PowerStateChangeNotify(HIF_DEVICE *device, HIF_DEVICE_POWER_CHANGE_TYPE config)
return status;
}
-A_STATUS
-HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode,
- void *config, A_UINT32 configLen)
+int
+HIFConfigureDevice(struct hif_device *device, HIF_DEVICE_CONFIG_OPCODE opcode,
+ void *config, u32 configLen)
{
- A_UINT32 count;
- A_STATUS status = A_OK;
+ u32 count;
+ int status = 0;
switch(opcode) {
case HIF_DEVICE_GET_MBOX_BLOCK_SIZE:
- ((A_UINT32 *)config)[0] = HIF_MBOX0_BLOCK_SIZE;
- ((A_UINT32 *)config)[1] = HIF_MBOX1_BLOCK_SIZE;
- ((A_UINT32 *)config)[2] = HIF_MBOX2_BLOCK_SIZE;
- ((A_UINT32 *)config)[3] = HIF_MBOX3_BLOCK_SIZE;
+ ((u32 *)config)[0] = HIF_MBOX0_BLOCK_SIZE;
+ ((u32 *)config)[1] = HIF_MBOX1_BLOCK_SIZE;
+ ((u32 *)config)[2] = HIF_MBOX2_BLOCK_SIZE;
+ ((u32 *)config)[3] = HIF_MBOX3_BLOCK_SIZE;
break;
case HIF_DEVICE_GET_MBOX_ADDR:
for (count = 0; count < 4; count ++) {
- ((A_UINT32 *)config)[count] = HIF_MBOX_START_ADDR(count);
+ ((u32 *)config)[count] = HIF_MBOX_START_ADDR(count);
}
- if (configLen >= sizeof(HIF_DEVICE_MBOX_INFO)) {
- SetExtendedMboxWindowInfo((A_UINT16)device->func->device,
- (HIF_DEVICE_MBOX_INFO *)config);
+ if (configLen >= sizeof(struct hif_device_mbox_info)) {
+ SetExtendedMboxWindowInfo((u16)device->func->device,
+ (struct hif_device_mbox_info *)config);
}
break;
@@ -723,14 +723,14 @@ HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode,
if (!device->scatter_enabled) {
return A_ENOTSUP;
}
- status = SetupHIFScatterSupport(device, (HIF_DEVICE_SCATTER_SUPPORT_INFO *)config);
- if (A_FAILED(status)) {
- device->scatter_enabled = FALSE;
+ status = SetupHIFScatterSupport(device, (struct hif_device_scatter_support_info *)config);
+ if (status) {
+ device->scatter_enabled = false;
}
break;
case HIF_DEVICE_GET_OS_DEVICE:
/* pass back a pointer to the SDIO function's "dev" struct */
- ((HIF_DEVICE_OS_DEVICE_INFO *)config)->pOSDevice = &device->func->dev;
+ ((struct hif_device_os_device_info *)config)->pOSDevice = &device->func->dev;
break;
case HIF_DEVICE_POWER_STATE_CHANGE:
status = PowerStateChangeNotify(device, *(HIF_DEVICE_POWER_CHANGE_TYPE *)config);
@@ -745,7 +745,7 @@ HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode,
}
void
-HIFShutDownDevice(HIF_DEVICE *device)
+HIFShutDownDevice(struct hif_device *device)
{
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +HIFShutDownDevice\n"));
if (device != NULL) {
@@ -774,8 +774,8 @@ HIFShutDownDevice(HIF_DEVICE *device)
static void
hifIRQHandler(struct sdio_func *func)
{
- A_STATUS status;
- HIF_DEVICE *device;
+ int status;
+ struct hif_device *device;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifIRQHandler\n"));
device = getHifDevice(func);
@@ -785,19 +785,19 @@ hifIRQHandler(struct sdio_func *func)
status = device->htcCallbacks.dsrHandler(device->htcCallbacks.context);
sdio_claim_host(device->func);
atomic_set(&device->irqHandling, 0);
- AR_DEBUG_ASSERT(status == A_OK || status == A_ECANCELED);
+ AR_DEBUG_ASSERT(status == 0 || status == A_ECANCELED);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifIRQHandler\n"));
}
/* handle HTC startup via thread*/
static int startup_task(void *param)
{
- HIF_DEVICE *device;
+ struct hif_device *device;
- device = (HIF_DEVICE *)param;
+ device = (struct hif_device *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call HTC from startup_task\n"));
/* start up inform DRV layer */
- if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context,device)) != A_OK) {
+ if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context,device)) != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n"));
}
return 0;
@@ -806,15 +806,15 @@ static int startup_task(void *param)
#if defined(CONFIG_PM)
static int enable_task(void *param)
{
- HIF_DEVICE *device;
- device = (HIF_DEVICE *)param;
+ struct hif_device *device;
+ device = (struct hif_device *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call from resume_task\n"));
/* start up inform DRV layer */
if (device &&
device->claimedContext &&
osdrvCallbacks.devicePowerChangeHandler &&
- osdrvCallbacks.devicePowerChangeHandler(device->claimedContext, HIF_DEVICE_POWER_UP) != A_OK)
+ osdrvCallbacks.devicePowerChangeHandler(device->claimedContext, HIF_DEVICE_POWER_UP) != 0)
{
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n"));
}
@@ -826,7 +826,7 @@ static int enable_task(void *param)
static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id)
{
int ret;
- HIF_DEVICE * device;
+ struct hif_device * device;
int count;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
@@ -837,7 +837,7 @@ static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id
device = getHifDevice(func);
device->id = id;
- device->is_disabled = TRUE;
+ device->is_disabled = true;
spin_lock_init(&device->lock);
@@ -848,7 +848,7 @@ static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id
if (!nohifscattersupport) {
/* try to allow scatter operation on all instances,
* unless globally overridden */
- device->scatter_enabled = TRUE;
+ device->scatter_enabled = true;
}
/* Initialize the bus requests to be used later */
@@ -866,7 +866,7 @@ static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id
void
-HIFAckInterrupt(HIF_DEVICE *device)
+HIFAckInterrupt(struct hif_device *device)
{
AR_DEBUG_ASSERT(device != NULL);
@@ -874,7 +874,7 @@ HIFAckInterrupt(HIF_DEVICE *device)
}
void
-HIFUnMaskInterrupt(HIF_DEVICE *device)
+HIFUnMaskInterrupt(struct hif_device *device)
{
int ret;
@@ -890,7 +890,7 @@ HIFUnMaskInterrupt(HIF_DEVICE *device)
AR_DEBUG_ASSERT(ret == 0);
}
-void HIFMaskInterrupt(HIF_DEVICE *device)
+void HIFMaskInterrupt(struct hif_device *device)
{
int ret;
AR_DEBUG_ASSERT(device != NULL);
@@ -910,7 +910,7 @@ void HIFMaskInterrupt(HIF_DEVICE *device)
AR_DEBUG_ASSERT(ret == 0);
}
-BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device)
+BUS_REQUEST *hifAllocateBusRequest(struct hif_device *device)
{
BUS_REQUEST *busrequest;
unsigned long flag;
@@ -930,7 +930,7 @@ BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device)
}
void
-hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest)
+hifFreeBusRequest(struct hif_device *device, BUS_REQUEST *busrequest)
{
unsigned long flag;
@@ -949,10 +949,10 @@ hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest)
spin_unlock_irqrestore(&device->lock, flag);
}
-static A_STATUS hifDisableFunc(HIF_DEVICE *device, struct sdio_func *func)
+static int hifDisableFunc(struct hif_device *device, struct sdio_func *func)
{
int ret;
- A_STATUS status = A_OK;
+ int status = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDisableFunc\n"));
device = getHifDevice(func);
@@ -988,20 +988,20 @@ static A_STATUS hifDisableFunc(HIF_DEVICE *device, struct sdio_func *func)
sdio_release_host(device->func);
- if (status == A_OK) {
- device->is_disabled = TRUE;
+ if (status == 0) {
+ device->is_disabled = true;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDisableFunc\n"));
return status;
}
-static int hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func)
+static int hifEnableFunc(struct hif_device *device, struct sdio_func *func)
{
struct task_struct* pTask;
const char *taskName = NULL;
int (*taskFunc)(void *) = NULL;
- int ret = A_OK;
+ int ret = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifEnableFunc\n"));
device = getHifDevice(func);
@@ -1036,7 +1036,7 @@ static int hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func)
__FUNCTION__, HIF_MBOX_BLOCK_SIZE, ret));
return A_ERROR;
}
- device->is_disabled = FALSE;
+ device->is_disabled = false;
/* create async I/O thread */
if (!device->async_task) {
device->async_shutdown = 0;
@@ -1055,7 +1055,7 @@ static int hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func)
if (!device->claimedContext) {
taskFunc = startup_task;
taskName = "AR6K startup";
- ret = A_OK;
+ ret = 0;
#if defined(CONFIG_PM)
} else {
taskFunc = enable_task;
@@ -1080,22 +1080,23 @@ static int hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func)
static int hifDeviceSuspend(struct device *dev)
{
struct sdio_func *func=dev_to_sdio_func(dev);
- A_STATUS status = A_OK;
- HIF_DEVICE *device;
+ int status = 0;
+ struct hif_device *device;
device = getHifDevice(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceSuspend\n"));
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
- device->is_suspend = TRUE; /* set true first for PowerStateChangeNotify(..) */
+ device->is_suspend = true; /* set true first for PowerStateChangeNotify(..) */
status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext);
- if (status != A_OK) {
- device->is_suspend = FALSE;
+ if (status) {
+ device->is_suspend = false;
}
}
+ CleanupHIFScatterResources(device);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceSuspend\n"));
switch (status) {
- case A_OK:
+ case 0:
return 0;
case A_EBUSY:
return -EBUSY; /* Hack for kernel in order to support deep sleep and wow */
@@ -1107,27 +1108,27 @@ static int hifDeviceSuspend(struct device *dev)
static int hifDeviceResume(struct device *dev)
{
struct sdio_func *func=dev_to_sdio_func(dev);
- A_STATUS status = A_OK;
- HIF_DEVICE *device;
+ int status = 0;
+ struct hif_device *device;
device = getHifDevice(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceResume\n"));
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
status = osdrvCallbacks.deviceResumeHandler(device->claimedContext);
- if (status == A_OK) {
- device->is_suspend = FALSE;
+ if (status == 0) {
+ device->is_suspend = false;
}
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceResume\n"));
- return A_SUCCESS(status) ? 0 : status;
+ return status;
}
#endif /* CONFIG_PM */
static void hifDeviceRemoved(struct sdio_func *func)
{
- A_STATUS status = A_OK;
- HIF_DEVICE *device;
+ int status = 0;
+ struct hif_device *device;
AR_DEBUG_ASSERT(func != NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n"));
@@ -1137,25 +1138,25 @@ static void hifDeviceRemoved(struct sdio_func *func)
}
if (device->is_disabled) {
- device->is_disabled = FALSE;
+ device->is_disabled = false;
} else {
status = hifDisableFunc(device, func);
}
CleanupHIFScatterResources(device);
delHifDevice(device);
- AR_DEBUG_ASSERT(status == A_OK);
+ AR_DEBUG_ASSERT(status == 0);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
}
/*
* This should be moved to AR6K HTC layer.
*/
-A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device)
+int hifWaitForPendingRecv(struct hif_device *device)
{
- A_INT32 cnt = 10;
- A_UINT8 host_int_status;
- A_STATUS status = A_OK;
+ s32 cnt = 10;
+ u8 host_int_status;
+ int status = 0;
do {
while (atomic_read(&device->irqHandling)) {
@@ -1165,9 +1166,9 @@ A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device)
/* check if there is any pending irq due to force done */
host_int_status = 0;
status = HIFReadWrite(device, HOST_INT_STATUS_ADDRESS,
- (A_UINT8 *)&host_int_status, sizeof(host_int_status),
+ (u8 *)&host_int_status, sizeof(host_int_status),
HIF_RD_SYNC_BYTE_INC, NULL);
- host_int_status = A_SUCCESS(status) ? (host_int_status & (1 << 0)) : 0;
+ host_int_status = !status ? (host_int_status & (1 << 0)) : 0;
if (host_int_status) {
schedule(); /* schedule for next dsrHandler */
}
@@ -1178,17 +1179,17 @@ A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device)
("AR6000: %s(), Unable clear up pending IRQ before the system suspended\n", __FUNCTION__));
}
- return A_OK;
+ return 0;
}
-static HIF_DEVICE *
+static struct hif_device *
addHifDevice(struct sdio_func *func)
{
- HIF_DEVICE *hifdevice;
+ struct hif_device *hifdevice;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: addHifDevice\n"));
AR_DEBUG_ASSERT(func != NULL);
- hifdevice = kzalloc(sizeof(HIF_DEVICE), GFP_KERNEL);
+ hifdevice = kzalloc(sizeof(struct hif_device), GFP_KERNEL);
AR_DEBUG_ASSERT(hifdevice != NULL);
#if HIF_USE_DMA_BOUNCE_BUFFER
hifdevice->dma_buffer = kmalloc(HIF_DMA_BUFFER_SIZE, GFP_KERNEL);
@@ -1201,21 +1202,19 @@ addHifDevice(struct sdio_func *func)
return hifdevice;
}
-static HIF_DEVICE *
+static struct hif_device *
getHifDevice(struct sdio_func *func)
{
AR_DEBUG_ASSERT(func != NULL);
- return (HIF_DEVICE *)sdio_get_drvdata(func);
+ return (struct hif_device *)sdio_get_drvdata(func);
}
static void
-delHifDevice(HIF_DEVICE * device)
+delHifDevice(struct hif_device * device)
{
AR_DEBUG_ASSERT(device!= NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: delHifDevice; 0x%p\n", device));
- if (device->dma_buffer != NULL) {
- kfree(device->dma_buffer);
- }
+ kfree(device->dma_buffer);
kfree(device);
}
@@ -1223,27 +1222,27 @@ static void ResetAllCards(void)
{
}
-void HIFClaimDevice(HIF_DEVICE *device, void *context)
+void HIFClaimDevice(struct hif_device *device, void *context)
{
device->claimedContext = context;
}
-void HIFReleaseDevice(HIF_DEVICE *device)
+void HIFReleaseDevice(struct hif_device *device)
{
device->claimedContext = NULL;
}
-A_STATUS HIFAttachHTC(HIF_DEVICE *device, HTC_CALLBACKS *callbacks)
+int HIFAttachHTC(struct hif_device *device, HTC_CALLBACKS *callbacks)
{
if (device->htcCallbacks.context != NULL) {
/* already in use! */
return A_ERROR;
}
device->htcCallbacks = *callbacks;
- return A_OK;
+ return 0;
}
-void HIFDetachHTC(HIF_DEVICE *device)
+void HIFDetachHTC(struct hif_device *device)
{
A_MEMZERO(&device->htcCallbacks,sizeof(device->htcCallbacks));
}
@@ -1280,7 +1279,7 @@ static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsi
{
struct mmc_command ioCmd;
unsigned long arg;
- A_INT32 err;
+ s32 err;
memset(&ioCmd,0,sizeof(ioCmd));
SDIO_SET_CMD52_READ_ARG(arg,0,address);
diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c
index ee8b477..a1fdcc1 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c
@@ -48,7 +48,7 @@
(((address) & 0x1FFFF) << 9) | \
((bytes_blocks) & 0x1FF)
-static void FreeScatterReq(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
+static void FreeScatterReq(struct hif_device *device, struct hif_scatter_req *pReq)
{
unsigned long flag;
@@ -60,9 +60,9 @@ static void FreeScatterReq(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
}
-static HIF_SCATTER_REQ *AllocScatterReq(HIF_DEVICE *device)
+static struct hif_scatter_req *AllocScatterReq(struct hif_device *device)
{
- DL_LIST *pItem;
+ struct dl_list *pItem;
unsigned long flag;
spin_lock_irqsave(&device->lock, flag);
@@ -72,24 +72,24 @@ static HIF_SCATTER_REQ *AllocScatterReq(HIF_DEVICE *device)
spin_unlock_irqrestore(&device->lock, flag);
if (pItem != NULL) {
- return A_CONTAINING_STRUCT(pItem, HIF_SCATTER_REQ, ListLink);
+ return A_CONTAINING_STRUCT(pItem, struct hif_scatter_req, ListLink);
}
return NULL;
}
/* called by async task to perform the operation synchronously using direct MMC APIs */
-A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
+int DoHifReadWriteScatter(struct hif_device *device, BUS_REQUEST *busrequest)
{
int i;
- A_UINT8 rw;
- A_UINT8 opcode;
+ u8 rw;
+ u8 opcode;
struct mmc_request mmcreq;
struct mmc_command cmd;
struct mmc_data data;
- HIF_SCATTER_REQ_PRIV *pReqPriv;
- HIF_SCATTER_REQ *pReq;
- A_STATUS status = A_OK;
+ struct hif_scatter_req_priv *pReqPriv;
+ struct hif_scatter_req *pReq;
+ int status = 0;
struct scatterlist *pSg;
pReqPriv = busrequest->pScatterReq;
@@ -176,7 +176,7 @@ A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("HIF-SCATTER: data error: %d \n",data.error));
}
- if (A_FAILED(status)) {
+ if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("HIF-SCATTER: FAILED!!! (%s) Address: 0x%X, Block mode (BlockLen: %d, BlockCount: %d)\n",
(pReq->Request & HIF_WRITE) ? "WRITE":"READ",pReq->Address, data.blksz, data.blocks));
}
@@ -199,11 +199,11 @@ A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
}
/* callback to issue a read-write scatter request */
-static A_STATUS HifReadWriteScatter(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
+static int HifReadWriteScatter(struct hif_device *device, struct hif_scatter_req *pReq)
{
- A_STATUS status = A_EINVAL;
- A_UINT32 request = pReq->Request;
- HIF_SCATTER_REQ_PRIV *pReqPriv = (HIF_SCATTER_REQ_PRIV *)pReq->HIFPrivate[0];
+ int status = A_EINVAL;
+ u32 request = pReq->Request;
+ struct hif_scatter_req_priv *pReqPriv = (struct hif_scatter_req_priv *)pReq->HIFPrivate[0];
do {
@@ -237,7 +237,7 @@ static A_STATUS HifReadWriteScatter(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
}
if (pReq->TotalLength == 0) {
- A_ASSERT(FALSE);
+ A_ASSERT(false);
break;
}
@@ -260,26 +260,26 @@ static A_STATUS HifReadWriteScatter(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, ("HIF-SCATTER: queued async req: 0x%lX\n", (unsigned long)pReqPriv->busrequest));
/* wake thread, it will process and then take care of the async callback */
up(&device->sem_async);
- status = A_OK;
+ status = 0;
}
- } while (FALSE);
+ } while (false);
- if (A_FAILED(status) && (request & HIF_ASYNCHRONOUS)) {
+ if (status && (request & HIF_ASYNCHRONOUS)) {
pReq->CompletionStatus = status;
pReq->CompletionRoutine(pReq);
- status = A_OK;
+ status = 0;
}
return status;
}
/* setup of HIF scatter resources */
-A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo)
+int SetupHIFScatterSupport(struct hif_device *device, struct hif_device_scatter_support_info *pInfo)
{
- A_STATUS status = A_ERROR;
+ int status = A_ERROR;
int i;
- HIF_SCATTER_REQ_PRIV *pReqPriv;
+ struct hif_scatter_req_priv *pReqPriv;
BUS_REQUEST *busrequest;
do {
@@ -297,23 +297,23 @@ A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_I
for (i = 0; i < MAX_SCATTER_REQUESTS; i++) {
/* allocate the private request blob */
- pReqPriv = (HIF_SCATTER_REQ_PRIV *)A_MALLOC(sizeof(HIF_SCATTER_REQ_PRIV));
+ pReqPriv = (struct hif_scatter_req_priv *)A_MALLOC(sizeof(struct hif_scatter_req_priv));
if (NULL == pReqPriv) {
break;
}
- A_MEMZERO(pReqPriv, sizeof(HIF_SCATTER_REQ_PRIV));
+ A_MEMZERO(pReqPriv, sizeof(struct hif_scatter_req_priv));
/* save the device instance*/
pReqPriv->device = device;
/* allocate the scatter request */
- pReqPriv->pHifScatterReq = (HIF_SCATTER_REQ *)A_MALLOC(sizeof(HIF_SCATTER_REQ) +
- (MAX_SCATTER_ENTRIES_PER_REQ - 1) * (sizeof(HIF_SCATTER_ITEM)));
+ pReqPriv->pHifScatterReq = (struct hif_scatter_req *)A_MALLOC(sizeof(struct hif_scatter_req) +
+ (MAX_SCATTER_ENTRIES_PER_REQ - 1) * (sizeof(struct hif_scatter_item)));
if (NULL == pReqPriv->pHifScatterReq) {
A_FREE(pReqPriv);
break;
}
/* just zero the main part of the scatter request */
- A_MEMZERO(pReqPriv->pHifScatterReq, sizeof(HIF_SCATTER_REQ));
+ A_MEMZERO(pReqPriv->pHifScatterReq, sizeof(struct hif_scatter_req));
/* back pointer to the private struct */
pReqPriv->pHifScatterReq->HIFPrivate[0] = pReqPriv;
/* allocate a bus request for this scatter request */
@@ -344,11 +344,11 @@ A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_I
pInfo->MaxScatterEntries = MAX_SCATTER_ENTRIES_PER_REQ;
pInfo->MaxTransferSizePerScatterReq = MAX_SCATTER_REQ_TRANSFER_SIZE;
- status = A_OK;
+ status = 0;
- } while (FALSE);
+ } while (false);
- if (A_FAILED(status)) {
+ if (status) {
CleanupHIFScatterResources(device);
}
@@ -356,10 +356,10 @@ A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_I
}
/* clean up scatter support */
-void CleanupHIFScatterResources(HIF_DEVICE *device)
+void CleanupHIFScatterResources(struct hif_device *device)
{
- HIF_SCATTER_REQ_PRIV *pReqPriv;
- HIF_SCATTER_REQ *pReq;
+ struct hif_scatter_req_priv *pReqPriv;
+ struct hif_scatter_req *pReq;
/* empty the free list */
@@ -371,7 +371,7 @@ void CleanupHIFScatterResources(HIF_DEVICE *device)
break;
}
- pReqPriv = (HIF_SCATTER_REQ_PRIV *)pReq->HIFPrivate[0];
+ pReqPriv = (struct hif_scatter_req_priv *)pReq->HIFPrivate[0];
A_ASSERT(pReqPriv != NULL);
if (pReqPriv->busrequest != NULL) {