serial: core: drop unnecessary gpio include
PATCH 1/1 serial: core: drop unnecessary gpio include
Drop the recently added gpio include from the serial-core header in favour of a forward declaration and instead include the gpio header only where needed.
--- drivers/tty/serial/8250/8250_port.c | 1 + drivers/tty/serial/serial_core.c | 1 + include/linux/serial_core.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +1 -0
@@ -16,6 +16,7 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/console.h> +#include <linux/gpio/consumer.h> #include <linux/sysrq.h> #include <linux/delay.h> #include <linux/platform_device.h>
drivers/tty/serial/serial_core.c +1 -0
@@ -14,6 +14,7 @@#include <linux/sched/signal.h> #include <linux/init.h> #include <linux/console.h> +#include <linux/gpio/consumer.h> #include <linux/of.h> #include <linux/proc_fs.h> #include <linux/seq_file.h>
include/linux/serial_core.h +1 -1
@@ -10,7 +10,6 @@#include <linux/bitops.h> #include <linux/compiler.h> #include <linux/console.h> -#include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/circ_buf.h> #include <linux/spinlock.h>
@@ -30,6 +29,7 @@struct uart_port ;struct serial_struct ;struct device ; +struct gpio_desc ;/* * This structure describes all the operations that can be done on the
Signature · 1 line
2.26.2
[cc += Heiko]
Quoted 3 lines · Johan Hovold
Drop the recently added gpio include from the serial-core header in favour of a forward declaration and instead include the gpio header only where needed.
Hm, but why? Are there adverse effects if this is included by <linux/serial_core.h>?
Thanks,
Lukas
Quoted 55 lines
Signed-off-by Johan Hovold <[email protected]>--- drivers/tty/serial/8250/8250_port.c | 1 + drivers/tty/serial/serial_core.c | 1 + include/linux/serial_core.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)drivers/tty/serial/8250/8250_port.c +1
-0@@ -16,6 +16,7 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/console.h> +#include <linux/gpio/consumer.h> #include <linux/sysrq.h> #include <linux/delay.h> #include <linux/platform_device.h> drivers/tty/serial/serial_core.c +1
-0@@ -14,6 +14,7 @@#include <linux/sched/signal.h> #include <linux/init.h> #include <linux/console.h> +#include <linux/gpio/consumer.h> #include <linux/of.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> include/linux/serial_core.h +1
-1@@ -10,7 +10,6 @@#include <linux/bitops.h> #include <linux/compiler.h> #include <linux/console.h> -#include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/circ_buf.h> #include <linux/spinlock.h> @@ -30,6 +29,7 @@struct uart_port ;struct serial_struct ;struct device ; +struct gpio_desc ;/* * This structure describes all the operations that can be done on the Signature · 1 line
2.26.2
Quoted 9 lines · Lukas Wunner
[cc += Heiko]
Quoted 3 lines · Johan Hovold
Drop the recently added gpio include from the serial-core header in favour of a forward declaration and instead include the gpio header only where needed.
Hm, but why? Are there adverse effects if this is included by <
linux/serial_core.h>?
Compilation time and general code hygiene. Headers shouldn't include more than needed. And in this case only a single driver (besides core) is actually using the gpio interface.
Johan