Skip to contentSkip to conversation

serial: sh-sci: Fix init data attribute for struct 'port_cfg'

PATCH In review Matthias Kaehlcke 2 participants 2 messages Oct 10, 2017 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 serial: sh-sci: Fix init data attribute for struct 'port_cfg'

The __init attribute is meant to mark functions, use __initdata instead for the data structure.

This fixes the following error when building with clang:

drivers/tty/serial/sh-sci.c:3247:15: error: '__section__' attribute only
applies to functions, methods, properties, and global variables

    static struct __init plat_sci_port port_cfg;

---
Changes in v2:
- Change the attribute to __initdata instead of removing it
- Update commit message

 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sh-sci.c +1 -1
index 784dd42002ea..f7f632213a8e 100644
@@ -3244,7 +3244,7 @@ early_platform_init_buffer("earlyprintk", &sci_driver,
 			   early_serial_buf, ARRAY_SIZE(early_serial_buf));
 #endif
 #ifdef CONFIG_SERIAL_SH_SCI_EARLYCON
-static struct __init plat_sci_port port_cfg;
+static struct plat_sci_port port_cfg __initdata;
 
 static int __init early_console_setup(struct earlycon_device *device,
 				      int type)
Signature · 1 line
2.14.2.920.gcf0c67979c-goog
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Matthias Kaehlcke

The __init attribute is meant to mark functions, use __initdata instead for the data structure.

This fixes the following error when building with clang:

drivers/tty/serial/sh-sci.c:3247:15: error: '__section__' attribute only
applies to functions, methods, properties, and global variables

    static struct __init plat_sci_port port_cfg;
Quoted 24 lines

---
Changes in v2:
- Change the attribute to __initdata instead of removing it
- Update commit message

 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sh-sci.c +1 -2
index 784dd42002ea..f7f632213a8e 100644
@@ -3244,7 +3244,7 @@ early_platform_init_buffer("earlyprintk", &sci_driver,
                           early_serial_buf, ARRAY_SIZE(early_serial_buf));
 #endif
 #ifdef CONFIG_SERIAL_SH_SCI_EARLYCON
-static struct __init plat_sci_port port_cfg;
+static struct plat_sci_port port_cfg __initdata;
 
 static int __init early_console_setup(struct earlycon_device *device,
                                      int type)
--

2.14.2.920.gcf0c67979c-goog