Commit 334fe327 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: rcar-vin: use pm_runtime_resume_and_get()

Commit dd8088d5 ("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: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 71aeaedc
...@@ -406,10 +406,17 @@ static void rcsi2_enter_standby(struct rcar_csi2 *priv) ...@@ -406,10 +406,17 @@ static void rcsi2_enter_standby(struct rcar_csi2 *priv)
pm_runtime_put(priv->dev); 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); reset_control_deassert(priv->rstc);
return 0;
} }
static int rcsi2_wait_phy_start(struct rcar_csi2 *priv, static int rcsi2_wait_phy_start(struct rcar_csi2 *priv,
...@@ -657,7 +664,9 @@ static int rcsi2_start(struct rcar_csi2 *priv) ...@@ -657,7 +664,9 @@ static int rcsi2_start(struct rcar_csi2 *priv)
{ {
int ret; int ret;
rcsi2_exit_standby(priv); ret = rcsi2_exit_standby(priv);
if (ret < 0)
return ret;
ret = rcsi2_start_receiver(priv); ret = rcsi2_start_receiver(priv);
if (ret) { if (ret) {
......
...@@ -1458,11 +1458,9 @@ int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel) ...@@ -1458,11 +1458,9 @@ int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel)
u32 vnmc; u32 vnmc;
int ret; int ret;
ret = pm_runtime_get_sync(vin->dev); ret = pm_runtime_resume_and_get(vin->dev);
if (ret < 0) { if (ret < 0)
pm_runtime_put_noidle(vin->dev);
return ret; return ret;
}
/* Make register writes take effect immediately. */ /* Make register writes take effect immediately. */
vnmc = rvin_read(vin, VNMC_REG); vnmc = rvin_read(vin, VNMC_REG);
......
...@@ -870,11 +870,9 @@ static int rvin_open(struct file *file) ...@@ -870,11 +870,9 @@ static int rvin_open(struct file *file)
struct rvin_dev *vin = video_drvdata(file); struct rvin_dev *vin = video_drvdata(file);
int ret; int ret;
ret = pm_runtime_get_sync(vin->dev); ret = pm_runtime_resume_and_get(vin->dev);
if (ret < 0) { if (ret < 0)
pm_runtime_put_noidle(vin->dev);
return ret; return ret;
}
ret = mutex_lock_interruptible(&vin->lock); ret = mutex_lock_interruptible(&vin->lock);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment