media: mtk-vcodec: fix PM runtime get logic
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 23 Apr 2021 15:19:09 +0000 (17:19 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 10 May 2021 09:36:34 +0000 (11:36 +0200)
commit908711f542c17fe61e5d653da1beb8e5ab5c7b50
tree7308bcb944ef40bf8d53dd8d0dfb10f87fc7fee5
parent6e8b1526db164c9d4b9dacfb9bc48e365d7c4860
media: mtk-vcodec: fix PM runtime get logic

Currently, the driver just assumes that PM runtime logic
succeded resuming the device.

That may not be the case, as pm_runtime_get_sync()
can fail (but keeping the usage count incremented).

Replace the code to use pm_runtime_resume_and_get(),
and letting it return the error code.

This way, if mtk_vcodec_dec_pw_on() fails, the logic
under fops_vcodec_open() will do the right thing and
return an error, instead of just assuming that the
device is ready to be used.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h