media: rcar-vin: use pm_runtime_resume_and_get()
Commit dd8088d5a8
("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
added pm_runtime_resume_and_get() in order to automatically handle
dev->power.usage_count decrement on errors.
Use the new API, in order to cleanup the error check logic.
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
71aeaedc96
commit
334fe327a8
|
@ -406,10 +406,17 @@ static void rcsi2_enter_standby(struct rcar_csi2 *priv)
|
|||
pm_runtime_put(priv->dev);
|
||||
}
|
||||
|
||||
static void rcsi2_exit_standby(struct rcar_csi2 *priv)
|
||||
static int rcsi2_exit_standby(struct rcar_csi2 *priv)
|
||||
{
|
||||
pm_runtime_get_sync(priv->dev);
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_resume_and_get(priv->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
reset_control_deassert(priv->rstc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rcsi2_wait_phy_start(struct rcar_csi2 *priv,
|
||||
|
@ -657,7 +664,9 @@ static int rcsi2_start(struct rcar_csi2 *priv)
|
|||
{
|
||||
int ret;
|
||||
|
||||
rcsi2_exit_standby(priv);
|
||||
ret = rcsi2_exit_standby(priv);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = rcsi2_start_receiver(priv);
|
||||
if (ret) {
|
||||
|
|
|
@ -1458,11 +1458,9 @@ int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel)
|
|||
u32 vnmc;
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_get_sync(vin->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(vin->dev);
|
||||
ret = pm_runtime_resume_and_get(vin->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Make register writes take effect immediately. */
|
||||
vnmc = rvin_read(vin, VNMC_REG);
|
||||
|
|
|
@ -870,11 +870,9 @@ static int rvin_open(struct file *file)
|
|||
struct rvin_dev *vin = video_drvdata(file);
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_get_sync(vin->dev);
|
||||
if (ret < 0) {
|
||||
pm_runtime_put_noidle(vin->dev);
|
||||
ret = pm_runtime_resume_and_get(vin->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = mutex_lock_interruptible(&vin->lock);
|
||||
if (ret)
|
||||
|
|
Loading…
Reference in New Issue