2017-12-20 08:48:15

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 00/11] constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Arvind Yadav (11):
[PATCH 01/11] MIPS: Alchemy: constify gpio_led
[PATCH 02/11] MIPS: AR7: constify gpio_led
[PATCH 03/11] MIPS: TXX9: constify gpio_led
[PATCH 04/11] x86: geode: constify gpio_led
[PATCH 05/11] sh: mach-rsk: rsk7203: constify gpio_led
[PATCH 06/11] ARM: davinci: constify gpio_led
[PATCH 07/11] ARM: ixp4xx: constify gpio_led
[PATCH 08/11] ARM: OMAP1: constify gpio_led
[PATCH 09/11] ARM: orion5x: constify gpio_led
[PATCH 10/11] ARM: s3c24xx: constify gpio_led
[PATCH 11/11] ARM: pxa: constify gpio_led

arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
arch/arm/mach-ixp4xx/dsmg600-setup.c | 2 +-
arch/arm/mach-ixp4xx/nas100d-setup.c | 2 +-
arch/arm/mach-ixp4xx/omixp-setup.c | 2 +-
arch/arm/mach-omap1/board-h2.c | 2 +-
arch/arm/mach-omap1/board-h3.c | 2 +-
arch/arm/mach-omap1/board-htcherald.c | 2 +-
arch/arm/mach-omap1/board-osk.c | 4 ++--
arch/arm/mach-orion5x/board-d2net.c | 2 +-
arch/arm/mach-orion5x/dns323-setup.c | 2 +-
arch/arm/mach-orion5x/ls_hgl-setup.c | 2 +-
arch/arm/mach-orion5x/mv2120-setup.c | 2 +-
arch/arm/mach-orion5x/net2big-setup.c | 2 +-
arch/arm/mach-orion5x/rd88f5182-setup.c | 2 +-
arch/arm/mach-orion5x/ts409-setup.c | 2 +-
arch/arm/mach-orion5x/wrt350n-v2-setup.c | 2 +-
arch/arm/mach-pxa/balloon3.c | 4 ++--
arch/arm/mach-pxa/corgi.c | 2 +-
arch/arm/mach-pxa/csb701.c | 2 +-
arch/arm/mach-pxa/magician.c | 2 +-
arch/arm/mach-pxa/mioa701.c | 2 +-
arch/arm/mach-pxa/palmld.c | 2 +-
arch/arm/mach-pxa/palmz72.c | 2 +-
arch/arm/mach-pxa/pcm027.c | 2 +-
arch/arm/mach-pxa/raumfeld.c | 4 ++--
arch/arm/mach-pxa/spitz.c | 2 +-
arch/arm/mach-pxa/stargate2.c | 2 +-
arch/arm/mach-pxa/tosa.c | 2 +-
arch/arm/mach-pxa/trizeps4.c | 2 +-
arch/arm/mach-pxa/zeus.c | 2 +-
arch/arm/mach-s3c24xx/mach-h1940.c | 2 +-
arch/arm/mach-s3c24xx/mach-rx1950.c | 2 +-
arch/arm/mach-s3c64xx/mach-hmt.c | 2 +-
arch/arm/mach-s3c64xx/mach-smartq5.c | 2 +-
arch/arm/mach-s3c64xx/mach-smartq7.c | 2 +-
arch/arm/mach-s3c64xx/mach-smdk6410.c | 2 +-
arch/mips/alchemy/board-gpr.c | 2 +-
arch/mips/alchemy/board-mtx1.c | 2 +-
arch/mips/ar7/platform.c | 14 +++++++-------
arch/mips/txx9/rbtx4927/setup.c | 2 +-
arch/sh/boards/mach-rsk/devices-rsk7203.c | 2 +-
arch/x86/platform/geode/alix.c | 2 +-
arch/x86/platform/geode/geos.c | 2 +-
arch/x86/platform/geode/net5501.c | 2 +-
44 files changed, 53 insertions(+), 53 deletions(-)

--
1.9.1


