linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: renesas: rcar-sysc: Optimize rcar_sysc_area struct sizes
@ 2022-06-08 15:14 Geert Uytterhoeven
  2022-06-09  7:15 ` Wolfram Sang
  2022-06-10 11:21 ` Yoshihiro Shimoda
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2022-06-08 15:14 UTC (permalink / raw)
  To: Magnus Damm, Yoshihiro Shimoda
  Cc: linux-renesas-soc, linux-arm-kernel, Geert Uytterhoeven

Reduce the sizes of the rcar_sysc_area and rcar_gen4_sysc_area
structures:
  - parent is in the range [-1..32] or [-1..64], so s8 is sufficient,
  - flags needs just 3 bits (for now), so u8 is plenty.

This reduces kernel size by:
  - 288 bytes for an R-Car Gen1+Gen2 kernel (arm32),
  - 1772 bytes for an R-Car Gen3+Gen4 kernel (arm64).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
To be queued in renesas-devel-for-v5.20.

 drivers/soc/renesas/rcar-gen4-sysc.h | 4 ++--
 drivers/soc/renesas/rcar-sysc.h      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/renesas/rcar-gen4-sysc.h b/drivers/soc/renesas/rcar-gen4-sysc.h
index fe2d9825475423f0..388cfa8f8f9fd656 100644
--- a/drivers/soc/renesas/rcar-gen4-sysc.h
+++ b/drivers/soc/renesas/rcar-gen4-sysc.h
@@ -25,8 +25,8 @@
 struct rcar_gen4_sysc_area {
 	const char *name;
 	u8 pdr;			/* PDRn */
-	int parent;		/* -1 if none */
-	unsigned int flags;	/* See PD_* */
+	s8 parent;		/* -1 if none */
+	u8 flags;		/* See PD_* */
 };
 
 /*
diff --git a/drivers/soc/renesas/rcar-sysc.h b/drivers/soc/renesas/rcar-sysc.h
index 8d861c1cfdf78b6f..266c599a0a9b9198 100644
--- a/drivers/soc/renesas/rcar-sysc.h
+++ b/drivers/soc/renesas/rcar-sysc.h
@@ -31,8 +31,8 @@ struct rcar_sysc_area {
 	u16 chan_offs;		/* Offset of PWRSR register for this area */
 	u8 chan_bit;		/* Bit in PWR* (except for PWRUP in PWRSR) */
 	u8 isr_bit;		/* Bit in SYSCI*R */
-	int parent;		/* -1 if none */
-	unsigned int flags;	/* See PD_* */
+	s8 parent;		/* -1 if none */
+	u8 flags;		/* See PD_* */
 };
 
 
-- 
2.25.1


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

* Re: [PATCH] soc: renesas: rcar-sysc: Optimize rcar_sysc_area struct sizes
  2022-06-08 15:14 [PATCH] soc: renesas: rcar-sysc: Optimize rcar_sysc_area struct sizes Geert Uytterhoeven
@ 2022-06-09  7:15 ` Wolfram Sang
  2022-06-10 11:21 ` Yoshihiro Shimoda
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2022-06-09  7:15 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Magnus Damm, Yoshihiro Shimoda, linux-renesas-soc, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]

On Wed, Jun 08, 2022 at 05:14:21PM +0200, Geert Uytterhoeven wrote:
> Reduce the sizes of the rcar_sysc_area and rcar_gen4_sysc_area
> structures:
>   - parent is in the range [-1..32] or [-1..64], so s8 is sufficient,
>   - flags needs just 3 bits (for now), so u8 is plenty.
> 
> This reduces kernel size by:
>   - 288 bytes for an R-Car Gen1+Gen2 kernel (arm32),
>   - 1772 bytes for an R-Car Gen3+Gen4 kernel (arm64).
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Nice! Dunno how to verify the parent ranges, but my Spider board boots
fine with it. So

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* RE: [PATCH] soc: renesas: rcar-sysc: Optimize rcar_sysc_area struct sizes
  2022-06-08 15:14 [PATCH] soc: renesas: rcar-sysc: Optimize rcar_sysc_area struct sizes Geert Uytterhoeven
  2022-06-09  7:15 ` Wolfram Sang
@ 2022-06-10 11:21 ` Yoshihiro Shimoda
  1 sibling, 0 replies; 3+ messages in thread
From: Yoshihiro Shimoda @ 2022-06-10 11:21 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm; +Cc: linux-renesas-soc, linux-arm-kernel

Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Thursday, June 9, 2022 12:14 AM
> 
> Reduce the sizes of the rcar_sysc_area and rcar_gen4_sysc_area
> structures:
>   - parent is in the range [-1..32] or [-1..64], so s8 is sufficient,
>   - flags needs just 3 bits (for now), so u8 is plenty.
> 
> This reduces kernel size by:
>   - 288 bytes for an R-Car Gen1+Gen2 kernel (arm32),
>   - 1772 bytes for an R-Car Gen3+Gen4 kernel (arm64).
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> To be queued in renesas-devel-for-v5.20.

Thank you for the patch! This patch looks good to me. And, I tested
this patch on both r8a77951 and r8a779f0, and I didn't observe any regression.
So,

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


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

end of thread, other threads:[~2022-06-10 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 15:14 [PATCH] soc: renesas: rcar-sysc: Optimize rcar_sysc_area struct sizes Geert Uytterhoeven
2022-06-09  7:15 ` Wolfram Sang
2022-06-10 11:21 ` Yoshihiro Shimoda

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).