Date:2010-06-27 23:57:06 (13 years 5 months ago)
Author:Lars C.
Commit:0483cdc4a7ea680020f5195197fc34a7f7ed7d67
Message:mmc: jz4740: Use bitops to modify waiting flag instead of using a spinlock

Files: drivers/mmc/host/jz4740_mmc.c (5 diffs)

Change Details

drivers/mmc/host/jz4740_mmc.c
2424#include <linux/clk.h>
2525#include <linux/mmc/jz4740_mmc.h>
2626
27#include <linux/bitops.h>
2728#include <linux/gpio.h>
2829#include <asm/mach-jz4740/gpio.h>
2930#include <asm/cacheflush.h>
3031#include <linux/dma-mapping.h>
3132
33
3234#define JZ_REG_MMC_STRPCL 0x00
3335#define JZ_REG_MMC_STATUS 0x04
3436#define JZ_REG_MMC_CLKRT 0x08
...... 
186188    spin_lock_irqsave(&host->lock, flags);
187189    req = host->req;
188190    host->req = NULL;
189    host->waiting = 0;
191    clear_bit(0, &host->waiting);
190192    spin_unlock_irqrestore(&host->lock, flags);
191193
192194    if (!unlikely(req))
...... 
371373static void jz4740_mmc_timeout(unsigned long data)
372374{
373375    struct jz4740_mmc_host *host = (struct jz4740_mmc_host *)data;
374    unsigned long flags;
375376
376    spin_lock_irqsave(&host->lock, flags);
377    if (!host->waiting) {
378        spin_unlock_irqrestore(&host->lock, flags);
377    if (!test_and_clear_bit(0, &host->waiting))
379378        return;
380    }
381
382    host->waiting = 0;
383
384    spin_unlock_irqrestore(&host->lock, flags);
385379
386380    host->req->cmd->error = -ETIMEDOUT;
387381    jz4740_mmc_request_done(host);
...... 
427421    if (!host->req || !host->cmd)
428422        goto handled;
429423
430    spin_lock_irqsave(&host->lock, flags);
431    if (!host->waiting) {
432        spin_unlock_irqrestore(&host->lock, flags);
424    if (!test_and_clear_bit(0, &host->waiting))
433425        goto handled;
434    }
435
436    host->waiting = 0;
437    spin_unlock_irqrestore(&host->lock, flags);
438426
439427    del_timer(&host->timeout_timer);
440428
...... 
548536    writel(cmd->arg, host->base + JZ_REG_MMC_ARG);
549537    writel(cmdat, host->base + JZ_REG_MMC_CMDAT);
550538
551    host->waiting = 1;
539    set_bit(0, &host->waiting);
552540    jz4740_mmc_clock_enable(host, 1);
553541    mod_timer(&host->timeout_timer, jiffies + 5*HZ);
554542}

Archive Download the corresponding diff file



interactive