media: atmel: properly get pm_runtime
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 23 Apr 2021 14:47:42 +0000 (16:47 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 10 May 2021 09:36:33 +0000 (11:36 +0200)
commitdd97908ee35096356fb4111bb77d5f94bcfe337d
tree1ba5f77a23c22fca98ec7bf32282c504a167ca23
parente6695c89b3d4595f60c9fe40e0938e085d15dd20
media: atmel: properly get pm_runtime

There are several issues in the way the atmel driver handles
pm_runtime_get_sync():

- it doesn't check return codes;
- it doesn't properly decrement the usage_count on all places;
- it starts streaming even if pm_runtime_get_sync() fails.
- while it tries to get pm_runtime at the clock enable logic,
  it doesn't check if the operation was suceeded.

Replace all occurrences of it to use the new kAPI:
pm_runtime_resume_and_get(), which ensures that, if the
return code is not negative, the usage_count was incremented.

With that, add additional checks when this is called, in order
to ensure that errors will be properly addressed.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/atmel/atmel-isc-base.c
drivers/media/platform/atmel/atmel-isi.c