diff mbox series

[1/1] soc: ti: omap-prm: use atomic iopoll instead of sleeping one

Message ID 20200514073718.17690-1-t-kristo@ti.com (mailing list archive)
State Mainlined
Commit 98ece19f247159a51003796ede7112fef2df5d7f
Headers show
Series [1/1] soc: ti: omap-prm: use atomic iopoll instead of sleeping one | expand

Commit Message

Tero Kristo May 14, 2020, 7:37 a.m. UTC
The reset handling APIs for omap-prm can be invoked PM runtime which
runs in atomic context. For this to work properly, switch to atomic
iopoll version instead of the current which can sleep. Otherwise,
this throws a "BUG: scheduling while atomic" warning. Issue is seen
rather easily when CONFIG_PREEMPT is enabled.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/soc/ti/omap_prm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Tony Lindgren May 19, 2020, 5:45 p.m. UTC | #1
* Tero Kristo <t-kristo@ti.com> [200514 00:38]:
> The reset handling APIs for omap-prm can be invoked PM runtime which
> runs in atomic context. For this to work properly, switch to atomic
> iopoll version instead of the current which can sleep. Otherwise,
> this throws a "BUG: scheduling while atomic" warning. Issue is seen
> rather easily when CONFIG_PREEMPT is enabled.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>

Santosh do you want me to pick this for fixes?

Regards,

Tony

> ---
>  drivers/soc/ti/omap_prm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
> index 96c6f777519c..c9b3f9ebf0bb 100644
> --- a/drivers/soc/ti/omap_prm.c
> +++ b/drivers/soc/ti/omap_prm.c
> @@ -256,10 +256,10 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev,
>  		goto exit;
>  
>  	/* wait for the status to be set */
> -	ret = readl_relaxed_poll_timeout(reset->prm->base +
> -					 reset->prm->data->rstst,
> -					 v, v & BIT(st_bit), 1,
> -					 OMAP_RESET_MAX_WAIT);
> +	ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
> +						 reset->prm->data->rstst,
> +						 v, v & BIT(st_bit), 1,
> +						 OMAP_RESET_MAX_WAIT);
>  	if (ret)
>  		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
>  		       reset->prm->data->name, id);
> -- 
> 2.17.1
> 
> --
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
>
Santosh Shilimkar May 19, 2020, 6:04 p.m. UTC | #2
On 5/19/20 10:45 AM, Tony Lindgren wrote:
> * Tero Kristo <t-kristo@ti.com> [200514 00:38]:
>> The reset handling APIs for omap-prm can be invoked PM runtime which
>> runs in atomic context. For this to work properly, switch to atomic
>> iopoll version instead of the current which can sleep. Otherwise,
>> this throws a "BUG: scheduling while atomic" warning. Issue is seen
>> rather easily when CONFIG_PREEMPT is enabled.
>>
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> 
> Santosh do you want me to pick this for fixes?
> 
Sure Tony. Thanks !!

Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
diff mbox series

Patch

diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
index 96c6f777519c..c9b3f9ebf0bb 100644
--- a/drivers/soc/ti/omap_prm.c
+++ b/drivers/soc/ti/omap_prm.c
@@ -256,10 +256,10 @@  static int omap_reset_deassert(struct reset_controller_dev *rcdev,
 		goto exit;
 
 	/* wait for the status to be set */
-	ret = readl_relaxed_poll_timeout(reset->prm->base +
-					 reset->prm->data->rstst,
-					 v, v & BIT(st_bit), 1,
-					 OMAP_RESET_MAX_WAIT);
+	ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
+						 reset->prm->data->rstst,
+						 v, v & BIT(st_bit), 1,
+						 OMAP_RESET_MAX_WAIT);
 	if (ret)
 		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
 		       reset->prm->data->name, id);