mmc: sdhci: don't try to do anything during power off
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 25 Aug 2011 11:13:49 +0000 (12:13 +0100)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:38:45 +0000 (12:38 -0800)
commit9d40f903db098a3c4283a8d077423e9ba535de80
tree7adeb7558eb0e7565cfc2e5169a9209a625be327
parentf7b0a023c6d01761b4c251593e5a0d5528779e1d
mmc: sdhci: don't try to do anything during power off

The commit c5d3189 ("sdhci: Add runtime pm support for sdhci-pci") brings
runtime pm support partially. Due to this we could get a traceback:

<2>[    3.954232] kernel BUG at /home/ash/work/linux/drivers/mmc/host/sdhci.c:1155!
<0>[    3.954253] invalid opcode: 0000 [#1] PREEMPT SMP
<4>[    3.954282] Modules linked in:
<4>[    3.954299]
<4>[    3.954316] Pid: 10, comm: kworker/0:1 Not tainted 3.0.0+ #669
<4>[    3.954345] EIP: 0060:[<c12e8f15>] EFLAGS: 00010083 CPU: 0
<4>[    3.954373] EIP is at sdhci_set_power+0x35/0xf0
<4>[    3.954390] EAX: f56607f0 EBX: 00000001 ECX: 00000000 EDX: 00000000
<4>[    3.954410] ESI: f5660698 EDI: f56608b0 EBP: f5c8be8c ESP: f5c8be88
<4>[    3.954430]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
<0>[    3.954451] Process kworker/0:1 (pid: 10, ti=f5c8a000 task=f5c88260 task.ti=f5c8a000)
<0>[    3.954468] Stack:
<4>[    3.954479]  f56607f0 f5c8bea4 c12e9e33 00000286 f56603b0 f5660698 00000000 f5c8bef4
<4>[    3.954531]  c12dbf01 00000002 f5c88260 00000006 f5c8becc c107fc56 f5c88260 c13a5fcd
<4>[    3.954583]  f56605fc f5c8bedc c107fd9c f56605fc 00000282 f5c8bee4 c107fdeb f5c8bef4
<0>[    3.954635] Call Trace:
<4>[    3.954660]  [<c12e9e33>] sdhci_set_ios+0x1d3/0x370
<4>[    3.954687]  [<c12dbf01>] mmc_gate_clock+0x71/0x120
<4>[    3.954712]  [<c107fc56>] ? mark_held_locks+0x56/0x80
<4>[    3.954739]  [<c13a5fcd>] ? _raw_spin_unlock_irqrestore+0x4d/0x60
<4>[    3.954763]  [<c107fd9c>] ? trace_hardirqs_on_caller+0x11c/0x160
<4>[    3.954787]  [<c107fdeb>] ? trace_hardirqs_on+0xb/0x10
<4>[    3.954813]  [<c12dd816>] mmc_host_clk_gate_delayed+0xd6/0x150
<4>[    3.954840]  [<c105f93a>] ? process_one_work+0xfa/0x550
<4>[    3.954866]  [<c12dd89d>] mmc_host_clk_gate_work+0xd/0x10
<4>[    3.954891]  [<c105f9b6>] process_one_work+0x176/0x550
<4>[    3.954915]  [<c105f93a>] ? process_one_work+0xfa/0x550
<4>[    3.954940]  [<c12dd890>] ? mmc_host_clk_gate_delayed+0x150/0x150
<4>[    3.954966]  [<c1061c2a>] worker_thread+0x12a/0x2c0
<4>[    3.954990]  [<c1061b00>] ? manage_workers.clone.18+0x100/0x100
<4>[    3.955015]  [<c1066244>] kthread+0x74/0x80
<4>[    3.955040]  [<c10661d0>] ? __init_kthread_worker+0x60/0x60
<4>[    3.955066]  [<c13a707a>] kernel_thread_helper+0x6/0xd
<0>[    3.955080] Code: 74 5c bb 01 00 00 00 d3 e3 81 fb 00 00 04 00 74 31 7e 1b 81 fb 00 00 10 00 0f 84 b7 00 00 00 81 fb 00 00 20 00 0f 84 ab 00 00 00 <0f> 0b 90 81 fb 80 00 00 00 0f 84 94 00 00 00 81 fb 00 00 02 00
<0>[    3.955377] EIP: [<c12e8f15>] sdhci_set_power+0x35/0xf0 SS:ESP 0068:f5c8be88

The patch corrects logic of the sdhci_set_ios() in case of clock = 0
(asynchronous power off).

Change-Id: If58b8d20f8d6ce001d316da323dcf17d681ff912
Reported-by: Alexander Shishin <alexander.shishkin@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Kristen Carlson Accardi <kristen@linux.intel.com>
drivers/mmc/host/sdhci.c