From: Jim C. <jim...@gm...> - 2012-05-08 17:14:56
|
- make helpers static, and drop from merge.h - reorder callees 1st - drop fn-name from pr_*, let pr_fmt() do it - pr_err on FAIL (few more forgotten) Signed-off-by: Jim Cromie <jim...@gm...> --- merge.c | 82 ++++++++++++++++++++++++++++++-------------------------------- merge.h | 15 +++-------- 2 files changed, 44 insertions(+), 53 deletions(-) diff --git a/merge.c b/merge.c index a17c224..bd300d1 100644 --- a/merge.c +++ b/merge.c @@ -206,11 +206,11 @@ int acxpci_upload_radio(acx_device_t *adev) return acx_upload_radio(adev, filename); } -//########################################## -/* host desc queue stuff */ +/* ########################################## */ +/* host_desc_queue creation */ -void *acx_allocate(acx_device_t * adev, size_t size, - dma_addr_t * phy, const char *msg) +static void *acx_allocate(acx_device_t *adev, size_t size, + dma_addr_t * phy, const char *msg) { void *ptr; @@ -233,8 +233,8 @@ void *acx_allocate(acx_device_t * adev, size_t size, memset(ptr, 0, size); return ptr; } - pr_err("%s allocation FAILED (%d bytes)\n", - msg, (int)size); + pr_err("%s allocation FAILED (%d bytes)\n", msg, (int)size); + return NULL; } @@ -245,7 +245,7 @@ void *acx_allocate(acx_device_t * adev, size_t size, * the whole size of a data buffer (header plus data body) plus 32 * bytes safety offset at the end */ -static int acx_create_rx_host_desc_queue(acx_device_t * adev) +static int acx_create_rx_host_desc_queue(acx_device_t *adev) { rxhostdesc_t *hostdesc; rxbuffer_t *rxbuf; @@ -303,14 +303,13 @@ static int acx_create_rx_host_desc_queue(acx_device_t * adev) FN_EXIT1(OK); return OK; fail: - pr_acx("create_rx_host_desc_queue FAILED\n"); + pr_acx("FAILED\n"); /* dealloc will be done by free function on error case */ FN_EXIT1(NOT_OK); return NOT_OK; } -static -int acx_create_tx_host_desc_queue(acx_device_t * adev) +static int acx_create_tx_host_desc_queue(acx_device_t *adev) { txhostdesc_t *hostdesc; u8 *txbuf; @@ -435,36 +434,12 @@ int acx_create_tx_host_desc_queue(acx_device_t * adev) FN_EXIT1(OK); return OK; fail: - pr_acx("create_tx_host_desc_queue FAILED\n"); + pr_err("FAILED\n"); /* dealloc will be done by free function on error case */ FN_EXIT1(NOT_OK); return NOT_OK; } -void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start) -{ - u32 *p; - int i; - - acxmem_lock_flags; - acxmem_lock(); - - acx_create_tx_desc_queue(adev, tx_queue_start); - acx_create_rx_desc_queue(adev, rx_queue_start); - - if (IS_PCI(adev)) - goto out; - - p = (u32 *) adev->acx_queue_indicator; - for (i = 0; i < 4; i++) { - write_slavemem32(adev, (u32) p, 0); - p++; - } -out: - acxmem_unlock(); -} - int acx_create_hostdesc_queues(acx_device_t *adev) { int result; @@ -479,10 +454,10 @@ int acx_create_hostdesc_queues(acx_device_t *adev) return result; } -//########################################## -/* non-host desc queue stuff */ +/* ########################################## */ +/* non-host desc_queue creation */ -void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start) +static void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start) { rxdesc_t *rxdesc; u32 mem_offs; @@ -579,7 +554,7 @@ void acx_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start) FN_EXIT0; } -void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) +static void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) { txdesc_t *txdesc; txhostdesc_t *hostdesc; @@ -705,8 +680,32 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) FN_EXIT0; } -//########################################## -/* free desc queue stuff */ +void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, + u32 rx_queue_start) +{ + u32 *p; + int i; + + acxmem_lock_flags; + acxmem_lock(); + + acx_create_tx_desc_queue(adev, tx_queue_start); + acx_create_rx_desc_queue(adev, rx_queue_start); + + if (IS_PCI(adev)) + goto out; + + p = (u32 *) adev->acx_queue_indicator; + for (i = 0; i < 4; i++) { + write_slavemem32(adev, (u32) p, 0); + p++; + } +out: + acxmem_unlock(); +} + +/* ########################################## */ +/* free desc_queue stuff */ /* * acx_free_desc_queues @@ -718,7 +717,6 @@ void acx_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start) void acx_free_desc_queues(acx_device_t *adev) { - #define ACX_FREE_QUEUE(adev, size, ptr, phyaddr) \ if (ptr) { \ if (IS_PCI(adev)) \ diff --git a/merge.h b/merge.h index e995c94..1f4bd11 100644 --- a/merge.h +++ b/merge.h @@ -5,7 +5,11 @@ irqreturn_t acx_interrupt(int irq, void *dev_id); +void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, + u32 rx_queue_start); + int acx_create_hostdesc_queues(acx_device_t *adev); +void acx_free_desc_queues(acx_device_t *adev); void acx_log_rxbuffer(const acx_device_t *adev); void acx_log_txbuffer(acx_device_t *adev); @@ -15,11 +19,6 @@ int acx_op_start(struct ieee80211_hw *hw); void acx_handle_info_irq(acx_device_t *adev); -// temporary ?? may go static after all users are in merge.c -void *acx_allocate(acx_device_t *adev, size_t size, - dma_addr_t *phy, const char *msg); - -void acx_free_desc_queues(acx_device_t *adev); int _acx_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf); int _acx_write_phy_reg(acx_device_t *adev, u32 reg, u8 value); @@ -36,9 +35,6 @@ void acx_set_interrupt_mask(acx_device_t *adev); void acx_show_card_eeprom_id(acx_device_t *adev); -void acx_create_rx_desc_queue(acx_device_t *adev, u32 rx_queue_start); -void acx_create_tx_desc_queue(acx_device_t *adev, u32 rx_queue_start); - unsigned int acx_tx_clean_txdesc(acx_device_t *adev); void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, @@ -63,9 +59,6 @@ int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxmem_upload_fw(acx_device_t *adev); -void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start); - /* wrappers on acx_upload_radio(adev, filename */ int acxmem_upload_radio(acx_device_t *adev); int acxpci_upload_radio(acx_device_t *adev); -- 1.7.8.1 |