[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cdc22071-9e61-1098-803a-d7c674972b6f@gmail.com>
Date: Fri, 31 Jul 2020 15:06:41 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Sowjanya Komatineni <skomatineni@...dia.com>,
thierry.reding@...il.com, jonathanh@...dia.com, frankc@...dia.com,
hverkuil@...all.nl, sakari.ailus@....fi, robh+dt@...nel.org,
helen.koike@...labora.com
Cc: sboyd@...nel.org, gregkh@...uxfoundation.org,
linux-media@...r.kernel.org, devicetree@...r.kernel.org,
linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org
Subject: Re: [RFC PATCH v6 05/10] media: tegra-video: Separate CSI stream
enable and disable implementations
31.07.2020 12:02, Sowjanya Komatineni пишет:
> This patch separates implementation of CSI stream enable and disable
> into separate functions for readability.
>
> Signed-off-by: Sowjanya Komatineni <skomatineni@...dia.com>
> ---
> drivers/staging/media/tegra-video/csi.c | 51 ++++++++++++++++++++++-----------
> 1 file changed, 35 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c
> index fb667df..cfe6187 100644
> --- a/drivers/staging/media/tegra-video/csi.c
> +++ b/drivers/staging/media/tegra-video/csi.c
> @@ -232,34 +232,53 @@ static int tegra_csi_g_frame_interval(struct v4l2_subdev *subdev,
> return 0;
> }
>
> -static int tegra_csi_s_stream(struct v4l2_subdev *subdev, int enable)
> +static int tegra_csi_enable_stream(struct v4l2_subdev *subdev)
> {
> struct tegra_vi_channel *chan = v4l2_get_subdev_hostdata(subdev);
> struct tegra_csi_channel *csi_chan = to_csi_chan(subdev);
> struct tegra_csi *csi = csi_chan->csi;
> - int ret = 0;
> + int ret;
> +
> + ret = pm_runtime_get_sync(csi->dev);
> + if (ret < 0) {
> + dev_err(csi->dev, "failed to get runtime PM: %d\n", ret);
> + pm_runtime_put_noidle(csi->dev);
> + return ret;
> + }
>
> csi_chan->pg_mode = chan->pg_mode;
> - if (enable) {
> - ret = pm_runtime_get_sync(csi->dev);
> - if (ret < 0) {
> - dev_err(csi->dev,
> - "failed to get runtime PM: %d\n", ret);
> - pm_runtime_put_noidle(csi->dev);
> - return ret;
> - }
> + ret = csi->ops->csi_start_streaming(csi_chan);
> + if (ret < 0)
> + goto rpm_put;
>
> - ret = csi->ops->csi_start_streaming(csi_chan);
> - if (ret < 0)
> - goto rpm_put;
> + return 0;
>
> - return 0;
> - }
> +rpm_put:
> + pm_runtime_put(csi->dev);
> + return ret;
> +}
> +
> +static int tegra_csi_disable_stream(struct v4l2_subdev *subdev)
> +{
> + struct tegra_csi_channel *csi_chan = to_csi_chan(subdev);
> + struct tegra_csi *csi = csi_chan->csi;
>
> csi->ops->csi_stop_streaming(csi_chan);
>
> -rpm_put:
> pm_runtime_put(csi->dev);
> +
> + return 0;
> +}
> +
> +static int tegra_csi_s_stream(struct v4l2_subdev *subdev, int enable)
> +{
> + int ret;
> +
> + if (enable)
> + ret = tegra_csi_enable_stream(subdev);
> + else
> + ret = tegra_csi_disable_stream(subdev);
> +
> return ret;
> }
>
>
Thanks!
Reviewed-by: Dmitry Osipenko <digetx@...il.com>
Powered by blists - more mailing lists