| 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 | ||
|---|---|---|
| 24 | 24 | #include <linux/clk.h> |
| 25 | 25 | #include <linux/mmc/jz4740_mmc.h> |
| 26 | 26 | |
| 27 | #include <linux/bitops.h> | |
| 27 | 28 | #include <linux/gpio.h> |
| 28 | 29 | #include <asm/mach-jz4740/gpio.h> |
| 29 | 30 | #include <asm/cacheflush.h> |
| 30 | 31 | #include <linux/dma-mapping.h> |
| 31 | 32 | |
| 33 | ||
| 32 | 34 | #define JZ_REG_MMC_STRPCL 0x00 |
| 33 | 35 | #define JZ_REG_MMC_STATUS 0x04 |
| 34 | 36 | #define JZ_REG_MMC_CLKRT 0x08 |
| ... | ... | |
| 186 | 188 | spin_lock_irqsave(&host->lock, flags); |
| 187 | 189 | req = host->req; |
| 188 | 190 | host->req = NULL; |
| 189 | host->waiting = 0; | |
| 191 | clear_bit(0, &host->waiting); | |
| 190 | 192 | spin_unlock_irqrestore(&host->lock, flags); |
| 191 | 193 | |
| 192 | 194 | if (!unlikely(req)) |
| ... | ... | |
| 371 | 373 | static void jz4740_mmc_timeout(unsigned long data) |
| 372 | 374 | { |
| 373 | 375 | struct jz4740_mmc_host *host = (struct jz4740_mmc_host *)data; |
| 374 | unsigned long flags; | |
| 375 | 376 | |
| 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)) | |
| 379 | 378 | return; |
| 380 | } | |
| 381 | ||
| 382 | host->waiting = 0; | |
| 383 | ||
| 384 | spin_unlock_irqrestore(&host->lock, flags); | |
| 385 | 379 | |
| 386 | 380 | host->req->cmd->error = -ETIMEDOUT; |
| 387 | 381 | jz4740_mmc_request_done(host); |
| ... | ... | |
| 427 | 421 | if (!host->req || !host->cmd) |
| 428 | 422 | goto handled; |
| 429 | 423 | |
| 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)) | |
| 433 | 425 | goto handled; |
| 434 | } | |
| 435 | ||
| 436 | host->waiting = 0; | |
| 437 | spin_unlock_irqrestore(&host->lock, flags); | |
| 438 | 426 | |
| 439 | 427 | del_timer(&host->timeout_timer); |
| 440 | 428 | |
| ... | ... | |
| 548 | 536 | writel(cmd->arg, host->base + JZ_REG_MMC_ARG); |
| 549 | 537 | writel(cmdat, host->base + JZ_REG_MMC_CMDAT); |
| 550 | 538 | |
| 551 | host->waiting = 1; | |
| 539 | set_bit(0, &host->waiting); | |
| 552 | 540 | jz4740_mmc_clock_enable(host, 1); |
| 553 | 541 | mod_timer(&host->timeout_timer, jiffies + 5*HZ); |
| 554 | 542 | } |
Branches:
ben-wpan
ben-wpan-stefan
5396a9238205f20f811ea57898980d3ca82df0b6
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9
