Staging: poch: Fine grained locking
authorVijay Kumar <vijaykumar@bravegnu.org>
Wed, 29 Oct 2008 03:28:40 +0000 (08:58 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Jan 2009 21:52:04 +0000 (13:52 -0800)
Lock only the portion of code that does register access.

Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/poch/poch.c

index 3ecbd7c43c488d4806d0e7bfb71c6f5911c26f90..1f14792b917e367802d37d322f8abd3b0888238a 100644 (file)
@@ -485,27 +485,30 @@ static void channel_dma_init(struct channel_info *channel)
        /* The DMA address page register is shared between the RX and
         * TX channels, so acquire lock.
         */
-       spin_lock(channel->iomem_lock);
        for (i = 0; i < channel->group_count; i++) {
                page = i / 32;
                group_in_page = i % 32;
 
                group_reg = group_regs_base + (group_in_page * 4);
 
+               spin_lock(channel->iomem_lock);
                iowrite32(page, fpga + FPGA_DMA_ADR_PAGE_REG);
                iowrite32(channel->groups[i].dma_addr, fpga + group_reg);
+               spin_unlock(channel->iomem_lock);
        }
+
        for (i = 0; i < channel->group_count; i++) {
                page = i / 32;
                group_in_page = i % 32;
 
                group_reg = group_regs_base + (group_in_page * 4);
 
+               spin_lock(channel->iomem_lock);
                iowrite32(page, fpga + FPGA_DMA_ADR_PAGE_REG);
                printk(KERN_INFO PFX "%ld: read dma_addr: 0x%x\n", i,
                       ioread32(fpga + group_reg));
+               spin_unlock(channel->iomem_lock);
        }
-       spin_unlock(channel->iomem_lock);
 
 }