Skip to contentSkip to conversation

ARM: shmobile: pinmux platform device cleanups

PATCH New Magnus Damm 3 participants 9 messages Apr 3, 2013 – Apr 5, 2013

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover ARM: shmobile: pinmux platform device cleanups

ARM: shmobile: pinmux platform device cleanups

[PATCH 01/04] ARM: shmobile: r8a7740 pinmux platform device cleanup [PATCH 02/04] ARM: shmobile: r8a7779 pinmux platform device cleanup [PATCH 03/04] ARM: shmobile: sh7372 pinmux platform device cleanup [PATCH 04/04] ARM: shmobile: sh73a0 pinmux platform device cleanup

This series simply cleans up the pinmux platform device handling to save a couple of lines. Compile time tested on each SoC.

---

Written against renesas-next-20130403 in renesas.git

 arch/arm/mach-shmobile/setup-r8a7740.c |   24 +++++-------------------
 arch/arm/mach-shmobile/setup-r8a7779.c |   19 ++++---------------
 arch/arm/mach-shmobile/setup-sh7372.c  |   24 +++++-------------------
 arch/arm/mach-shmobile/setup-sh73a0.c  |   25 ++++++-------------------
 4 files changed, 20 insertions(+), 72 deletions(-)
author maintainer
#1 lore raw

PATCH 1/4 ARM: shmobile: r8a7740 pinmux platform device cleanup

From: Magnus Damm <[email protected]>

Use DEFINE_RES_MEM() and platform_device_register_simple() to save a couple of lines of code.

---

 arch/arm/mach-shmobile/setup-r8a7740.c |   24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)
arch/arm/mach-shmobile/setup-r8a7740.c +5 -19
@@ -70,29 +70,15 @@ void __init r8a7740_map_io(void)
 }
 
 /* PFC */
-static struct resource r8a7740_pfc_resources[] = {
-	[0] = {
-		.start	= 0xe6050000,
-		.end	= 0xe6057fff,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= 0xe605800c,
-		.end	= 0xe605802b,
-		.flags	= IORESOURCE_MEM,
-	}
-};
-
-static struct platform_device r8a7740_pfc_device = {
-	.name		= "pfc-r8a7740",
-	.id		= -1,
-	.resource	= r8a7740_pfc_resources,
-	.num_resources	= ARRAY_SIZE(r8a7740_pfc_resources),
+static const struct resource pfc_resources[] = {
+	DEFINE_RES_MEM(0xe6050000, 0x8000),
+	DEFINE_RES_MEM(0xe605800c, 0x0020),
 };
 
 void __init r8a7740_pinmux_init(void)
 {
-	platform_device_register(&r8a7740_pfc_device);
+	platform_device_register_simple("pfc-r8a7740", -1, pfc_resources,
+					ARRAY_SIZE(pfc_resources));
 }
 
 static struct renesas_intc_irqpin_config irqpin0_platform_data = {
author maintainer
#2 lore raw

PATCH 2/4 ARM: shmobile: r8a7779 pinmux platform device cleanup

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Use DEFINE_RES_MEM() to save a couple of lines of code.

---

 arch/arm/mach-shmobile/setup-r8a7779.c |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
arch/arm/mach-shmobile/setup-r8a7779.c +4 -15
@@ -63,12 +63,8 @@ void __init r8a7779_map_io(void)
 	iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
 }
 
-static struct resource r8a7779_pfc_resources[] = {
-	[0] = {
-		.start	= 0xfffc0000,
-		.end	= 0xfffc023b,
-		.flags	= IORESOURCE_MEM,
-	},
+static const struct resource r8a7779_pfc_resources[] = {
+	DEFINE_RES_MEM(0xfffc0000, 0x023c),
 };
 
 static struct platform_device r8a7779_pfc_device = {
@@ -80,15 +76,8 @@ static struct platform_device r8a7779_pf
 
 #define R8A7779_GPIO(idx, npins) \
 static struct resource r8a7779_gpio##idx##_resources[] = {		\
-	[0] = {								\
-		.start	= 0xffc40000 + 0x1000 * (idx),			\
-		.end	= 0xffc4002b + 0x1000 * (idx),			\
-		.flags	= IORESOURCE_MEM,				\
-	},								\
-	[1] = {								\
-		.start	= gic_iid(0xad + (idx)),			\
-		.flags	= IORESOURCE_IRQ,				\
-	}								\
+	DEFINE_RES_MEM(0xffc40000 + (0x1000 * (idx)), 0x002c),		\
+	DEFINE_RES_IRQ(gic_iid(0xad + (idx))),				\
 };									\
 									\
 static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = {	\
#3 lore raw

PATCH 2/4 ARM: shmobile: r8a7779 pinmux platform device cleanup

Hi Magnus,

Thanks for the patch.

Quoted 15 lines · On Wednesday 03 April 2013 15:33:08 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Use DEFINE_RES_MEM() to save a couple of lines of code.

---

 arch/arm/mach-shmobile/setup-r8a7779.c |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
arch/arm/mach-shmobile/setup-r8a7779.c +0 -0

15:30:16.000000000 +0900 @@ -63,12 +63,8 @@ void __init r8a7779_map_io(void)

arch/arm/mach-shmobile/setup-r8a7779.c +0 -0
 	iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));

arch/arm/mach-shmobile/setup-r8a7779.c void __init r8a7779_map_io(void) · line 67

Quoted 10 lines
arch/arm/mach-shmobile/setup-r8a7779.c +2 -6
 }
 
