lkml.org 
[lkml]   [2023]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 18/19] media: i2c: ov4689: Refactor ov4689_s_stream
Date
Remove repetitive pm_runtime_put calls in ov4689_s_stream function,
and call pm_runtime_put once at the end of the "on" branch if any
error occurred.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
---
drivers/media/i2c/ov4689.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)

diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c
index e21527ae0b10..034bd9077a3a 100644
--- a/drivers/media/i2c/ov4689.c
+++ b/drivers/media/i2c/ov4689.c
@@ -555,35 +555,26 @@ static int ov4689_s_stream(struct v4l2_subdev *sd, int on)
ov4689_common_regs,
ARRAY_SIZE(ov4689_common_regs),
NULL);
- if (ret) {
- pm_runtime_put(dev);
- goto unlock_and_return;
- }
+ if (ret)
+ goto cleanup_pm;

ret = ov4689_setup_timings(ov4689, sd_state);
- if (ret) {
- pm_runtime_put(dev);
- goto unlock_and_return;
- }
+ if (ret)
+ goto cleanup_pm;

ret = ov4689_setup_blc_anchors(ov4689, sd_state);
- if (ret) {
- pm_runtime_put(dev);
- goto unlock_and_return;
- }
+ if (ret)
+ goto cleanup_pm;

ret = __v4l2_ctrl_handler_setup(&ov4689->ctrl_handler);
- if (ret) {
- pm_runtime_put(dev);
- goto unlock_and_return;
- }
+ if (ret)
+ goto cleanup_pm;

ret = cci_write(ov4689->regmap, OV4689_REG_CTRL_MODE,
OV4689_MODE_STREAMING, NULL);
- if (ret) {
+cleanup_pm:
+ if (ret)
pm_runtime_put(dev);
- goto unlock_and_return;
- }
} else {
cci_write(ov4689->regmap, OV4689_REG_CTRL_MODE,
OV4689_MODE_SW_STANDBY, NULL);
--
2.43.0
\
 
 \ /
  Last update: 2023-12-11 18:52    [W:0.241 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site