Skip to contentSkip to conversation

serial: 8250_platform: remove ACPI_PTR() annotation

PATCH In review Arnd Bergmann 4 participants 7 messages Aug 7, 2024 – Aug 9, 2024 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 serial: 8250_platform: remove ACPI_PTR() annotation

From: Arnd Bergmann <[email protected]>

The acpi_platform_serial_table[] array is defined globally without an #ifdef check for CONFIG_ACPI, so ACPI_PTR() makes no sense here:

drivers/tty/serial/8250/8250_platform.c:271:36: error: 'acpi_platform_serial_table' defined but not used [-Werror=unused-const-variable=]
271 | static const struct acpi_device_id acpi_platform_serial_table[] = {

Fixes d9e5a0ce2f16 ("serial: 8250_platform: Enable generic 16550A platform devices")
---
 drivers/tty/serial/8250/8250_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_platform.c +1 -1
index 306b488aa996..c9ef988d58b3 100644
@@ -281,7 +281,7 @@ static struct platform_driver serial8250_isa_driver = {
 	.resume		= serial8250_resume,
 	.driver		= {
 		.name	= "serial8250",
-		.acpi_match_table = ACPI_PTR(acpi_platform_serial_table),
+		.acpi_match_table = acpi_platform_serial_table,
 	},
 };
 
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 serial: 8250_platform: fix uart_8250_port initializer

From: Arnd Bergmann <[email protected]>

The first element in uart_8250_port is a structure, so initializing it to 0 causes a warning on newer compilers:

drivers/tty/serial/8250/8250_platform.c: In function 'serial8250_platform_probe':
drivers/tty/serial/8250/8250_platform.c:111:40: error: excess elements in struct initializer [-Werror]
111 | struct uart_8250_port uart = { 0 };

Use the modern empty {} initializer instead that works on all supported compilers.

Fixes d9e5a0ce2f16 ("serial: 8250_platform: Enable generic 16550A platform devices")
---
 drivers/tty/serial/8250/8250_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_platform.c +1 -1
index c9ef988d58b3..2a3765334843 100644
@@ -108,7 +108,7 @@ void __init serial8250_isa_init_ports(void)
 static int serial8250_platform_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct uart_8250_port uart = { 0 };
+	struct uart_8250_port uart = { };
 	struct resource *regs;
 	unsigned char iotype;
 	int ret, line;
Signature · 1 line
2.39.2
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] serial: 8250_platform: fix uart_8250_port initializer

Hi Arnd,

Quoted 23 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The first element in uart_8250_port is a structure, so initializing it to 0 causes a warning on newer compilers:

drivers/tty/serial/8250/8250_platform.c: In function 'serial8250_platform_probe':
drivers/tty/serial/8250/8250_platform.c:111:40: error: excess elements in struct initializer [-Werror]
111 | struct uart_8250_port uart = { 0 };

Use the modern empty {} initializer instead that works on all supported compilers.

Fixes d9e5a0ce2f16 ("serial: 8250_platform: Enable generic 16550A platform devices")
---
 drivers/tty/serial/8250/8250_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_platform.c +0 -0
index c9ef988d58b3..2a3765334843 100644

drivers/tty/serial/8250/8250_platform.c void __init serial8250_isa_init_ports(void) · line 111

Quoted 5 lines
drivers/tty/serial/8250/8250_platform.c +1 -1
@@ -108,7 +108,7 @@ void __init serial8250_isa_init_ports(void)
 static int serial8250_platform_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct uart_8250_port uart = { 0 };
+	struct uart_8250_port uart = { };

Thanks! I was not sure about this. So, I sent a patch to use memset just couple of hours ago. I sent different fix for other ACPI_PTR issue as well. But I think your fixes are better.

Thanks!
Sunil

Reviewed-by on v1 1/2
#5 lore raw
In reply to Arnd Bergmann
Quoted 20 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The acpi_platform_serial_table[] array is defined globally without an #ifdef check for CONFIG_ACPI, so ACPI_PTR() makes no sense here:

drivers/tty/serial/8250/8250_platform.c:271:36: error: 'acpi_platform_serial_table' defined but not used [-Werror=unused-const-variable=]
271 | static const struct acpi_device_id acpi_platform_serial_table[] = {

Fixes d9e5a0ce2f16 ("serial: 8250_platform: Enable generic 16550A platform devices")
---
 drivers/tty/serial/8250/8250_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_platform.c +0 -0
index 306b488aa996..c9ef988d58b3 100644

drivers/tty/serial/8250/8250_platform.c static struct platform_driver serial8250_isa_driver = { · line 284

Quoted 5 lines
drivers/tty/serial/8250/8250_platform.c +1 -1
@@ -281,7 +281,7 @@ static struct platform_driver serial8250_isa_driver = {
 	.resume		= serial8250_resume,
 	.driver		= {
 		.name	= "serial8250",
-		.acpi_match_table = ACPI_PTR(acpi_platform_serial_table),
+		.acpi_match_table = acpi_platform_serial_table,

Thanks!
Sunil

Reviewed-by on v1 1/2
#6 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The acpi_platform_serial_table[] array is defined globally without an #ifdef check for CONFIG_ACPI, so ACPI_PTR() makes no sense here:

drivers/tty/serial/8250/8250_platform.c:271:36: error: 'acpi_platform_serial_table' defined but not used [-Werror=unused-const-variable=]
271 | static const struct acpi_device_id acpi_platform_serial_table[] = {

Yeah, that patch went into kernel without my review as I was on a long leave.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] serial: 8250_platform: fix uart_8250_port initializer

In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The first element in uart_8250_port is a structure, so initializing it to 0 causes a warning on newer compilers:

drivers/tty/serial/8250/8250_platform.c: In function 'serial8250_platform_probe':
drivers/tty/serial/8250/8250_platform.c:111:40: error: excess elements in struct initializer [-Werror]
111 | struct uart_8250_port uart = { 0 };

Use the modern empty {} initializer instead that works on all supported compilers.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] serial: 8250_platform: fix uart_8250_port initializer

In reply to Arnd Bergmann
Quoted 24 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The first element in uart_8250_port is a structure, so initializing it to 0 causes a warning on newer compilers:

drivers/tty/serial/8250/8250_platform.c: In function 'serial8250_platform_probe':
drivers/tty/serial/8250/8250_platform.c:111:40: error: excess elements in struct initializer [-Werror]
111 | struct uart_8250_port uart = { 0 };

Use the modern empty {} initializer instead that works on all supported compilers.

Fixes d9e5a0ce2f16 ("serial: 8250_platform: Enable generic 16550A platform devices")
---
 drivers/tty/serial/8250/8250_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_platform.c +0 -0
index c9ef988d58b3..2a3765334843 100644

drivers/tty/serial/8250/8250_platform.c void __init serial8250_isa_init_ports(void) · line 114

Quoted 8 lines
drivers/tty/serial/8250/8250_platform.c +1 -1
@@ -108,7 +108,7 @@ void __init serial8250_isa_init_ports(void)
 static int serial8250_platform_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct uart_8250_port uart = { 0 };
+	struct uart_8250_port uart = { };
 	struct resource *regs;
 	unsigned char iotype;
 	int ret, line;
Signature · 1 line
 i.