• Bartlomiej Zolnierkiewicz's avatar
    mmc: sdhci-s3c: fix runtime PM handling on sdhci_add_host() failure · 221414db
    Bartlomiej Zolnierkiewicz authored
    Runtime Power Management handling for the sdhci_add_host() failure
    case in sdhci_s3c_probe() should match the code in sdhci_s3c_remove()
    (which uses pm_runtime_disable() call which matches the earlier
    pm_runtime_enable() one).  Fix it.
    
    This patch fixes "BUG: spinlock bad magic on CPU#0, swapper/0/1" and
    "Unbalanced pm_runtime_enable!" warnings.
    
    >From the kernel log:
    ...
    [    1.659631] s3c-sdhci 12530000.sdhci: sdhci_add_host() failed
    [    1.665096] BUG: spinlock bad magic on CPU#0, swapper/0/1
    [    1.670433]  lock: 0xea01e484, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
    [    1.677895] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.16.0-next-20140804-00008-ga59480f-dirty #707
    [    1.687037] [<c0013ae4>] (unwind_backtrace) from [<c0010d70>] (show_stack+0x10/0x14)
    [    1.694740] [<c0010d70>] (show_stack) from [<c04050c8>] (dump_stack+0x68/0xb8)
    [    1.701948] [<c04050c8>] (dump_stack) from [<c0052558>] (do_raw_spin_lock+0x15c/0x1a4)
    [    1.709848] [<c0052558>] (do_raw_spin_lock) from [<c040a630>] (_raw_spin_lock_irqsave+0x20/0x28)
    [    1.718619] [<c040a630>] (_raw_spin_lock_irqsave) from [<c030d7d0>] (sdhci_do_set_ios+0x1c/0x5cc)
    [    1.727464] [<c030d7d0>] (sdhci_do_set_ios) from [<c030ddfc>] (sdhci_runtime_resume_host+0x50/0x104)
    [    1.736574] [<c030ddfc>] (sdhci_runtime_resume_host) from [<c02462dc>] (pm_generic_runtime_resume+0x2c/0x40)
    [    1.746383] [<c02462dc>] (pm_generic_runtime_resume) from [<c0247898>] (__rpm_callback+0x34/0x70)
    [    1.755233] [<c0247898>] (__rpm_callback) from [<c02478fc>] (rpm_callback+0x28/0x88)
    [    1.762958] [<c02478fc>] (rpm_callback) from [<c02486f0>] (rpm_resume+0x384/0x4ec)
    [    1.770511] [<c02486f0>] (rpm_resume) from [<c02488b0>] (pm_runtime_forbid+0x58/0x64)
    [    1.778325] [<c02488b0>] (pm_runtime_forbid) from [<c030ea70>] (sdhci_s3c_probe+0x4a4/0x540)
    [    1.786749] [<c030ea70>] (sdhci_s3c_probe) from [<c02429cc>] (platform_drv_probe+0x2c/0x5c)
    [    1.795076] [<c02429cc>] (platform_drv_probe) from [<c02415f0>] (driver_probe_device+0x114/0x234)
    [    1.803929] [<c02415f0>] (driver_probe_device) from [<c024179c>] (__driver_attach+0x8c/0x90)
    [    1.812347] [<c024179c>] (__driver_attach) from [<c023ffb4>] (bus_for_each_dev+0x54/0x88)
    [    1.820506] [<c023ffb4>] (bus_for_each_dev) from [<c0240df8>] (bus_add_driver+0xd8/0x1cc)
    [    1.828665] [<c0240df8>] (bus_add_driver) from [<c0241db8>] (driver_register+0x78/0xf4)
    [    1.836652] [<c0241db8>] (driver_register) from [<c00088a4>] (do_one_initcall+0x80/0x1d0)
    [    1.844816] [<c00088a4>] (do_one_initcall) from [<c059ac94>] (kernel_init_freeable+0x108/0x1d4)
    [    1.853503] [<c059ac94>] (kernel_init_freeable) from [<c0401300>] (kernel_init+0x8/0xe4)
    [    1.861568] [<c0401300>] (kernel_init) from [<c000e538>] (ret_from_fork+0x14/0x3c)
    [    1.869582] platform 12530000.sdhci: Driver s3c-sdhci requests probe deferral
    ...
    [    1.997047] s3c-sdhci 12530000.sdhci: Unbalanced pm_runtime_enable!
    ...
    [    2.027235] s3c-sdhci 12530000.sdhci: sdhci_add_host() failed
    [    2.032884] platform 12530000.sdhci: Driver s3c-sdhci requests probe deferral
    ...
    
    Tested on Hardkernel's Exynos4412 based ODROID-U3 board.
    
    Fixes: 9f4e8151 ("mmc: sdhci-s3c: Enable runtime power management")
    Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Cc: Jaehoon Chung <jh80.chung@samsung.com>
    Cc: Ben Dooks <ben-linux@fluff.org>
    Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
    Acked-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
    Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    221414db
sdhci-s3c.c 18.7 KB