diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2012-01-30 11:39:30 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-03-08 07:37:27 -0300 |
commit | bd7d8888e99d67f778f4ee272346322c0b9cb378 (patch) | |
tree | 36f4a66fe272de536d702d1c440d3047c36fb2de /drivers/media/video/s5p-fimc/mipi-csis.c | |
parent | 479e3492a262196631d69a9245a45420a354bec5 (diff) |
[media] s5p-fimc: convert to clk_prepare()/clk_unprepare()
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s5p-fimc/mipi-csis.c')
-rw-r--r-- | drivers/media/video/s5p-fimc/mipi-csis.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/media/video/s5p-fimc/mipi-csis.c b/drivers/media/video/s5p-fimc/mipi-csis.c index 130335cf62f..58c40750abc 100644 --- a/drivers/media/video/s5p-fimc/mipi-csis.c +++ b/drivers/media/video/s5p-fimc/mipi-csis.c @@ -258,26 +258,36 @@ static void s5pcsis_clk_put(struct csis_state *state) { int i; - for (i = 0; i < NUM_CSIS_CLOCKS; i++) - if (!IS_ERR_OR_NULL(state->clock[i])) - clk_put(state->clock[i]); + for (i = 0; i < NUM_CSIS_CLOCKS; i++) { + if (IS_ERR_OR_NULL(state->clock[i])) + continue; + clk_unprepare(state->clock[i]); + clk_put(state->clock[i]); + state->clock[i] = NULL; + } } static int s5pcsis_clk_get(struct csis_state *state) { struct device *dev = &state->pdev->dev; - int i; + int i, ret; for (i = 0; i < NUM_CSIS_CLOCKS; i++) { state->clock[i] = clk_get(dev, csi_clock_name[i]); - if (IS_ERR(state->clock[i])) { - s5pcsis_clk_put(state); - dev_err(dev, "failed to get clock: %s\n", - csi_clock_name[i]); - return -ENXIO; + if (IS_ERR(state->clock[i])) + goto err; + ret = clk_prepare(state->clock[i]); + if (ret < 0) { + clk_put(state->clock[i]); + state->clock[i] = NULL; + goto err; } } return 0; +err: + s5pcsis_clk_put(state); + dev_err(dev, "failed to get clock: %s\n", csi_clock_name[i]); + return -ENXIO; } static int s5pcsis_s_power(struct v4l2_subdev *sd, int on) |