2017-12-20 08:48:26

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 01/11] MIPS: Alchemy: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/mips/alchemy/board-gpr.c | 2 +-
arch/mips/alchemy/board-mtx1.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c
index 328d697..fcc5826 100644
--- a/arch/mips/alchemy/board-gpr.c
+++ b/arch/mips/alchemy/board-gpr.c
@@ -190,7 +190,7 @@ void __init board_setup(void)
/*
* LEDs
*/
-static struct gpio_led gpr_gpio_leds[] = {
+static const struct gpio_led gpr_gpio_leds[] __initconst = {
{ /* green */
.name = "gpr:green",
.gpio = 4,
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c
index 85bb756..59aa96a 100644
--- a/arch/mips/alchemy/board-mtx1.c
+++ b/arch/mips/alchemy/board-mtx1.c
@@ -145,7 +145,7 @@ void __init board_setup(void)
.resource = mtx1_wdt_res,
};

-static struct gpio_led default_leds[] = {
+static const struct gpio_led default_leds[] __initconst = {
{
.name = "mtx1:green",
.gpio = 211,
--
1.9.1

2017-12-20 08:48:35

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 02/11] MIPS: AR7: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/mips/ar7/platform.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 4674f1e..343a897 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -346,7 +346,7 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
/*****************************************************************************
* LEDs
****************************************************************************/
-static struct gpio_led default_leds[] = {
+static const struct gpio_led default_leds[] __initconst = {
{
.name = "status",
.gpio = 8,
@@ -354,12 +354,12 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
},
};

-static struct gpio_led titan_leds[] = {
+static const struct gpio_led titan_leds[] __initconst = {
{ .name = "status", .gpio = 8, .active_low = 1, },
{ .name = "wifi", .gpio = 13, .active_low = 1, },
};

-static struct gpio_led dsl502t_leds[] = {
+static const struct gpio_led dsl502t_leds[] __initconst = {
{
.name = "status",
.gpio = 9,
@@ -377,7 +377,7 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
},
};

-static struct gpio_led dg834g_leds[] = {
+static const struct gpio_led dg834g_leds[] __initconst = {
{
.name = "ppp",
.gpio = 6,
@@ -406,7 +406,7 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
},
};

-static struct gpio_led fb_sl_leds[] = {
+static const struct gpio_led fb_sl_leds[] __initconst = {
{
.name = "1",
.gpio = 7,
@@ -433,7 +433,7 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
},
};

-static struct gpio_led fb_fon_leds[] = {
+static const struct gpio_led fb_fon_leds[] __initconst = {
{
.name = "1",
.gpio = 8,
@@ -459,7 +459,7 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
},
};

-static struct gpio_led gt701_leds[] = {
+static const struct gpio_led gt701_leds[] __initconst = {
{
.name = "inet:green",
.gpio = 13,
--
1.9.1

2017-12-20 08:48:42

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 03/11] MIPS: TXX9: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/mips/txx9/rbtx4927/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index f5b367e..31955c1 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -319,7 +319,7 @@ static void __init rbtx4927_mtd_init(void)

static void __init rbtx4927_gpioled_init(void)
{
- static struct gpio_led leds[] = {
+ static const struct gpio_led leds[] = {
{ .name = "gpioled:green:0", .gpio = 0, .active_low = 1, },
{ .name = "gpioled:green:1", .gpio = 1, .active_low = 1, },
};
--
1.9.1

2017-12-20 08:48:48

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 04/11] x86: geode: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/x86/platform/geode/alix.c | 2 +-
arch/x86/platform/geode/geos.c | 2 +-
arch/x86/platform/geode/net5501.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/geode/alix.c b/arch/x86/platform/geode/alix.c
index 1865c19..9626367 100644
--- a/arch/x86/platform/geode/alix.c
+++ b/arch/x86/platform/geode/alix.c
@@ -71,7 +71,7 @@
}
};

-static struct gpio_led alix_leds[] = {
+static const struct gpio_led alix_leds[] __initconst = {
{
.name = "alix:1",
.gpio = 6,
diff --git a/arch/x86/platform/geode/geos.c b/arch/x86/platform/geode/geos.c
index 4fcdb91..119cfdc 100644
--- a/arch/x86/platform/geode/geos.c
+++ b/arch/x86/platform/geode/geos.c
@@ -54,7 +54,7 @@
}
};

-static struct gpio_led geos_leds[] = {
+static const struct gpio_led geos_leds[] __initconst = {
{
.name = "geos:1",
.gpio = 6,
diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c
index a2f6b98..ba604cc 100644
--- a/arch/x86/platform/geode/net5501.c
+++ b/arch/x86/platform/geode/net5501.c
@@ -57,7 +57,7 @@
}
};

-static struct gpio_led net5501_leds[] = {
+static const struct gpio_led net5501_leds[] __initconst = {
{
.name = "net5501:1",
.gpio = 6,
--
1.9.1

2017-12-20 08:48:56

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 05/11] sh: mach-rsk: rsk7203: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/sh/boards/mach-rsk/devices-rsk7203.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mach-rsk/devices-rsk7203.c
index a8089f7..5d32f1b 100644
--- a/arch/sh/boards/mach-rsk/devices-rsk7203.c
+++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c
@@ -50,7 +50,7 @@
},
};

-static struct gpio_led rsk7203_gpio_leds[] = {
+static const struct gpio_led rsk7203_gpio_leds[] __initconst = {
{
.name = "green",
.gpio = GPIO_PE10,
--
1.9.1

2017-12-20 08:49:05

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 06/11] ARM: davinci: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 0c02aaa..6a42a94 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -128,7 +128,7 @@
.num_resources = 0,
};

-static struct gpio_led ntosd2_leds[] = {
+static const struct gpio_led ntosd2_leds[] __initconst = {
{ .name = "led1_green", .gpio = GPIO(10), },
{ .name = "led1_red", .gpio = GPIO(11), },
{ .name = "led2_green", .gpio = GPIO(12), },
--
1.9.1

2017-12-20 08:49:16

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 07/11] ARM: ixp4xx: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/arm/mach-ixp4xx/dsmg600-setup.c | 2 +-
arch/arm/mach-ixp4xx/nas100d-setup.c | 2 +-
arch/arm/mach-ixp4xx/omixp-setup.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 0f5c999..74892a8 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -93,7 +93,7 @@
},
};

-static struct gpio_led dsmg600_led_pins[] = {
+static const struct gpio_led dsmg600_led_pins[] __initconst = {
{
.name = "dsmg600:green:power",
.gpio = DSMG600_LED_PWR_GPIO,
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 76dfff0..dee33d7 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -72,7 +72,7 @@
},
};

-static struct gpio_led nas100d_led_pins[] = {
+static const struct gpio_led nas100d_led_pins[] __initconst = {
{
.name = "nas100d:green:wlan",
.gpio = NAS100D_LED_WLAN_GPIO,
diff --git a/arch/arm/mach-ixp4xx/omixp-setup.c b/arch/arm/mach-ixp4xx/omixp-setup.c
index 2d494b4..54acf23 100644
--- a/arch/arm/mach-ixp4xx/omixp-setup.c
+++ b/arch/arm/mach-ixp4xx/omixp-setup.c
@@ -152,7 +152,7 @@
.resource = omixp_uart_resources,
};

-static struct gpio_led mic256_led_pins[] = {
+static const struct gpio_led mic256_led_pins[] __initconst = {
{
.name = "LED-A",
.gpio = 7,
--
1.9.1

2017-12-20 08:49:29

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 09/11] ARM: orion5x: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/arm/mach-orion5x/board-d2net.c | 2 +-
arch/arm/mach-orion5x/dns323-setup.c | 2 +-
arch/arm/mach-orion5x/ls_hgl-setup.c | 2 +-
arch/arm/mach-orion5x/mv2120-setup.c | 2 +-
arch/arm/mach-orion5x/net2big-setup.c | 2 +-
arch/arm/mach-orion5x/rd88f5182-setup.c | 2 +-
arch/arm/mach-orion5x/ts409-setup.c | 2 +-
arch/arm/mach-orion5x/wrt350n-v2-setup.c | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-orion5x/board-d2net.c b/arch/arm/mach-orion5x/board-d2net.c
index a89376a..8791a22 100644
--- a/arch/arm/mach-orion5x/board-d2net.c
+++ b/arch/arm/mach-orion5x/board-d2net.c
@@ -54,7 +54,7 @@
#define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16
#define D2NET_GPIO_BLUE_LED_OFF 23

-static struct gpio_led d2net_leds[] = {
+static const struct gpio_led d2net_leds[] __initconst = {
{
.name = "d2net:blue:sata",
.default_trigger = "default-on",
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index cd483bf..70eb340 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -221,7 +221,7 @@ static int __init dns323_read_mac_addr(void)
};


-static struct gpio_led dns323c_leds[] = {
+static const struct gpio_led dns323c_leds[] __initconst = {
{
.name = "power:blue",
.gpio = DNS323C_GPIO_LED_POWER,
diff --git a/arch/arm/mach-orion5x/ls_hgl-setup.c b/arch/arm/mach-orion5x/ls_hgl-setup.c
index 47ba6e0..f5410e0 100644
--- a/arch/arm/mach-orion5x/ls_hgl-setup.c
+++ b/arch/arm/mach-orion5x/ls_hgl-setup.c
@@ -86,7 +86,7 @@
#define LS_HGL_GPIO_LED_PWR 0


-static struct gpio_led ls_hgl_led_pins[] = {
+static const struct gpio_led ls_hgl_led_pins[] __initconst = {
{
.name = "alarm:red",
.gpio = LS_HGL_GPIO_LED_ALARM,
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c
index 2bf8ec7..957095a 100644
--- a/arch/arm/mach-orion5x/mv2120-setup.c
+++ b/arch/arm/mach-orion5x/mv2120-setup.c
@@ -136,7 +136,7 @@
.irq = 0,
};

-static struct gpio_led mv2120_led_pins[] = {
+static const struct gpio_led mv2120_led_pins[] __initconst = {
{
.name = "mv2120:blue:health",
.gpio = 0,
diff --git a/arch/arm/mach-orion5x/net2big-setup.c b/arch/arm/mach-orion5x/net2big-setup.c
index bf6be4c..f8ca382 100644
--- a/arch/arm/mach-orion5x/net2big-setup.c
+++ b/arch/arm/mach-orion5x/net2big-setup.c
@@ -214,7 +214,7 @@ static void __init net2big_sata_power_init(void)
#define NET2BIG_GPIO_SATA0_BLUE_LED 17
#define NET2BIG_GPIO_SATA1_BLUE_LED 13

-static struct gpio_led net2big_leds[] = {
+static const struct gpio_led net2big_leds[] __initconst = {
{
.name = "net2big:red:power",
.gpio = NET2BIG_GPIO_PWR_RED_LED,
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index fe3e67c..6376ae1 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -83,7 +83,7 @@

#define RD88F5182_GPIO_LED 0

-static struct gpio_led rd88f5182_gpio_led_pins[] = {
+static const struct gpio_led rd88f5182_gpio_led_pins[] __initconst = {
{
.name = "rd88f5182:cpu",
.default_trigger = "cpu0",
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index a77613b..6d88d2f 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -169,7 +169,7 @@ static int __init qnap_ts409_pci_init(void)
* LEDs attached to GPIO
****************************************************************************/

-static struct gpio_led ts409_led_pins[] = {
+static const struct gpio_led ts409_led_pins[] __initconst = {
{
.name = "ts409:red:sata1",
.gpio = 4,
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index 9250bb2..40adfd8 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -29,7 +29,7 @@
/*
* LEDs attached to GPIO
*/
-static struct gpio_led wrt350n_v2_led_pins[] = {
+static const struct gpio_led wrt350n_v2_led_pins[] __initconst = {
{
.name = "wrt350nv2:green:power",
.gpio = 0,
--
1.9.1

2017-12-20 08:49:31

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 08/11] ARM: OMAP1: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/arm/mach-omap1/board-h2.c | 2 +-
arch/arm/mach-omap1/board-h3.c | 2 +-
arch/arm/mach-omap1/board-htcherald.c | 2 +-
arch/arm/mach-omap1/board-osk.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index ab51f85..43f95e5 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -274,7 +274,7 @@ static int h2_nand_dev_ready(struct mtd_info *mtd)
.resource = h2_kp_resources,
};

-static struct gpio_led h2_gpio_led_pins[] = {
+static const struct gpio_led h2_gpio_led_pins[] __initconst = {
{
.name = "h2:red",
.default_trigger = "heartbeat",
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index ad339f5..957edb5 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -326,7 +326,7 @@ static void __init h3_init_smc91x(void)
},
};

-static struct gpio_led h3_gpio_led_pins[] = {
+static const struct gpio_led h3_gpio_led_pins[] __initconst = {
{
.name = "h3:red",
.default_trigger = "heartbeat",
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 67d4669..627b5e3 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -292,7 +292,7 @@
};

/* LEDs for the Herald. These connect to the HTCPLD GPIO device. */
-static struct gpio_led gpio_leds[] = {
+static const struct gpio_led gpio_leds[] __initconst = {
{"dpad", NULL, HTCPLD_GPIO_LED_DPAD, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
{"kbd", NULL, HTCPLD_GPIO_LED_KBD, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
{"vibrate", NULL, HTCPLD_GPIO_LED_VIBRATE, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index c66372e..4216b50 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -167,7 +167,7 @@
&osk5912_cf_device,
};

-static struct gpio_led tps_leds[] = {
+static const struct gpio_led tps_leds[] __initconst = {
/* NOTE: D9 and D2 have hardware blink support.
* Also, D9 requires non-battery power.
*/
@@ -385,7 +385,7 @@ static void __init osk_init_cf(void)
.id = -1,
};

-static struct gpio_led mistral_gpio_led_pins[] = {
+static const struct gpio_led mistral_gpio_led_pins[] __initconst = {
{
.name = "mistral:red",
.default_trigger = "heartbeat",
--
1.9.1

2017-12-20 08:49:38

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 10/11] ARM: s3c24xx: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/arm/mach-s3c24xx/mach-h1940.c | 2 +-
arch/arm/mach-s3c24xx/mach-rx1950.c | 2 +-
arch/arm/mach-s3c64xx/mach-hmt.c | 2 +-
arch/arm/mach-s3c64xx/mach-smartq5.c | 2 +-
arch/arm/mach-s3c64xx/mach-smartq7.c | 2 +-
arch/arm/mach-s3c64xx/mach-smdk6410.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 7ed7861..333f951 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -413,7 +413,7 @@ int h1940_led_blink_set(struct gpio_desc *desc, int state,
}
EXPORT_SYMBOL(h1940_led_blink_set);

-static struct gpio_led h1940_leds_desc[] = {
+static const struct gpio_led h1940_leds_desc[] __initconst = {
{
.name = "Green",
.default_trigger = "main-battery-full",
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index e86ad6a..f8cb057 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -295,7 +295,7 @@ static int rx1950_led_blink_set(struct gpio_desc *desc, int state,
return 0;
}

-static struct gpio_led rx1950_leds_desc[] = {
+static const struct gpio_led rx1950_leds_desc[] __initconst = {
{
.name = "Green",
.default_trigger = "main-battery-full",
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 59b5531..6688129 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -207,7 +207,7 @@ static void hmt_bl_exit(struct device *dev)
.ecc_mode = NAND_ECC_SOFT,
};

-static struct gpio_led hmt_leds[] = {
+static const struct gpio_led hmt_leds[] __initconst = {
{ /* left function keys */
.name = "left:blue",
.gpio = S3C64XX_GPO(12),
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 0972b6c..fc0bf33 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -35,7 +35,7 @@
#include "common.h"
#include "mach-smartq.h"

-static struct gpio_led smartq5_leds[] = {
+static const struct gpio_led smartq5_leds[] __initconst = {
{
.name = "smartq5:green",
.active_low = 1,
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index 51ac1c6..016e03b 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -35,7 +35,7 @@
#include "common.h"
#include "mach-smartq.h"

-static struct gpio_led smartq7_leds[] = {
+static const struct gpio_led smartq7_leds[] __initconst = {
{
.name = "smartq7:red",
.active_low = 1,
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index 92ec8c3..6752dc5 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -497,7 +497,7 @@ static int __init smdk6410_wm8350_init(struct wm8350 *wm8350)
#endif

#ifdef CONFIG_SMDK6410_WM1192_EV1
-static struct gpio_led wm1192_pmic_leds[] = {
+static const struct gpio_led wm1192_pmic_leds[] __initconst = {
{
.name = "PMIC:red:power",
.gpio = GPIO_BOARD_START + 3,
--
1.9.1

2017-12-20 08:49:43

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 11/11] ARM: pxa: constify gpio_led

gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
arch/arm/mach-pxa/balloon3.c | 4 ++--
arch/arm/mach-pxa/corgi.c | 2 +-
arch/arm/mach-pxa/csb701.c | 2 +-
arch/arm/mach-pxa/magician.c | 2 +-
arch/arm/mach-pxa/mioa701.c | 2 +-
arch/arm/mach-pxa/palmld.c | 2 +-
arch/arm/mach-pxa/palmz72.c | 2 +-
arch/arm/mach-pxa/pcm027.c | 2 +-
arch/arm/mach-pxa/raumfeld.c | 4 ++--
arch/arm/mach-pxa/spitz.c | 2 +-
arch/arm/mach-pxa/stargate2.c | 2 +-
arch/arm/mach-pxa/tosa.c | 2 +-
arch/arm/mach-pxa/trizeps4.c | 2 +-
arch/arm/mach-pxa/zeus.c | 2 +-
14 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index d6d92f3..4413829 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -387,7 +387,7 @@ static inline void balloon3_uhc_init(void) {}
GPIO10_GPIO, /* Heartbeat LED */
};

-struct gpio_led balloon3_gpio_leds[] = {
+struct const gpio_led balloon3_gpio_leds[] __initconst = {
{
.name = "balloon3:green:idle",
.default_trigger = "heartbeat",
@@ -414,7 +414,7 @@ struct gpio_led balloon3_gpio_leds[] = {
}
};

-struct gpio_led balloon3_pcf_gpio_leds[] = {
+const struct gpio_led balloon3_pcf_gpio_leds[] __initconst = {
{
.name = "balloon3:green:led0",
.gpio = BALLOON3_PCF_GPIO_LED0,
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 7270f0db..b0e0d3b 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -450,7 +450,7 @@ struct platform_device corgiscoop_device = {
/*
* Corgi LEDs
*/
-static struct gpio_led corgi_gpio_leds[] = {
+static const struct gpio_led corgi_gpio_leds[] __initconst = {
{
.name = "corgi:amber:charge",
.default_trigger = "sharpsl-charge",
diff --git a/arch/arm/mach-pxa/csb701.c b/arch/arm/mach-pxa/csb701.c
index 527c9fd..ff52892 100644
--- a/arch/arm/mach-pxa/csb701.c
+++ b/arch/arm/mach-pxa/csb701.c
@@ -24,7 +24,7 @@
.nbuttons = ARRAY_SIZE(csb701_buttons),
};

-static struct gpio_led csb701_leds[] = {
+static const struct gpio_led csb701_leds[] __initconst = {
{
.name = "csb701:yellow:heartbeat",
.default_trigger = "heartbeat",
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 7f3566c..505d1e3 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -424,7 +424,7 @@ static void magician_backlight_exit(struct device *dev)
* GPIO LEDs, Phone keys backlight, vibra
*/

-static struct gpio_led gpio_leds[] = {
+static const struct gpio_led gpio_leds[] __initconst = {
{
.name = "magician::vibra",
.default_trigger = "none",
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 8a5d049..e3d2248 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -274,7 +274,7 @@ static void mioa701_lcd_power(int on, struct fb_var_screeninfo *si)
*/
#define ONE_LED(_gpio, _name) \
{ .gpio = (_gpio), .name = (_name), .active_low = true }
-static struct gpio_led gpio_leds[] = {
+static const struct gpio_led gpio_leds[] __initconst = {
ONE_LED(GPIO10_LED_nCharging, "mioa701:charging"),
ONE_LED(GPIO97_LED_nBlue, "mioa701:blue"),
ONE_LED(GPIO98_LED_nOrange, "mioa701:orange"),
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 980f284..37239f4 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -246,7 +246,7 @@ static inline void palmld_keys_init(void) {}
* LEDs
******************************************************************************/
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
-struct gpio_led gpio_leds[] = {
+struct const gpio_led gpio_leds[] __initconst = {
{
.name = "palmld:green:led",
.default_trigger = "none",
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 5877e54..acacadb 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -182,7 +182,7 @@ static inline void palmz72_kpc_init(void) {}
* LEDs
******************************************************************************/
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
-static struct gpio_led gpio_leds[] = {
+static const struct gpio_led gpio_leds[] __initconst = {
{
.name = "palmz72:green:led",
.default_trigger = "none",
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c
index ccca9f7..face4c8 100644
--- a/arch/arm/mach-pxa/pcm027.c
+++ b/arch/arm/mach-pxa/pcm027.c
@@ -177,7 +177,7 @@

#ifdef CONFIG_LEDS_GPIO

-static struct gpio_led pcm027_led[] = {
+static const struct gpio_led pcm027_led[] __initconst = {
{
.name = "led0:red", /* FIXME */
.gpio = PCM027_LED_CPU
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index 9d662fe..633c74d 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -468,7 +468,7 @@
* GPIO LEDs
*/

-static struct gpio_led raumfeld_leds[] = {
+static const struct gpio_led raumfeld_leds[] __initconst = {
{
.name = "raumfeld:1",
.gpio = GPIO_LED1,
@@ -558,7 +558,7 @@ static void __init raumfeld_w1_init(void)
};

/* LT3593 controlled backlight */
-static struct gpio_led raumfeld_lt3593_led = {
+static const struct gpio_led raumfeld_lt3593_led __initconst = {
.name = "backlight",
.gpio = mfp_to_gpio(MFP_PIN_GPIO17),
.default_state = LEDS_GPIO_DEFSTATE_ON,
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 67d66c7..d24be35 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -456,7 +456,7 @@ static inline void spitz_keys_init(void) {}
* LEDs
******************************************************************************/
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
-static struct gpio_led spitz_gpio_leds[] = {
+static const struct gpio_led spitz_gpio_leds[] __initconst = {
{
.name = "spitz:amber:charge",
.default_trigger = "sharpsl-charge",
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index 6b7df6f..3704d6c 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -441,7 +441,7 @@ static int imote2_mci_get_ro(struct device *dev)
.gpio_power = -1,
};

-static struct gpio_led imote2_led_pins[] = {
+static const struct gpio_led imote2_led_pins[] __initconst = {
{
.name = "imote2:red",
.gpio = 103,
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 6a386fd..d306b96 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -548,7 +548,7 @@ static void tosa_irda_shutdown(struct device *dev)
/*
* Tosa LEDs
*/
-static struct gpio_led tosa_gpio_leds[] = {
+static const struct gpio_led tosa_gpio_leds[] __initconst = {
{
.name = "tosa:amber:charge",
.default_trigger = "main-battery-charging",
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 3dd13b4..4f95c03 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -235,7 +235,7 @@
/****************************************************************************
* LED's on GPIO pins of PXA
****************************************************************************/
-static struct gpio_led trizeps4_led[] = {
+static const struct gpio_led trizeps4_led[] __initconst = {
#ifdef STATUS_LEDS_ON_STUART_PINS
{
.name = "led0:orange:heartbeat", /* */
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index ecbcaee..8ceafd7 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -438,7 +438,7 @@ static void __init zeus_init_irq(void)
};

/* Leds */
-static struct gpio_led zeus_leds[] = {
+static const struct gpio_led zeus_leds[] __initconst = {
[0] = {
.name = "zeus:yellow:1",
.default_trigger = "heartbeat",
--
1.9.1

2017-12-23 07:38:21

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 04/11] x86: geode: constify gpio_led

Hi Arvind,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm-soc/for-next]
[also build test WARNING on v4.15-rc4 next-20171222]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Arvind-Yadav/constify-gpio_led/20171223-142117
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
config: i386-randconfig-s1-201751 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

>> WARNING: vmlinux.o(.data+0x16554): Section mismatch in reference from the variable geos_leds_data to the variable .init.rodata:geos_leds
The variable geos_leds_data references
the variable __initconst geos_leds
If the reference is valid then annotate the
variable with or __refdata (see linux/init.h) or name the variable:


---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (1.16 kB)
.config.gz (30.56 kB)
Download all attachments

2017-12-23 10:03:43

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH 06/11] ARM: davinci: constify gpio_led

On Wednesday 20 December 2017 02:17 PM, Arvind Yadav wrote:
> gpio_led are not supposed to change at runtime.
> struct gpio_led_platform_data working with const gpio_led
> provided by <linux/leds.h>. So mark the non-const structs
> as const.
>
> Signed-off-by: Arvind Yadav <[email protected]>

This causes a new section mismatch warning

WARNING: vmlinux.o(.data+0x16d7c): Section mismatch in reference from the variable ntosd2_leds_data to the (unknown reference) .init.rodata:(unknown)
The variable ntosd2_leds_data references
the (unknown reference) __initconst (unknown)
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console


Thanks,
Sekhar

2017-12-23 10:14:02

by Russell King (Oracle)

[permalink] [raw]
Subject: Re: [PATCH 00/11] constify gpio_led

On Wed, Dec 20, 2017 at 02:17:41PM +0530, Arvind Yadav wrote:
> gpio_led are not supposed to change at runtime.
> struct gpio_led_platform_data working with const gpio_led
> provided by <linux/leds.h>. So mark the non-const structs
> as const.

Marking the structs as const is fine, but marking them __initconst is
not. The GPIO LED driver can be built as a module, which means it can
be loaded after the init sections have gone away. If that happens,
then we de-reference the pointer to memory that has been freed.

Please re-spin your patch set without the __initconst marking.

--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

2017-12-24 17:55:15

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 11/11] ARM: pxa: constify gpio_led

Hi Arvind,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm-soc/for-next]
[also build test ERROR on v4.15-rc5 next-20171222]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Arvind-Yadav/constify-gpio_led/20171223-142117
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
config: arm-pxa_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All error/warnings (new ones prefixed by >>):

>> arch/arm/mach-pxa/balloon3.c:390:8: error: expected '{' before 'const'
struct const gpio_led balloon3_gpio_leds[] __initconst = {
^~~~~
>> arch/arm/mach-pxa/balloon3.c:405:11: error: 'balloon3_gpio_leds' undeclared here (not in a function); did you mean 'balloon3_gpio_led_info'?
.leds = balloon3_gpio_leds,
^~~~~~~~~~~~~~~~~~
balloon3_gpio_led_info
In file included from include/linux/kernel.h:15:0,
from include/linux/list.h:9,
from include/linux/kobject.h:20,
from include/linux/device.h:17,
from include/linux/platform_device.h:14,
from arch/arm/mach-pxa/balloon3.c:18:
>> include/linux/build_bug.h:30:45: error: bit-field '<anonymous>' width not an integer constant
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
include/linux/compiler-gcc.h:65:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^~~~~~~~~~~~~~~~~
include/linux/kernel.h:71:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~~~~~~~~~~~~~
>> arch/arm/mach-pxa/balloon3.c:406:14: note: in expansion of macro 'ARRAY_SIZE'
.num_leds = ARRAY_SIZE(balloon3_gpio_leds),
^~~~~~~~~~
--
>> arch/arm/mach-pxa/palmld.c:249:8: error: expected '{' before 'const'
struct const gpio_led gpio_leds[] __initconst = {
^~~~~
>> arch/arm/mach-pxa/palmld.c:262:11: error: 'gpio_leds' undeclared here (not in a function); did you mean 'gpio_led'?
.leds = gpio_leds,
^~~~~~~~~
gpio_led
In file included from include/linux/kernel.h:15:0,
from include/linux/list.h:9,
from include/linux/kobject.h:20,
from include/linux/device.h:17,
from include/linux/platform_device.h:14,
from arch/arm/mach-pxa/palmld.c:17:
>> include/linux/build_bug.h:30:45: error: bit-field '<anonymous>' width not an integer constant
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
include/linux/compiler-gcc.h:65:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^~~~~~~~~~~~~~~~~
include/linux/kernel.h:71:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~~~~~~~~~~~~~
>> arch/arm/mach-pxa/palmld.c:263:14: note: in expansion of macro 'ARRAY_SIZE'
.num_leds = ARRAY_SIZE(gpio_leds),
^~~~~~~~~~

vim +390 arch/arm/mach-pxa/balloon3.c

389
> 390 struct const gpio_led balloon3_gpio_leds[] __initconst = {
391 {
392 .name = "balloon3:green:idle",
393 .default_trigger = "heartbeat",
394 .gpio = BALLOON3_GPIO_LED_IDLE,
395 .active_low = 1,
396 }, {
397 .name = "balloon3:green:nand",
398 .default_trigger = "nand-disk",
399 .gpio = BALLOON3_GPIO_LED_NAND,
400 .active_low = 1,
401 },
402 };
403
404 static struct gpio_led_platform_data balloon3_gpio_led_info = {
> 405 .leds = balloon3_gpio_leds,
> 406 .num_leds = ARRAY_SIZE(balloon3_gpio_leds),
407 };
408

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (4.56 kB)
.config.gz (31.98 kB)
Download all attachments

2017-12-25 13:04:39

by Arvind Yadav

[permalink] [raw]
Subject: Re: [PATCH 11/11] ARM: pxa: constify gpio_led

Hi,

Sorry for trouble, I will send updated patch.

On Sunday 24 December 2017 11:24 PM, kbuild test robot wrote:
> Hi Arvind,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on arm-soc/for-next]
> [also build test ERROR on v4.15-rc5 next-20171222]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Arvind-Yadav/constify-gpio_led/20171223-142117
> base: https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
> config: arm-pxa_defconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=arm
>
> All error/warnings (new ones prefixed by >>):
>
>>> arch/arm/mach-pxa/balloon3.c:390:8: error: expected '{' before 'const'
> struct const gpio_led balloon3_gpio_leds[] __initconst = {
> ^~~~~
>>> arch/arm/mach-pxa/balloon3.c:405:11: error: 'balloon3_gpio_leds' undeclared here (not in a function); did you mean 'balloon3_gpio_led_info'?
> .leds = balloon3_gpio_leds,
> ^~~~~~~~~~~~~~~~~~
> balloon3_gpio_led_info
> In file included from include/linux/kernel.h:15:0,
> from include/linux/list.h:9,
> from include/linux/kobject.h:20,
> from include/linux/device.h:17,
> from include/linux/platform_device.h:14,
> from arch/arm/mach-pxa/balloon3.c:18:
>>> include/linux/build_bug.h:30:45: error: bit-field '<anonymous>' width not an integer constant
> #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
> ^
> include/linux/compiler-gcc.h:65:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> ^~~~~~~~~~~~~~~~~
> include/linux/kernel.h:71:59: note: in expansion of macro '__must_be_array'
> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> ^~~~~~~~~~~~~~~
>>> arch/arm/mach-pxa/balloon3.c:406:14: note: in expansion of macro 'ARRAY_SIZE'
> .num_leds = ARRAY_SIZE(balloon3_gpio_leds),
> ^~~~~~~~~~
> --
>>> arch/arm/mach-pxa/palmld.c:249:8: error: expected '{' before 'const'
> struct const gpio_led gpio_leds[] __initconst = {
> ^~~~~
>>> arch/arm/mach-pxa/palmld.c:262:11: error: 'gpio_leds' undeclared here (not in a function); did you mean 'gpio_led'?
> .leds = gpio_leds,
> ^~~~~~~~~
> gpio_led
> In file included from include/linux/kernel.h:15:0,
> from include/linux/list.h:9,
> from include/linux/kobject.h:20,
> from include/linux/device.h:17,
> from include/linux/platform_device.h:14,
> from arch/arm/mach-pxa/palmld.c:17:
>>> include/linux/build_bug.h:30:45: error: bit-field '<anonymous>' width not an integer constant
> #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
> ^
> include/linux/compiler-gcc.h:65:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> ^~~~~~~~~~~~~~~~~
> include/linux/kernel.h:71:59: note: in expansion of macro '__must_be_array'
> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> ^~~~~~~~~~~~~~~
>>> arch/arm/mach-pxa/palmld.c:263:14: note: in expansion of macro 'ARRAY_SIZE'
> .num_leds = ARRAY_SIZE(gpio_leds),
> ^~~~~~~~~~
>
> vim +390 arch/arm/mach-pxa/balloon3.c
>
> 389
> > 390 struct const gpio_led balloon3_gpio_leds[] __initconst = {
> 391 {
> 392 .name = "balloon3:green:idle",
> 393 .default_trigger = "heartbeat",
> 394 .gpio = BALLOON3_GPIO_LED_IDLE,
> 395 .active_low = 1,
> 396 }, {
> 397 .name = "balloon3:green:nand",
> 398 .default_trigger = "nand-disk",
> 399 .gpio = BALLOON3_GPIO_LED_NAND,
> 400 .active_low = 1,
> 401 },
> 402 };
> 403
> 404 static struct gpio_led_platform_data balloon3_gpio_led_info = {
> > 405 .leds = balloon3_gpio_leds,
> > 406 .num_leds = ARRAY_SIZE(balloon3_gpio_leds),
> 407 };
> 408
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation

2017-12-25 13:07:59

by Arvind Yadav

[permalink] [raw]
Subject: Re: [PATCH 00/11] constify gpio_led

Hi Ressell,

On Saturday 23 December 2017 03:43 PM, Russell King - ARM Linux wrote:
> On Wed, Dec 20, 2017 at 02:17:41PM +0530, Arvind Yadav wrote:
>> gpio_led are not supposed to change at runtime.
>> struct gpio_led_platform_data working with const gpio_led
>> provided by <linux/leds.h>. So mark the non-const structs
>> as const.
> Marking the structs as const is fine, but marking them __initconst is
> not. The GPIO LED driver can be built as a module, which means it can
> be loaded after the init sections have gone away. If that happens,
> then we de-reference the pointer to memory that has been freed.
>
> Please re-spin your patch set without the __initconst marking.
>
Thanks for reviewing, As per your comment, I will send updated
patch. Which will not include __initconst.

~arvind