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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <072a27fd-2d7f-47f8-8f22-d2814e4ea1a1@microchip.com>
Date: Tue, 14 May 2024 10:41:22 +0000
From: <Hari.PrasathGE@...rochip.com>
To: <Manikandan.M@...rochip.com>, <sam@...nborg.org>, <bbrezillon@...nel.org>,
	<maarten.lankhorst@...ux.intel.com>, <mripard@...nel.org>,
	<tzimmermann@...e.de>, <airlied@...il.com>, <daniel@...ll.ch>,
	<Nicolas.Ferre@...rochip.com>, <alexandre.belloni@...tlin.com>,
	<claudiu.beznea@...on.dev>, <lee@...nel.org>,
	<dri-devel@...ts.freedesktop.org>, <linux-arm-kernel@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>
CC: <Balamanikandan.Gunasundar@...rochip.com>,
	<Durai.ManickamKR@...rochip.com>, <Nayabbasha.Sayed@...rochip.com>,
	<Dharma.B@...rochip.com>, <Varshini.Rajendran@...rochip.com>,
	<Balakrishnan.S@...rochip.com>, <Charan.Pedumuru@...rochip.com>
Subject: Re: [PATCH RESEND v9 3/8] drm: atmel_hlcdc: replace regmap_read with
 regmap_read_poll_timeout



On 4/24/24 11:03 AM, Manikandan Muralidharan wrote:
> Replace regmap_read with regmap_read_poll_timeout to neatly handle
> retries
> 

Reviewed-by: Hari Prasath Gujulan Elango <hari.prasathge@...rochip.com>

> Signed-off-by: Manikandan Muralidharan <manikandan.m@...rochip.com>
> ---
>   .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c    | 44 +++++++++++--------
>   1 file changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index cc5cf4c2faf7..b229692a27ca 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -203,19 +203,22 @@ static void atmel_hlcdc_crtc_atomic_disable(struct drm_crtc *c,
>   	pm_runtime_get_sync(dev->dev);
>   
>   	regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_DISP);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       (status & ATMEL_HLCDC_DISP))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     !(status & ATMEL_HLCDC_DISP),
> +				    10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register DISPSTS timeout\n");
>   
>   	regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_SYNC);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       (status & ATMEL_HLCDC_SYNC))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     !(status & ATMEL_HLCDC_SYNC),
> +				    10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register LCDSTS timeout\n");
>   
>   	regmap_write(regmap, ATMEL_HLCDC_DIS, ATMEL_HLCDC_PIXEL_CLK);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       (status & ATMEL_HLCDC_PIXEL_CLK))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     !(status & ATMEL_HLCDC_PIXEL_CLK),
> +				    10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register CLKSTS timeout\n");
>   
>   	clk_disable_unprepare(crtc->dc->hlcdc->sys_clk);
>   	pinctrl_pm_select_sleep_state(dev->dev);
> @@ -241,20 +244,23 @@ static void atmel_hlcdc_crtc_atomic_enable(struct drm_crtc *c,
>   	clk_prepare_enable(crtc->dc->hlcdc->sys_clk);
>   
>   	regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_PIXEL_CLK);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       !(status & ATMEL_HLCDC_PIXEL_CLK))
> -		cpu_relax();
> -
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     status & ATMEL_HLCDC_PIXEL_CLK,
> +				     10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register CLKSTS timeout\n");
>   
>   	regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_SYNC);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       !(status & ATMEL_HLCDC_SYNC))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     status & ATMEL_HLCDC_SYNC,
> +				     10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register LCDSTS timeout\n");
>   
>   	regmap_write(regmap, ATMEL_HLCDC_EN, ATMEL_HLCDC_DISP);
> -	while (!regmap_read(regmap, ATMEL_HLCDC_SR, &status) &&
> -	       !(status & ATMEL_HLCDC_DISP))
> -		cpu_relax();
> +	if (regmap_read_poll_timeout(regmap, ATMEL_HLCDC_SR, status,
> +				     status & ATMEL_HLCDC_DISP,
> +				     10, 1000))
> +		dev_warn(dev->dev, "Atmel LCDC status register DISPSTS timeout\n");
> +
>   
>   	pm_runtime_put_sync(dev->dev);
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