-static struct resource r8a7779_pfc_resources[] = {
-	[0] = {
-		.start	= 0xfffc0000,
-		.end	= 0xfffc023b,
-		.flags	= IORESOURCE_MEM,
-	},
+static const struct resource r8a7779_pfc_resources[] = {
+	DEFINE_RES_MEM(0xfffc0000, 0x023c),

This generates a compilation warning, as the resources pointer in struct platform_device isn't const.

Quoted 21 lines

};

static struct platform_device r8a7779_pfc_device = {

arch/arm/mach-shmobile/setup-r8a7779.c +2 -9
@@ -80,15 +76,8 @@ static struct platform_device r8a7779_pf
 
 #define R8A7779_GPIO(idx, npins) \
 static struct resource r8a7779_gpio##idx##_resources[] = {		\
-	[0] = {								\
-		.start	= 0xffc40000 + 0x1000 * (idx),			\
-		.end	= 0xffc4002b + 0x1000 * (idx),			\
-		.flags	= IORESOURCE_MEM,				\
-	},								\
-	[1] = {								\
-		.start	= gic_iid(0xad + (idx)),			\
-		.flags	= IORESOURCE_IRQ,				\
-	}								\
+	DEFINE_RES_MEM(0xffc40000 + (0x1000 * (idx)), 0x002c),		\
+	DEFINE_RES_IRQ(gic_iid(0xad + (idx))),				\
 };									\
 									\
 static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = {	\
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#4 lore raw

PATCH 3/4 ARM: shmobile: sh7372 pinmux platform device cleanup

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Use DEFINE_RES_MEM() and platform_device_register_simple() to save a couple of lines of code.

---

 arch/arm/mach-shmobile/setup-sh7372.c |   24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)
arch/arm/mach-shmobile/setup-sh7372.c +5 -19
@@ -62,29 +62,15 @@ void __init sh7372_map_io(void)
 }
 
 /* PFC */
-static struct resource sh7372_pfc_resources[] = {
-	[0] = {
-		.start	= 0xe6050000,
-		.end	= 0xe6057fff,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= 0xe605800c,
-		.end	= 0xe6058027,
-		.flags	= IORESOURCE_MEM,
-	}
-};
-
-static struct platform_device sh7372_pfc_device = {
-	.name		= "pfc-sh7372",
-	.id		= -1,
-	.resource	= sh7372_pfc_resources,
-	.num_resources	= ARRAY_SIZE(sh7372_pfc_resources),
+static const struct resource pfc_resources[] = {
+	DEFINE_RES_MEM(0xe6050000, 0x8000),
+	DEFINE_RES_MEM(0xe605800c, 0x001c),
 };
 
 void __init sh7372_pinmux_init(void)
 {
-	platform_device_register(&sh7372_pfc_device);
+	platform_device_register_simple("pfc-sh7372", -1, pfc_resources,
+					ARRAY_SIZE(pfc_resources));
 }
 
 /* SCIFA0 */
author maintainer
#5 lore raw

PATCH 4/4 ARM: shmobile: sh73a0 pinmux platform device cleanup

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Use DEFINE_RES_MEM() and platform_device_register_simple() to save a couple of lines of code.

---

 arch/arm/mach-shmobile/setup-sh73a0.c |   25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)
arch/arm/mach-shmobile/setup-sh73a0.c +6 -19
@@ -61,29 +61,16 @@ void __init sh73a0_map_io(void)
 	iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
 }
 
