diff mbox series

soc: renesas: rcar-sysc: Optimize rcar_sysc_area struct sizes

Message ID cbbc8f464743d636895c048de61aa610d75392de.1654701156.git.geert+renesas@glider.be (mailing list archive)
State Accepted
Commit 4f5bc54d28ecd0739c99dc71ed93c2ebb5d9ba32
Delegated to: Geert Uytterhoeven
Headers show
Series soc: renesas: rcar-sysc: Optimize rcar_sysc_area struct sizes | expand

Commit Message

Geert Uytterhoeven June 8, 2022, 3:14 p.m. UTC
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(-)

Comments

Wolfram Sang June 9, 2022, 7:15 a.m. UTC | #1
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>
Yoshihiro Shimoda June 10, 2022, 11:21 a.m. UTC | #2
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
diff mbox series

Patch

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_* */
 };