From: Larry F. <Lar...@lw...> - 2012-05-14 03:13:32
|
This set of patches follow the set of 10 that were submitted earlier. The cleanups include sparse warnings from pci.c and mem.c, delete the obsolete header files, fix style problems in the new inlines.h, and change the debug level of a couple of statements that were spamming the logs. Signed-off-by: Larry Finger <Lar...@lw...> Larry Finger (5): Fix remaining sparse warnings in pci.c Fix most remaining sparse warnings in mem.c Delete obsoleted header files Fix most style problems with inlines.h Reduce log spam common.c | 4 +- inlines.h | 64 +++++----- mem-inlines.h | 390 --------------------------------------------------------- mem.c | 188 ++-------------------------- pci-inlines.h | 63 --------- pci.c | 12 +- 6 files changed, 54 insertions(+), 667 deletions(-) delete mode 100644 mem-inlines.h delete mode 100644 pci-inlines.h -- 1.7.7 |
From: Larry F. <Lar...@lw...> - 2012-05-14 03:13:33
|
After commit 3c4f01f, the following warnings remain in pci.c: CHECK pci.c pci.c:1241:14: warning: incorrect type in assignment (different address spaces) pci.c:1241:14: expected void *mem1 pci.c:1241:14: got void [noderef] <asn:2>* pci.c:1247:14: warning: incorrect type in assignment (different address spaces) pci.c:1247:14: expected void *mem2 pci.c:1247:14: got void [noderef] <asn:2>* pci.c:1263:22: warning: incorrect type in assignment (different address spaces) pci.c:1263:22: expected void [noderef] <asn:2>*[usertype] iobase pci.c:1263:22: got void *mem1 pci.c:1265:23: warning: incorrect type in assignment (different address spaces) pci.c:1265:23: expected void [noderef] <asn:2>*[usertype] iobase2 pci.c:1265:23: got void *mem2 pci.c:1408:27: warning: incorrect type in argument 2 (different address spaces) pci.c:1408:27: expected void [noderef] <asn:2>*<noident> pci.c:1408:27: got void *mem2 pci.c:1412:27: warning: incorrect type in argument 2 (different address spaces) pci.c:1412:27: expected void [noderef] <asn:2>*<noident> pci.c:1412:27: got void *mem1 pci.c:1085:1: warning: symbol 'acxpci_probe' was not declared. Should it be static? pci.c:1453:16: warning: symbol 'acxpci_remove' was not declared. Should it be static? pci.c:1559:5: warning: symbol 'acxpci_e_suspend' was not declared. Should it be static? pci.c:1591:5: warning: symbol 'acxpci_e_resume' was not declared. Should it be static? These are all fixed. Signed-off-by: Larry Finger <Lar...@lw...> --- pci.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pci.c b/pci.c index ee44ae1..9008267 100644 --- a/pci.c +++ b/pci.c @@ -1080,7 +1080,7 @@ acx100pci_ioctl_set_phy_amp_bias(struct net_device *ndev, * id - ptr to the device id entry that matched this device */ #ifdef CONFIG_PCI -/* static */ +static int __devinit acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { @@ -1091,8 +1091,8 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) unsigned long mem_region2_size; unsigned long phymem1; unsigned long phymem2; - void *mem1 = NULL; - void *mem2 = NULL; + void __iomem *mem1 = NULL; + void __iomem *mem2 = NULL; acx_device_t *adev = NULL; const char *chip_name; int result = -EIO; @@ -1449,7 +1449,7 @@ done: * * pdev - ptr to PCI device structure containing info about pci configuration */ -/* static */ +static void __devexit acxpci_remove(struct pci_dev *pdev) { struct ieee80211_hw *hw = (struct ieee80211_hw *)pci_get_drvdata(pdev); @@ -1555,7 +1555,7 @@ void __devexit acxpci_remove(struct pci_dev *pdev) ** TODO: PM code needs to be fixed / debugged / tested. */ #ifdef CONFIG_PM -/* static */ +static int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state) { struct ieee80211_hw *hw = pci_get_drvdata(pdev); @@ -1587,7 +1587,7 @@ int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state) return OK; } -/* static */ +static int acxpci_e_resume(struct pci_dev *pdev) { struct ieee80211_hw *hw = pci_get_drvdata(pdev); -- 1.7.7 |
From: Larry F. <Lar...@lw...> - 2012-05-14 03:13:34
|
The driver produces the following two lines in the log for every channel change: acx.acx1xx_update_tx: Updating TX: enable, channel=11 acx.acx1xx_update_rx: Updating RX: enable, channel=11 Eliminate these lines by changing from L_INIT to L_XFER log level. Signed-off-by: Larry Finger <Lar...@lw...> --- common.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common.c b/common.c index 9e03c5a..5746c38 100644 --- a/common.c +++ b/common.c @@ -3118,7 +3118,7 @@ static int acx1xx_update_tx(acx_device_t *adev) int res; FN_ENTER; - log(L_INIT, "Updating TX: %s, channel=%d\n", + log(L_XFER, "Updating TX: %s, channel=%d\n", adev->tx_enabled ? "enable" : "disable", adev->channel); if (adev->tx_enabled) @@ -3146,7 +3146,7 @@ static int acx1xx_update_rx(acx_device_t *adev) int res; FN_ENTER; - log(L_INIT, "Updating RX: %s, channel=%d\n", + log(L_XFER, "Updating RX: %s, channel=%d\n", adev->rx_enabled ? "enable" : "disable", adev->channel); if (adev->rx_enabled) -- 1.7.7 |
From: Larry F. <Lar...@lw...> - 2012-05-14 03:13:36
|
CHECK mem.c mem.c:684:13: warning: symbol 'acxmem_complete_hw_reset' was not declared. Should it be static? mem.c:1037:14: warning: symbol 'acxmem_process_rxdesc' was not declared. Should it be static? mem.c:1162:6: warning: symbol 'acxmem_get_txbuf' was not declared. Should it be static? mem.c:1252:14: warning: symbol 'acxmem_reclaim_acx_txbuf_space' was not declared. Should it be static? mem.c:2407:26: warning: cast removes address space of expression mem.c:2407:26: warning: incorrect type in argument 1 (different address spaces) mem.c:2407:26: expected void volatile [noderef] <asn:2>*addr mem.c:2407:26: got void *<noident> mem.c:2156:23: warning: symbol 'acxmem_probe' was not declared. Should it be static? mem.c:2428:23: warning: symbol 'acxmem_remove' was not declared. Should it be static? mem.c:2626:32: warning: symbol 'acxmem_driver' was not declared. Should it be static? Removal of these leads to compilation warnings - dead code was removed: mem.c:1037:13: warning: ‘acxmem_process_rxdesc’ defined but not used [-Wunused-function] mem.c:1162:14: warning: ‘acxmem_get_txbuf’ defined but not used [-Wunused-function] mem.c:1252:13: warning: ‘acxmem_reclaim_acx_txbuf_space’ defined but not used [-Wunused-function] The following warnings remain - I think they are false positives: mem.c:670:9: warning: context imbalance in 'acxmem_issue_cmd_timeo_debug' - different lock contexts for basic block mem.c:735:9: warning: context imbalance in 'acxmem_complete_hw_reset' - different lock contexts for basic block mem.c:2153:9: warning: context imbalance in 'acxmem_probe' - different lock contexts for basic block mem.c:2335:9: warning: context imbalance in 'acxmem_remove' - different lock contexts for basic block Signed-off-by: Larry Finger <Lar...@lw...> --- mem.c | 188 +++++------------------------------------------------------------ 1 files changed, 13 insertions(+), 175 deletions(-) diff --git a/mem.c b/mem.c index 6438385..b8a91a5 100644 --- a/mem.c +++ b/mem.c @@ -681,10 +681,11 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, /* * Most of the acx specific pieces of hardware reset. */ -STATick int acxmem_complete_hw_reset(acx_device_t *adev) +static int acxmem_complete_hw_reset(acx_device_t *adev) { acx111_ie_configoption_t co; acxmem_lock_flags; + int ret; /* NB: read_reg() reads may return bogus data before * reset_dev(), since the firmware which directly controls @@ -728,11 +729,12 @@ STATick int acxmem_complete_hw_reset(acx_device_t *adev) /* TODO: merge them into one function, they are called just * once and are the same for pci & usb */ - if (OK != acx_read_eeprom_byte(adev, 0x05, &adev->eeprom_version)) - return -2; - + ret = acx_read_eeprom_byte(adev, 0x05, &adev->eeprom_version); acxmem_unlock(); + if (OK != ret) + return -2; + acx_parse_configoption(adev, &co); acx_get_firmware_version(adev); /* needs to be after acx_s_init_mac() */ acx_display_hardware_details(adev); @@ -1029,12 +1031,13 @@ int acxmem_proc_diag_output(struct seq_file *file, * ================================================== */ +#if 0 /* * acxmem_l_process_rxdesc * * Called directly and only from the IRQ handler */ -STATick void acxmem_process_rxdesc(acx_device_t *adev) +static void acxmem_process_rxdesc(acx_device_t *adev) { register rxhostdesc_t *hostdesc; register rxdesc_t *rxdesc; @@ -1153,16 +1156,7 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) adev->rx.tail = tail; FN_EXIT0; } - -/* - * BOM Tx Path - * ================================================== - */ - -void *acxmem_get_txbuf(acx_device_t *adev, tx_t *tx_opaque) -{ - return acxmem_get_txhostdesc(adev, (txdesc_t*) tx_opaque)->data; -} +#endif static int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int len) { @@ -1242,55 +1236,6 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) } /* - * Return buffer space back to the pool by following the next pointers - * until we find the block marked as the end. Point the last block to - * the head of the free list, then update the head of the free list to - * point to the newly freed memory. This routine gets called in - * interrupt context, so it shouldn't block to protect the integrity - * of the linked list. The ISR already holds the lock. - */ -STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) -{ - u32 cur, last, next; - - if ((blockptr >= adev->acx_txbuf_start) && - (blockptr <= adev->acx_txbuf_start + - (adev->acx_txbuf_numblocks - 1) * adev->memblocksize)) { - cur = blockptr; - do { - last = cur; - next = read_slavemem32(adev, cur); - - /* - * Advance to the next block in this allocation - */ - cur = (next & 0x7ffff) << 5; - - /* - * This block now counts as free. - */ - adev->acx_txbuf_blocks_free++; - } while (!(next & 0x02000000)); - - /* - * last now points to the last block of that - * allocation. Update the pointer in that block to - * point to the free list and reset the free list to - * the first block of the free call. If there were no - * free blocks, make sure the new end of the list - * marks itself as truly the end. - */ - if (adev->acx_txbuf_free) { - write_slavemem32(adev, last, adev->acx_txbuf_free >> 5); - } else { - write_slavemem32(adev, last, 0x02000000); - } - adev->acx_txbuf_free = blockptr; - } - -} - -/* * Initialize the pieces managing the transmit buffer pool on the ACX. * The transmit buffer is a circular queue with one 32 bit word * reserved at the beginning of each block. The upper 13 bits are a @@ -1363,113 +1308,6 @@ acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc) return &adev->tx.host.txstart[index * 2]; } - -#if 0 -/* clean *all* Tx descriptors, and regardless of their previous state. - * Used for brute-force reset handling. */ -void acxmem_clean_txdesc_emergency(acx_device_t *adev) -{ - txdesc_t *txdesc; - int i; - - FN_ENTER; - - for (i = 0; i < TX_CNT; i++) { - txdesc = acxmem_get_txdesc(adev, i); - - /* free it */ - write_slavemem8(adev, (u32) &(txdesc->ack_failures), 0); - write_slavemem8(adev, (u32) &(txdesc->rts_failures), 0); - write_slavemem8(adev, (u32) &(txdesc->rts_ok), 0); - write_slavemem8(adev, (u32) &(txdesc->error), 0); - write_slavemem8(adev, (u32) &(txdesc->Ctl_8), DESC_CTL_HOSTOWN); - -#if 0 - u32 acxmem; - /* - * Clean up the memory allocated on the ACX for this - * transmit descriptor. - */ - acxmem = read_slavemem32(adev, (u32) &(txdesc->AcxMemPtr)); - - if (acxmem) { - acxmem_reclaim_acx_txbuf_space(adev, acxmem); - } -#endif - - write_slavemem32(adev, (u32) &(txdesc->AcxMemPtr), 0); - } - - adev->tx_free = TX_CNT; - - acxmem_init_acx_txbuf2(adev); - - FN_EXIT0; -} - -void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) -{ -#ifdef USING_MORE_THAN_ONE_TRANSMIT_QUEUE - u32 indicator; - unsigned long flags; - int count; - - /* - * Can't handle an interrupt while we're fiddling with the - * ACX's lock, according to TI. The ACX is supposed to hold - * fw_lock for at most 500ns. - */ - local_irq_save(flags); - - /* - * Wait for ACX to release the lock (at most 500ns). - */ - count = 0; - while (read_slavemem16 (adev, (u32) &(adev->acx_queue_indicator->fw_lock)) - && (count++ < 50)) { - ndelay (10); - } - if (count < 50) { - - /* - * Take out the host lock - anything non-zero will - * work, so don't worry about be/le - */ - write_slavemem16 (adev, (u32) &(adev->acx_queue_indicator->host_lock), 1); - - /* - * Avoid a race condition - */ - count = 0; - while (read_slavemem16 (adev, (u32) &(adev->acx_queue_indicator->fw_lock)) - && (count++ < 50)) { - ndelay (10); - } - - if (count < 50) { - /* - * Mark the queue active - */ - indicator = read_slavemem32 (adev, (u32) &(adev->acx_queue_indicator->indicator)); - indicator |= cpu_to_le32 (1 << txqueue); - write_slavemem32 (adev, (u32) &(adev->acx_queue_indicator->indicator), indicator); - } - - /* - * Release the host lock - */ - write_slavemem16 (adev, (u32) &(adev->acx_queue_indicator->host_lock), 0); - - } - - /* - * Restore interrupts - */ - local_irq_restore (flags); -#endif -} -#endif - /* OW TODO See if this is usable with mac80211 */ /*********************************************************************** ** acxmem_i_tx_timeout @@ -2153,7 +1991,7 @@ int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw, * pdev - ptr to pci device structure containing info about pci configuration * id - ptr to the device id entry that matched this device */ -STATick int __devinit acxmem_probe(struct platform_device *pdev) +static int __devinit acxmem_probe(struct platform_device *pdev) { acx_device_t *adev = NULL; const char *chip_name; @@ -2404,7 +2242,7 @@ fail_request_irq: fail_ioremap: if (adev->iobase) - iounmap((void *)adev->iobase); + iounmap(adev->iobase); fail_unknown_chiptype: fail_ieee80211_alloc_hw: @@ -2425,7 +2263,7 @@ done: * * pdev - ptr to PCI device structure containing info about pci configuration */ -STATick int __devexit acxmem_remove(struct platform_device *pdev) +static int __devexit acxmem_remove(struct platform_device *pdev) { struct ieee80211_hw *hw = (struct ieee80211_hw *) platform_get_drvdata(pdev); @@ -2623,7 +2461,7 @@ STATick int acxmem_e_resume(struct platform_device *pdev) #endif /* CONFIG_PM */ -STATick struct platform_driver acxmem_driver = { +static struct platform_driver acxmem_driver = { .driver = { .name = "acx-mem", }, -- 1.7.7 |
From: Larry F. <Lar...@lw...> - 2012-05-14 03:13:36
|
After the xxx-inlines.h files were combined, the old ones can be deleted. Signed-off-by: Larry Finger <Lar...@lw...> --- mem-inlines.h | 390 --------------------------------------------------------- pci-inlines.h | 63 --------- 2 files changed, 0 insertions(+), 453 deletions(-) delete mode 100644 mem-inlines.h delete mode 100644 pci-inlines.h diff --git a/mem-inlines.h b/mem-inlines.h deleted file mode 100644 index cdcec3f..0000000 --- a/mem-inlines.h +++ /dev/null @@ -1,390 +0,0 @@ -#ifndef _MEM_INLINES_H_ -#define _MEM_INLINES_H_ - -/* currently need this even for no-mem builds, as it contains the - * locking elements used in merge.c. TBD whether its worth - * repartitioning to achieve this - */ -#if defined(CONFIG_ACX_MAC80211_MEM) || 1 - -/* - * Locking in mem - * ================================================== - */ - -/* - * Locking in mem is more complex as for pci, because the different - * data-access functions below need to be protected against incoming - * interrupts. - * - * Data-access on the mem device is always going in serveral, - * none-atomic steps, involving 2 or more register writes - * (e.g. ACX_SLV_REG_ADDR, ACX_SLV_REG_DATA). - * - * If an interrupt is serviced while a data-access function is - * ongoing, this may give access interference with by the involved - * operations, since the irq routine is also using the same - * data-access functions. - * - * In case of interference, this often manifests during driver - * operations as failure of device cmds and subsequent hanging of the - * device. It especially appeared during sw-scans while a connection - * was up. - * - * For this reason, irqs shall be off while data access functions are - * executed, and for this we'll use the acx-spinlock. - * - * In pci we don't have this problem, because all data-access - * functions are atomic enough and we use dma (and the sw-scan problem - * is also not observed in pci, which indicates confirmation). - * - * Apart from this, the pure acx-sem locking is already coordinating - * accesses well enough, that simple driver operation without - * inbetween scans work without problems. - * - * Different locking approaches a possible to solves this (e.g. fine - * vs coarse-grained). - * - * The chosen approach is: - * - * 1) Mem.c data-access functions contain all a check to insure, they - * are executed under the acx-spinlock. => This is the red line that - * tells, if something needs coverage. - * - * 2) The scope of acx-spinlocking is local, in this case here only to - * mem.c. All common.c functions are already protected by the sem. - * - * 3) In order to consolidate locking calls and also to account for - * the logic of the various write_flush() calls around, locking in mem - * should be: - * - * a) as coarse-grained as possible, and ... - * - * b) ... as fine-grained as required. Basically that means, that - * before functions, that sleep, unlocking needs to be done. And - * locking is taken up again inside the sleeping - * function. Specifically the cmd-functions are used in this path. - * - * Once stable, the locking checks in the data-access functions could - * be #defined away. Mem.c is anyway more used two smaller cpus (pxa - * UP e.g.), so the implied runtime constraints by the lock won't take - * much effect. - */ - -/* These are used in many mem.c funcs, including those which should be - * merged with their pci counterparts. - */ -#define acxmem_lock_flags unsigned long flags=0 -#define acxmem_lock() if(IS_MEM(adev)) spin_lock_irqsave(&adev->spinlock, flags) -#define acxmem_unlock() if(IS_MEM(adev)) spin_unlock_irqrestore(&adev->spinlock, flags) - -/* Endianess: read[lw], write[lw] do little-endian conversion internally */ -#define acx_readl(v) readl((v)) -#define acx_readw(v) readw((v)) -#define acx_readb(v) readb((v)) -#define acx_writel(v, r) writel((v), (r)) -#define acx_writew(v, r) writew((v), (r)) -#define acx_writeb(v, r) writeb((v), (r)) - -/* This controls checking of spin-locking in the mem-interface */ -#define ACXMEM_SPIN_CHECK 0 - -#if ACXMEM_SPIN_CHECK -#define ACXMEM_WARN_NOT_SPIN_LOCKED \ -do { \ - if (!spin_is_locked(&adev->spinlock)){ \ - logf0(L_ANY, "mem: warning: data access not locked!\n"); \ - dump_stack(); \ - } \ -} while (0) -#else -#define ACXMEM_WARN_NOT_SPIN_LOCKED do { } while (0) -#endif - -typedef enum { - ACX_SOFT_RESET = 0x0000, - ACX_SLV_REG_ADDR = 0x0004, - ACX_SLV_REG_DATA = 0x0008, - ACX_SLV_REG_ADATA = 0x000c, - ACX_SLV_MEM_CP = 0x0010, - ACX_SLV_MEM_ADDR = 0x0014, /*redundant with IO_ACX_SLV_MEM_ADDR */ - ACX_SLV_MEM_DATA = 0x0018, /*redundant with IO_ACX_SLV_MEM_DATA*/ - ACX_SLV_MEM_CTL = 0x001c, /*redundant with IO_ACX_SLV_END_CTL */ -} acxreg_t; - -#define INLINE_IO static inline - -INLINE_IO u32 read_id_register(acx_device_t *adev) -{ - ACXMEM_WARN_NOT_SPIN_LOCKED; - acx_writel(0x24, adev->iobase + ACX_SLV_REG_ADDR); - return acx_readl(adev->iobase + ACX_SLV_REG_DATA); -} - -#define check_IO_ACX_ECPU_CTRL(adev, addr, offset) \ - \ - if (offset > IO_ACX_ECPU_CTRL) \ - addr = offset; \ - else \ - addr = adev->io[offset]; - -/* note the buried return */ -#define ret_addr_lt20_rd_(adev, addr, _lwb) \ - if (addr < 0x20) \ - return acx_read##_lwb(((u8 *) adev->iobase) + addr); - -#define ret_addr_lt20_rdl(adev, addr) ret_addr_lt20_rd_(adev, addr, l) -#define ret_addr_lt20_rdw(adev, addr) ret_addr_lt20_rd_(adev, addr, w) -#define ret_addr_lt20_rdb(adev, addr) ret_addr_lt20_rd_(adev, addr, b) - -/* note the buried return */ -#define ret_addr_lt20_wr_(adev, addr, _lwb, val) \ - if (addr < 0x20) { \ - acx_write##_lwb(val, ((u8 *) adev->iobase) + addr); \ - return; \ - } - -#define ret_addr_lt20_wrl(adev, addr, val) \ - ret_addr_lt20_wr_(adev, addr, l, val) -#define ret_addr_lt20_wrw(adev, addr, val) \ - ret_addr_lt20_wr_(adev, addr, w, val) -#define ret_addr_lt20_wrb(adev, addr, val) \ - ret_addr_lt20_wr_(adev, addr, b, val) - - -INLINE_IO u32 read_reg32(acx_device_t *adev, unsigned int offset) -{ - u32 val; - u32 addr; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - check_IO_ACX_ECPU_CTRL(adev, addr, offset); - ret_addr_lt20_rdl(adev, addr); - - acx_writel(addr, adev->iobase + ACX_SLV_REG_ADDR); - val = acx_readl(adev->iobase + ACX_SLV_REG_DATA); - - return val; -} - -INLINE_IO u16 read_reg16(acx_device_t *adev, unsigned int offset) -{ - u16 lo; - u32 addr; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - check_IO_ACX_ECPU_CTRL(adev, addr, offset); - ret_addr_lt20_rdw(adev, addr); - - acx_writel(addr, adev->iobase + ACX_SLV_REG_ADDR); - lo = acx_readw((u16 *) (adev->iobase + ACX_SLV_REG_DATA)); - - return lo; -} - -INLINE_IO u8 read_reg8(acx_device_t *adev, unsigned int offset) -{ - u8 lo; - u32 addr; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - check_IO_ACX_ECPU_CTRL(adev, addr, offset); - ret_addr_lt20_rdb(adev, addr); - - acx_writel(addr, adev->iobase + ACX_SLV_REG_ADDR); - lo = acx_readw((u8 *) (adev->iobase + ACX_SLV_REG_DATA)); - - return (u8) lo; -} - -INLINE_IO void write_reg32(acx_device_t *adev, unsigned int offset, u32 val) -{ - u32 addr; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - check_IO_ACX_ECPU_CTRL(adev, addr, offset); - ret_addr_lt20_wrl(adev, addr, val); - - acx_writel(addr, adev->iobase + ACX_SLV_REG_ADDR); - acx_writel(val, adev->iobase + ACX_SLV_REG_DATA); -} - -INLINE_IO void write_reg16(acx_device_t *adev, unsigned int offset, u16 val) -{ - u32 addr; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - check_IO_ACX_ECPU_CTRL(adev, addr, offset); - ret_addr_lt20_wrw(adev, addr, val); - - acx_writel(addr, adev->iobase + ACX_SLV_REG_ADDR); - acx_writew(val, (u16 *) (adev->iobase + ACX_SLV_REG_DATA)); -} - -INLINE_IO void write_reg8(acx_device_t *adev, unsigned int offset, u8 val) -{ - u32 addr; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - check_IO_ACX_ECPU_CTRL(adev, addr, offset); - ret_addr_lt20_wrb(adev, addr, val); - - acx_writel(addr, adev->iobase + ACX_SLV_REG_ADDR); - writeb(val, (u8 *) (adev->iobase + ACX_SLV_REG_DATA)); -} - -/* Handle PCI posting properly: Make sure that writes reach the - * adapter in case they require to be executed *before* the next - * write, by reading a random (and safely accessible) register. This - * call has to be made if there is no read following (which would - * flush the data to the adapter), yet the written data has to reach - * the adapter immediately. */ -INLINE_IO void write_flush(acx_device_t *adev) -{ - /* readb(adev->iobase + adev->io[IO_ACX_INFO_MAILBOX_OFFS]); */ - /* faster version (accesses the first register, - * IO_ACX_SOFT_RESET, which should also be safe): */ - ACXMEM_WARN_NOT_SPIN_LOCKED; - (void) acx_readl(adev->iobase); -} - -INLINE_IO void set_regbits(acx_device_t *adev, unsigned int offset, u32 bits) -{ - u32 tmp; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - - tmp = read_reg32(adev, offset); - tmp = tmp | bits; - write_reg32(adev, offset, tmp); - write_flush(adev); -} - -INLINE_IO void clear_regbits(acx_device_t *adev, unsigned int offset, u32 bits) -{ - u32 tmp; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - - tmp = read_reg32(adev, offset); - tmp = tmp & ~bits; - write_reg32(adev, offset, tmp); - write_flush(adev); -} - -/* - * Copy from PXA memory to the ACX memory. This assumes both the PXA - * and ACX addresses are 32 bit aligned. Count is in bytes. - */ -INLINE_IO void write_slavemem32(acx_device_t *adev, u32 slave_address, u32 val) -{ - ACXMEM_WARN_NOT_SPIN_LOCKED; - - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0x0); - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, slave_address); - udelay(10); - write_reg32(adev, IO_ACX_SLV_MEM_DATA, val); -} - -INLINE_IO u32 read_slavemem32(acx_device_t *adev, u32 slave_address) -{ - u32 val; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0x0); - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, slave_address); - udelay (10); - val = read_reg32(adev, IO_ACX_SLV_MEM_DATA); - - return val; -} - -INLINE_IO void write_slavemem8(acx_device_t *adev, u32 slave_address, u8 val) -{ - u32 data; - u32 base; - int offset; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - - /* - * Get the word containing the target address and the byte - * offset in that word. - */ - base = slave_address & ~3; - offset = (slave_address & 3) * 8; - - data = read_slavemem32(adev, base); - data &= ~(0xff << offset); - data |= val << offset; - write_slavemem32(adev, base, data); -} - -INLINE_IO u8 read_slavemem8(acx_device_t *adev, u32 slave_address) -{ - u8 val; - u32 base; - u32 data; - int offset; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - - base = slave_address & ~3; - offset = (slave_address & 3) * 8; - - data = read_slavemem32(adev, base); - - val = (data >> offset) & 0xff; - - return val; -} - -/* - * doesn't split across word boundaries - */ -INLINE_IO void write_slavemem16(acx_device_t *adev, u32 slave_address, u16 val) -{ - u32 data; - u32 base; - int offset; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - - /* - * Get the word containing the target address and the byte - * offset in that word. - */ - base = slave_address & ~3; - offset = (slave_address & 3) * 8; - - data = read_slavemem32(adev, base); - data &= ~(0xffff << offset); - data |= val << offset; - write_slavemem32(adev, base, data); -} - -/* - * doesn't split across word boundaries - */ -INLINE_IO u16 read_slavemem16(acx_device_t *adev, u32 slave_address) -{ - u16 val; - u32 base; - u32 data; - int offset; - - ACXMEM_WARN_NOT_SPIN_LOCKED; - - base = slave_address & ~3; - offset = (slave_address & 3) * 8; - - data = read_slavemem32(adev, base); - - val = (data >> offset) & 0xffff; - - return val; -} - -#endif /* CONFIG_ACX_MAC80211_MEM */ -#endif /* _MEM_INLINES_H_ */ diff --git a/pci-inlines.h b/pci-inlines.h deleted file mode 100644 index c5c6d70..0000000 --- a/pci-inlines.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * BOM Data Access - * ================================================== - */ - -/* Endianess: read[lw], write[lw] do little-endian conversion internally */ -#define acx_readl(v) readl((v)) -#define acx_readw(v) readw((v)) -#define acx_writel(v, r) writel((v), (r)) -#define acx_writew(v, r) writew((v), (r)) - -INLINE_IO u32 read_reg32(acx_device_t *adev, unsigned int offset) -{ -#if ACX_IO_WIDTH == 32 - return acx_readl((u8 *) adev->iobase + adev->io[offset]); -#else - return acx_readw((u8 *) adev->iobase + adev->io[offset]) - + (acx_readw((u8 *) adev->iobase + adev->io[offset] + 2) << 16); -#endif -} - -INLINE_IO u16 read_reg16(acx_device_t *adev, unsigned int offset) -{ - return acx_readw((u8 *) adev->iobase + adev->io[offset]); -} - -INLINE_IO u8 read_reg8(acx_device_t *adev, unsigned int offset) -{ - return readb((u8 *) adev->iobase + adev->io[offset]); -} - -INLINE_IO void write_reg32(acx_device_t *adev, unsigned int offset, u32 val) -{ -#if ACX_IO_WIDTH == 32 - acx_writel(val, (u8 *) adev->iobase + adev->io[offset]); -#else - acx_writew(val & 0xffff, (u8 *) adev->iobase + adev->io[offset]); - acx_writew(val >> 16, (u8 *) adev->iobase + adev->io[offset] + 2); -#endif -} - -INLINE_IO void write_reg16(acx_device_t *adev, unsigned int offset, u16 val) -{ - acx_writew(val, (u8 *) adev->iobase + adev->io[offset]); -} - -INLINE_IO void write_reg8(acx_device_t *adev, unsigned int offset, u8 val) -{ - writeb(val, (u8 *) adev->iobase + adev->io[offset]); -} - -/* Handle PCI posting properly: - * Make sure that writes reach the adapter in case they require to be executed - * *before* the next write, by reading a random (and safely accessible) register. - * This call has to be made if there is no read following (which would flush the data - * to the adapter), yet the written data has to reach the adapter immediately. */ -INLINE_IO void write_flush(acx_device_t *adev) -{ - /* readb(adev->iobase + adev->io[IO_ACX_INFO_MAILBOX_OFFS]); */ - /* faster version (accesses the first register, IO_ACX_SOFT_RESET, - * which should also be safe): */ - readb(adev->iobase); -} -- 1.7.7 |
From: Larry F. <Lar...@lw...> - 2012-05-14 03:13:39
|
The file has trailing whitespace on some lines. In addition, a number of warnings and errors from the checkpatch.pl script are fixed. Signed-off-by: Larry Finger <Lar...@lw...> --- inlines.h | 64 +++++++++++++++++++++++++++++++----------------------------- 1 files changed, 33 insertions(+), 31 deletions(-) diff --git a/inlines.h b/inlines.h index 7093aa1..deb256a 100644 --- a/inlines.h +++ b/inlines.h @@ -17,7 +17,7 @@ * Locking in mem is more complex as for pci, because the different * data-access functions below need to be protected against incoming * interrupts. - * + * * Data-access on the mem device is always going in serveral, * none-atomic steps, involving 2 or more register writes * (e.g. ACX_SLV_REG_ADDR, ACX_SLV_REG_DATA). @@ -26,41 +26,41 @@ * ongoing, this may give access interference with by the involved * operations, since the irq routine is also using the same * data-access functions. - * + * * In case of interference, this often manifests during driver * operations as failure of device cmds and subsequent hanging of the * device. It especially appeared during sw-scans while a connection * was up. - * + * * For this reason, irqs shall be off while data access functions are * executed, and for this we'll use the acx-spinlock. * * In pci we don't have this problem, because all data-access * functions are atomic enough and we use dma (and the sw-scan problem * is also not observed in pci, which indicates confirmation). - * + * * Apart from this, the pure acx-sem locking is already coordinating * accesses well enough, that simple driver operation without * inbetween scans work without problems. * * Different locking approaches a possible to solves this (e.g. fine * vs coarse-grained). - * + * * The chosen approach is: - * + * * 1) Mem.c data-access functions contain all a check to insure, they * are executed under the acx-spinlock. => This is the red line that * tells, if something needs coverage. - * + * * 2) The scope of acx-spinlocking is local, in this case here only to * mem.c. All common.c functions are already protected by the sem. * * 3) In order to consolidate locking calls and also to account for * the logic of the various write_flush() calls around, locking in mem * should be: - * + * * a) as coarse-grained as possible, and ... - * + * * b) ... as fine-grained as required. Basically that means, that * before functions, that sleep, unlocking needs to be done. And * locking is taken up again inside the sleeping @@ -75,9 +75,14 @@ /* These are used in many mem.c funcs, including those which should be * merged with their pci counterparts. */ -#define acxmem_lock_flags unsigned long flags=0 -#define acxmem_lock() if(IS_MEM(adev)) spin_lock_irqsave(&adev->spinlock, flags) -#define acxmem_unlock() if(IS_MEM(adev)) spin_unlock_irqrestore(&adev->spinlock, flags) +#define acxmem_lock_flags unsigned long flags = 0 +#define acxmem_lock() \ + if (IS_MEM(adev)) \ + spin_lock_irqsave(&adev->spinlock, flags) + +#define acxmem_unlock() \ + if (IS_MEM(adev)) \ + spin_unlock_irqrestore(&adev->spinlock, flags) /* Endianess: read[lw], write[lw] do little-endian conversion internally */ #define acx_readl(v) readl((v)) @@ -92,18 +97,16 @@ #if ACXMEM_SPIN_CHECK #define ACXMEM_WARN_NOT_SPIN_LOCKED \ -do { \ - if (!spin_is_locked(&adev->spinlock)){ \ - logf0(L_ANY, "mem: warning: data access not locked!\n"); \ + (if (!spin_is_locked(&adev->spinlock)) { \ + logf0(L_ANY, "mem: warning: data access not locked!\n");\ dump_stack(); \ - } \ -} while (0) + }) #else #define ACXMEM_WARN_NOT_SPIN_LOCKED do { } while (0) #endif -typedef enum { - ACX_SOFT_RESET = 0x0000, +enum acxreg_t { + ACX_SOFT_RESET = 0x0000, ACX_SLV_REG_ADDR = 0x0004, ACX_SLV_REG_DATA = 0x0008, ACX_SLV_REG_ADATA = 0x000c, @@ -111,7 +114,7 @@ typedef enum { ACX_SLV_MEM_ADDR = 0x0014, /*redundant with IO_ACX_SLV_MEM_ADDR */ ACX_SLV_MEM_DATA = 0x0018, /*redundant with IO_ACX_SLV_MEM_DATA*/ ACX_SLV_MEM_CTL = 0x001c, /*redundant with IO_ACX_SLV_END_CTL */ -} acxreg_t; +}; #define INLINE_IO static inline @@ -122,16 +125,15 @@ INLINE_IO u32 read_id_register(acx_device_t *adev) return acx_readl(adev->iobase + ACX_SLV_REG_DATA); } -#define check_IO_ACX_ECPU_CTRL(adev, addr, offset) \ - \ - if (offset > IO_ACX_ECPU_CTRL) \ - addr = offset; \ - else \ +#define check_IO_ACX_ECPU_CTRL(adev, addr, offset) \ + if (offset > IO_ACX_ECPU_CTRL) \ + addr = offset; \ + else \ addr = adev->io[offset]; /* note the buried return */ -#define ret_addr_lt20_rd_(adev, addr, _lwb) \ - if (addr < 0x20) \ +#define ret_addr_lt20_rd_(adev, addr, _lwb) \ + if (addr < 0x20) \ return acx_read##_lwb(adev->iobase + addr); #define ret_addr_lt20_rdl(adev, addr) ret_addr_lt20_rd_(adev, addr, l) @@ -139,10 +141,10 @@ INLINE_IO u32 read_id_register(acx_device_t *adev) #define ret_addr_lt20_rdb(adev, addr) ret_addr_lt20_rd_(adev, addr, b) /* note the buried return */ -#define ret_addr_lt20_wr_(adev, addr, _lwb, val) \ - if (addr < 0x20) { \ +#define ret_addr_lt20_wr_(adev, addr, _lwb, val) \ + if (addr < 0x20) { \ acx_write##_lwb(val, adev->iobase + addr); \ - return; \ + return; \ } #define ret_addr_lt20_wrl(adev, addr, val) \ @@ -353,7 +355,7 @@ INLINE_IO u32 read_slavemem32(acx_device_t *adev, u32 slave_address) write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0x0); write_reg32(adev, IO_ACX_SLV_MEM_ADDR, slave_address); - udelay (10); + udelay(10); val = read_reg32(adev, IO_ACX_SLV_MEM_DATA); return val; -- 1.7.7 |