-static struct resource sh73a0_pfc_resources[] = {
-	[0] = {
-		.start	= 0xe6050000,
-		.end	= 0xe6057fff,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= 0xe605801c,
-		.end	= 0xe6058027,
-		.flags	= IORESOURCE_MEM,
-	}
-};
-
-static struct platform_device sh73a0_pfc_device = {
-	.name		= "pfc-sh73a0",
-	.id		= -1,
-	.resource	= sh73a0_pfc_resources,
-	.num_resources	= ARRAY_SIZE(sh73a0_pfc_resources),
+/* PFC */
+static const struct resource pfc_resources[] = {
+	DEFINE_RES_MEM(0xe6050000, 0x8000),
+	DEFINE_RES_MEM(0xe605801c, 0x000c),
 };
 
 void __init sh73a0_pinmux_init(void)
 {
-	platform_device_register(&sh73a0_pfc_device);
+	platform_device_register_simple("pfc-sh73a0", -1, pfc_resources,
+					ARRAY_SIZE(pfc_resources));
 }
 
 static struct plat_sci_port scif0_platform_data = {
#6 lore raw

cover ARM: shmobile: pinmux platform device cleanups

In reply to Magnus Damm
Quoted 11 lines · Magnus Damm

ARM: shmobile: pinmux platform device cleanups

[PATCH 01/04] ARM: shmobile: r8a7740 pinmux platform device cleanup [PATCH 02/04] ARM: shmobile: r8a7779 pinmux platform device cleanup [PATCH 03/04] ARM: shmobile: sh7372 pinmux platform device cleanup [PATCH 04/04] ARM: shmobile: sh73a0 pinmux platform device cleanup

This series simply cleans up the pinmux platform device handling to save a couple of lines. Compile time tested on each SoC.

Laurent, could you review this series?

#7 lore raw

cover ARM: shmobile: pinmux platform device cleanups

In reply to Magnus Damm

Hi Magnus,

Thanks for the patches.

Quoted 11 lines · On Wednesday 03 April 2013 15:32:46 Magnus Damm wrote:

ARM: shmobile: pinmux platform device cleanups

[PATCH 01/04] ARM: shmobile: r8a7740 pinmux platform device cleanup [PATCH 02/04] ARM: shmobile: r8a7779 pinmux platform device cleanup [PATCH 03/04] ARM: shmobile: sh7372 pinmux platform device cleanup [PATCH 04/04] ARM: shmobile: sh73a0 pinmux platform device cleanup

This series simply cleans up the pinmux platform device handling to save a couple of lines. Compile time tested on each SoC.

Except for 2/4,

Quoted 9 lines

---

Written against renesas-next-20130403 in renesas.git

 arch/arm/mach-shmobile/setup-r8a7740.c |   24 +++++-------------------
 arch/arm/mach-shmobile/setup-r8a7779.c |   19 ++++---------------
 arch/arm/mach-shmobile/setup-sh7372.c  |   24 +++++-------------------
 arch/arm/mach-shmobile/setup-sh73a0.c  |   25 ++++++-------------------
 4 files changed, 20 insertions(+), 72 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

cover ARM: shmobile: pinmux platform device cleanups

Quoted 12 lines · Laurent Pinchart

Hi Magnus,

Thanks for the patches.

Quoted 7 lines · On Wednesday 03 April 2013 15:32:46 Magnus Damm wrote:

ARM: shmobile: pinmux platform device cleanups

[PATCH 01/04] ARM: shmobile: r8a7740 pinmux platform device cleanup [PATCH 02/04] ARM: shmobile: r8a7779 pinmux platform device cleanup [PATCH 03/04] ARM: shmobile: sh7372 pinmux platform device cleanup [PATCH 04/04] ARM: shmobile: sh73a0 pinmux platform device cleanup

Quoted 8 lines
Quoted 4 lines

This series simply cleans up the pinmux platform device handling to save a couple of lines. Compile time tested on each SoC.

Except for 2/4,

Thanks.

1/4: queued up in soc-r8a7740 branch
3/4: queued up in soc-sh7372 branch
4/4: queued up in soc-sh73a0 branch

Quoted 9 lines
Quoted 9 lines

---

Written against renesas-next-20130403 in renesas.git

 arch/arm/mach-shmobile/setup-r8a7740.c |   24 +++++-------------------
 arch/arm/mach-shmobile/setup-r8a7779.c |   19 ++++---------------
 arch/arm/mach-shmobile/setup-sh7372.c  |   24 +++++-------------------
 arch/arm/mach-shmobile/setup-sh73a0.c  |   25 ++++++-------------------
 4 files changed, 20 insertions(+), 72 deletions(-)