]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
memstick: Prevent memstick host from getting runtime suspended during card detection
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Mon, 5 Nov 2018 08:45:04 +0000 (16:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 19:02:20 +0000 (20:02 +0100)
commita759ce39ec9b6ddd5396f1963f77a040e2ca00c7
tree8a37eb3bd05ffeb651f615f206e482169314b7c7
parent7011f77137659a095697e3bbbe007223d2e0ceb4
memstick: Prevent memstick host from getting runtime suspended during card detection

[ Upstream commit e03e303edf1c63e6dd455ccd568c74e93ef3ba8c ]

We can use MEMSTICK_POWER_{ON,OFF} along with pm_runtime_{get,put}
helpers to let memstick host support runtime pm.

The rpm count may go down to zero before the memstick host powers on, so
the host can be runtime suspended.

So before doing card detection, increment the rpm count to avoid the
host gets runtime suspended. Balance the rpm count after card detection
is done.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/memstick/core/memstick.c