lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200611141718.GA158633@chromium.org>
Date:   Thu, 11 Jun 2020 14:17:18 +0000
From:   Tomasz Figa <tfiga@...omium.org>
To:     Xia Jiang <xia.jiang@...iatek.com>
Cc:     Hans Verkuil <hverkuil-cisco@...all.nl>,
        Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Rick Chang <rick.chang@...iatek.com>,
        linux-media@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        srv_heupstream@...iatek.com, senozhatsky@...omium.org,
        mojahsu@...omium.org, drinkcat@...omium.org,
        maoguang.meng@...iatek.com, sj.huang@...iatek.com
Subject: Re: [PATCH RESEND v9 07/18] media: platform: Improve the
 implementation of the system PM ops

Hi Xia,

On Thu, Jun 04, 2020 at 05:05:42PM +0800, Xia Jiang wrote:
> Add v4l2_m2m_suspend() function call in mtk_jpeg_suspend() to make sure
> that the current frame is processed completely before suspend.
> Add v4l2_m2m_resume() function call in mtk_jpeg_resume() to unblock the
> driver from scheduling next frame.
> 
> Signed-off-by: Xia Jiang <xia.jiang@...iatek.com>
> ---
> v9: use v4l2_m2m_suspend() and v4l2_m2m_resume() to improve the
>     implemention of the system PM ops
> ---
>  drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

Thank you for the patch. Please see my comments inline.

> diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> index 7f74597262fc..49bdbf1c435f 100644
> --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> @@ -1208,10 +1208,13 @@ static __maybe_unused int mtk_jpeg_pm_resume(struct device *dev)
>  static __maybe_unused int mtk_jpeg_suspend(struct device *dev)
>  {
>  	int ret;
> +	struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
>  
>  	if (pm_runtime_suspended(dev))
>  		return 0;
>  
> +	v4l2_m2m_suspend(jpeg->m2m_dev);
> +
>  	ret = mtk_jpeg_pm_suspend(dev);
>  	return ret;
>  }

This could be simplified into:

{
	struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);

	v4l2_m2m_suspend(jpeg->m2m_dev);
	return pm_runtime_force_suspend(dev);
}

> @@ -1219,12 +1222,15 @@ static __maybe_unused int mtk_jpeg_suspend(struct device *dev)
>  static __maybe_unused int mtk_jpeg_resume(struct device *dev)
>  {
>  	int ret;
> +	struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
>  
>  	if (pm_runtime_suspended(dev))
>  		return 0;
>  
>  	ret = mtk_jpeg_pm_resume(dev);
>  
> +	v4l2_m2m_resume(jpeg->m2m_dev);
> +
>  	return ret;
>  }

Similarly here:

{
	struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
	int ret;

	ret = pm_runtime_force_resume(dev);
	if (ret < 0)
		return ret;

	v4l2_m2m_resume(jpeg->m2m_dev);
}

The pm_runtime_force_*() helpers will make sure that the right runtime PM
state is restored.

Best regards,
Tomasz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