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: <1687325.7ZoAM7eIpP@n95hx1g2>
Date:   Tue, 13 Oct 2020 13:58:02 +0200
From:   Christian Eggers <ceggers@...i.de>
To:     Sascha Hauer <s.hauer@...gutronix.de>
CC:     Mark Brown <broonie@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        <linux-spi@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] spi: imx: Revert "spi: imx: enable runtime pm support"

On Monday, 12 October 2020, 16:07:53 CEST, Sascha Hauer wrote:
> On Fri, Oct 09, 2020 at 09:48:29AM +0200, Christian Eggers wrote:
> 
> 525c9e5a32bd introduced pm_runtime support for the i.MX SPI driver. With
> this pm_runtime is used to bring up the clocks initially. When CONFIG_PM
> is disabled the clocks are no longer enabled and the driver doesn't work
> anymore. Fix this by enabling the clocks in the probe function and
> telling pm_runtime that the device is active using
> pm_runtime_set_active().
> 
> Fixes: 525c9e5a32bd spi: imx: enable runtime pm support
> Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
> ---
>  drivers/spi/spi-imx.c | 23 +++++++++++++++--------
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index 38a5f1304cec..c796e937dc6a 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -1674,15 +1674,18 @@ static int spi_imx_probe(struct platform_device
> *pdev) goto out_master_put;
>  	}
> 
> -	pm_runtime_enable(spi_imx->dev);
> +	ret = clk_prepare_enable(spi_imx->clk_per);
> +	if (ret)
> +		goto out_master_put;
> +
> +	ret = clk_prepare_enable(spi_imx->clk_ipg);
> +	if (ret)
> +		goto out_put_per;
> +
>  	pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
>  	pm_runtime_use_autosuspend(spi_imx->dev);
> -
> -	ret = pm_runtime_get_sync(spi_imx->dev);
> -	if (ret < 0) {
> -		dev_err(spi_imx->dev, "failed to enable clock\n");
> -		goto out_runtime_pm_put;
> -	}
> +	pm_runtime_set_active(spi_imx->dev);
> +	pm_runtime_enable(spi_imx->dev);
> 
>  	spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
>  	/*
> @@ -1719,8 +1722,12 @@ static int spi_imx_probe(struct platform_device
> *pdev)
> 
>  out_runtime_pm_put:
>  	pm_runtime_dont_use_autosuspend(spi_imx->dev);
> -	pm_runtime_put_sync(spi_imx->dev);
> +	pm_runtime_set_suspended(&pdev->dev);
>  	pm_runtime_disable(spi_imx->dev);
> +
> +	clk_disable_unprepare(spi_imx->clk_ipg);
> +out_put_per:
> +	clk_disable_unprepare(spi_imx->clk_per);
>  out_master_put:
>  	spi_master_put(master);

With this patch applied, my system (!CONFIG_PM) doesn't freeze anymore when 
the spi-imx driver is loaded.

Thank you very much!

Tested-by: Christian Eggers <ceggers@...i.de>
[tested for !CONFIG_PM only]
Cc: stable@...r.kernel.org  # 5.9.x only



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