staging: slicoss: remove slic_spinlock wrapper
PATCH 1/1 staging: slicoss: remove slic_spinlock wrapper
As per TODO. This commit introduces no functional changes.
--- drivers/staging/slicoss/TODO | 1 - drivers/staging/slicoss/slic.h | 19 +++--- drivers/staging/slicoss/slicoss.c | 125 ++++++++++++++++++-------------------- 3 files changed, 65 insertions(+), 80 deletions(-)
drivers/staging/slicoss/TODO +0 -1
@@ -25,7 +25,6 @@ TODO: - state variables for things that are easily available and shouldn't be kept in card structure, cardnum, ... slotnumber, events, ... - - get rid of slic_spinlock wrapper - volatile == bad design => bad code - locking too fine grained, not designed just throw more locks at problem
drivers/staging/slicoss/slic.h +7 -12
@@ -56,11 +56,6 @@ static u32 OasisRcvUCodeLen = 512;static u32 GBRcvUCodeLen =512 ;#define SECTION_SIZE 65536 -struct slic_spinlock { -spinlock_t lock; -unsigned long flags; -}; -#define SLIC_RSPQ_PAGES_GB 10#define SLIC_RSPQ_BUFSINPAGE (PAGE_SIZE / SLIC_RSPBUF_SIZE)
@@ -165,7 +160,7 @@ struct slic_cmdqueue {struct slic_hostcmd *head;struct slic_hostcmd *tail;int count; -struct slic_spinlock lock; +spinlock_t lock; };#define SLIC_MAX_CARDS 32
@@ -346,7 +341,7 @@ struct physcard { };struct base_driver { -struct slic_spinlock driver_lock; +spinlock_t driver_lock;u32 num_slic_cards;u32 num_slic_ports;u32 num_slic_ports_active;
@@ -401,8 +396,8 @@ struct adapter {uint card_size;uint chipid;struct net_device *netdev; -struct slic_spinlock adapter_lock; -struct slic_spinlock reset_lock; +spinlock_t adapter_lock; +spinlock_t reset_lock;struct pci_dev *pcidev;uint busnumber;uint slotnumber;
@@ -441,8 +436,8 @@ struct adapter {u32 pingtimerset;struct timer_list loadtimer;u32 loadtimerset; -struct slic_spinlock upr_lock; -struct slic_spinlock bit64reglock; +spinlock_t upr_lock; +spinlock_t bit64reglock;struct slic_rspqueue rspqueue;struct slic_rcvqueue rcvqueue;struct slic_cmdqueue cmdq_free;
@@ -457,7 +452,7 @@ struct adapter {/* Free object handles*/ struct slic_handle *pfree_slic_handles;/* Object handle list lock*/ -struct slic_spinlock handle_lock; +spinlock_t handle_lock;ushort slic_handle_ix;u32 xmitq_full;
drivers/staging/slicoss/slicoss.c +58 -67
357 lines not on this page · raw message
Signature · 1 line
2.4.0
PATCH 1/1 staging: slicoss: fix occasionally writing out only half of a dma address
curaddrupper caches the last written upper 32-bits of a dma address (the device has one register for the upper 32-bits of all dma address registers). The problem is, not every dma address write checks and sets curaddrupper. This causes the driver to occasionally not write the upper 32-bits of a dma address to the device when it really should.
I've seen this manifest particularly when the driver is trying to read config data from the device (RCONFIG) in order to checksum the device's eeprom. Since the device writes its config data to the wrong DMA address the driver reads 0 as the eeprom size and the eeprom checksum fails.
This patch fixes the issue by removing curaddrupper and always writing the upper 32-bits of dma addresses.
--- drivers/staging/slicoss/slic.h | 1 - drivers/staging/slicoss/slicoss.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-)
drivers/staging/slicoss/slic.h +0 -1
@@ -414,7 +414,6 @@ struct adapter {u32 intrregistered;uint isp_initialized;uint gennumber; -u32 curaddrupper;struct slic_shmem *pshmem;dma_addr_t phys_shmem;u32 isrcopy;
drivers/staging/slicoss/slicoss.c +1 -4
@@ -147,10 +147,7 @@ static inline void slic_reg64_write(struct adapter *adapter, void __iomem *reg,unsigned long flags;spin_lock_irqsave (&adapter->bit64reglock, flags); -if (paddrh != adapter->curaddrupper) { - adapter->curaddrupper = paddrh; -writel (paddrh, regh); - } +writel (paddrh, regh);writel (value, reg);if (flush)mb ();
Signature · 1 line
2.4.0
Quoted 2 lines · David Matlack
As per TODO. This commit introduces no functional changes.
It's easy for me to imagine that big shared "flags" variable in the original code is racy so it might introduce a bugfix. :)
Nice improvement.
regards,
dan carpenter