mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] reset: stm32: remove implicit sizeof(long) == 4 expectation
@ 2021-06-22 18:23 Ahmad Fatoum
  2021-06-24  8:53 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-06-22 18:23 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

There is no relation between sizeof(long) and the size of the register
of the reset controller on STM32 CPUs. They just happen to be both 32-bit
in the current configuration. U-Boot already removed the BITS_PER_LONG,
so do likewise.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/reset/reset-stm32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
index a4498f573bb6..2ef00859c48b 100644
--- a/drivers/reset/reset-stm32.c
+++ b/drivers/reset/reset-stm32.c
@@ -81,8 +81,8 @@ static u32 stm32_reset_status(struct stm32_reset *priv, unsigned long bank)
 
 static void stm32_reset(struct stm32_reset *priv, unsigned long id, bool assert)
 {
-	int bank = (id / BITS_PER_LONG) * 4;
-	int offset = id % BITS_PER_LONG;
+	int bank = (id / 32) * 4;
+	int offset = id % 32;
 
 	priv->ops->reset(priv->base + bank, offset, assert);
 }
-- 
2.32.0.rc0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH] reset: stm32: remove implicit sizeof(long) == 4 expectation
  2021-06-22 18:23 [PATCH] reset: stm32: remove implicit sizeof(long) == 4 expectation Ahmad Fatoum
@ 2021-06-24  8:53 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-06-24  8:53 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Jun 22, 2021 at 08:23:32PM +0200, Ahmad Fatoum wrote:
> There is no relation between sizeof(long) and the size of the register
> of the reset controller on STM32 CPUs. They just happen to be both 32-bit
> in the current configuration. U-Boot already removed the BITS_PER_LONG,
> so do likewise.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  drivers/reset/reset-stm32.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2021-06-24  8:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 18:23 [PATCH] reset: stm32: remove implicit sizeof(long) == 4 expectation Ahmad Fatoum
2021-06-24  8:53 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox