linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: reset: at91-reset: Optimize at91_reset()
@ 2025-03-07  5:38 Alexander Shiyan
  2025-04-01 12:52 ` Alexandre Belloni
  2025-04-27 22:50 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Shiyan @ 2025-03-07  5:38 UTC (permalink / raw)
  To: linux-pm
  Cc: Sebastian Reichel, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Alexander Shiyan

This patch adds a small optimization to the low-level at91_reset()
function, which includes:
- Removes the extra branch, since the following store operations
  already have proper condition checks.
- Removes the definition of the clobber register r4, since it is
  no longer used in the code.

Fixes: fcd0532fac2a ("power: reset: at91-reset: make at91sam9g45_restart() generic")
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/power/reset/at91-reset.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 036b18a1f90f..511f5a8f8961 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -129,12 +129,11 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
 		"	str	%4, [%0, %6]\n\t"
 		/* Disable SDRAM1 accesses */
 		"1:	tst	%1, #0\n\t"
-		"	beq	2f\n\t"
 		"	strne	%3, [%1, #" __stringify(AT91_DDRSDRC_RTR) "]\n\t"
 		/* Power down SDRAM1 */
 		"	strne	%4, [%1, %6]\n\t"
 		/* Reset CPU */
-		"2:	str	%5, [%2, #" __stringify(AT91_RSTC_CR) "]\n\t"
+		"	str	%5, [%2, #" __stringify(AT91_RSTC_CR) "]\n\t"
 
 		"	b	.\n\t"
 		:
@@ -145,7 +144,7 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
 		  "r" cpu_to_le32(AT91_DDRSDRC_LPCB_POWER_DOWN),
 		  "r" (reset->data->reset_args),
 		  "r" (reset->ramc_lpr)
-		: "r4");
+	);
 
 	return NOTIFY_DONE;
 }
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: reset: at91-reset: Optimize at91_reset()
  2025-03-07  5:38 [PATCH] power: reset: at91-reset: Optimize at91_reset() Alexander Shiyan
@ 2025-04-01 12:52 ` Alexandre Belloni
  2025-04-27 22:50 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2025-04-01 12:52 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: linux-pm, Sebastian Reichel, Nicolas Ferre, Claudiu Beznea

On 07/03/2025 08:38:09+0300, Alexander Shiyan wrote:
> This patch adds a small optimization to the low-level at91_reset()
> function, which includes:
> - Removes the extra branch, since the following store operations
>   already have proper condition checks.
> - Removes the definition of the clobber register r4, since it is
>   no longer used in the code.
> 
> Fixes: fcd0532fac2a ("power: reset: at91-reset: make at91sam9g45_restart() generic")
> Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/power/reset/at91-reset.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
> index 036b18a1f90f..511f5a8f8961 100644
> --- a/drivers/power/reset/at91-reset.c
> +++ b/drivers/power/reset/at91-reset.c
> @@ -129,12 +129,11 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
>  		"	str	%4, [%0, %6]\n\t"
>  		/* Disable SDRAM1 accesses */
>  		"1:	tst	%1, #0\n\t"
> -		"	beq	2f\n\t"
>  		"	strne	%3, [%1, #" __stringify(AT91_DDRSDRC_RTR) "]\n\t"
>  		/* Power down SDRAM1 */
>  		"	strne	%4, [%1, %6]\n\t"
>  		/* Reset CPU */
> -		"2:	str	%5, [%2, #" __stringify(AT91_RSTC_CR) "]\n\t"
> +		"	str	%5, [%2, #" __stringify(AT91_RSTC_CR) "]\n\t"
>  
>  		"	b	.\n\t"
>  		:
> @@ -145,7 +144,7 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
>  		  "r" cpu_to_le32(AT91_DDRSDRC_LPCB_POWER_DOWN),
>  		  "r" (reset->data->reset_args),
>  		  "r" (reset->ramc_lpr)
> -		: "r4");
> +	);
>  
>  	return NOTIFY_DONE;
>  }
> -- 
> 2.39.1
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: reset: at91-reset: Optimize at91_reset()
  2025-03-07  5:38 [PATCH] power: reset: at91-reset: Optimize at91_reset() Alexander Shiyan
  2025-04-01 12:52 ` Alexandre Belloni
@ 2025-04-27 22:50 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2025-04-27 22:50 UTC (permalink / raw)
  To: linux-pm, Alexander Shiyan
  Cc: Sebastian Reichel, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea


On Fri, 07 Mar 2025 08:38:09 +0300, Alexander Shiyan wrote:
> This patch adds a small optimization to the low-level at91_reset()
> function, which includes:
> - Removes the extra branch, since the following store operations
>   already have proper condition checks.
> - Removes the definition of the clobber register r4, since it is
>   no longer used in the code.
> 
> [...]

Applied, thanks!

[1/1] power: reset: at91-reset: Optimize at91_reset()
      commit: 62d48983f215bf1dd48665913318101fa3414dcf

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-27 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07  5:38 [PATCH] power: reset: at91-reset: Optimize at91_reset() Alexander Shiyan
2025-04-01 12:52 ` Alexandre Belloni
2025-04-27 22:50 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).