Skip to contentSkip to conversation

power: reset: at91-reset: Optimize at91_reset()

PATCH Applied Alexander Shiyan 3 participants 3 messages Mar 7, 2025 – Apr 27, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: reset: at91-reset: Optimize at91_reset()

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")
---
 drivers/power/reset/at91-reset.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/power/reset/at91-reset.c +2 -3
index 036b18a1f90f..511f5a8f8961 100644
@@ -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;
 }
Signature · 1 line
2.39.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · 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")
Quoted 34 lines
---
 drivers/power/reset/at91-reset.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/power/reset/at91-reset.c +2 -3
index 036b18a1f90f..511f5a8f8961 100644
@@ -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;
 }
Signature · 1 line
2.39.1
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw
In reply to Alexander Shiyan
Quoted 8 lines · 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.

[...]

Applied, thanks!

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

      commit: 62d48983f215bf1dd48665913318101fa3414dcf

Best regards,

Signature · 1 line
Sebastian Reichel <[email protected]>