linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: core: drop unnecessary gpio include
@ 2020-06-10 15:51 Johan Hovold
  2020-06-11  8:25 ` Lukas Wunner
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2020-06-10 15:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, Lukas Wunner, linux-serial, linux-kernel, 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.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 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(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 1632f7d25acc..d64ca77d9cfa 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -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>
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 3706f31b0c37..cba19f7d9ea3 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -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>
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 791f4844efeb..01fc4d9c9c54 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -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
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: core: drop unnecessary gpio include
  2020-06-10 15:51 [PATCH] serial: core: drop unnecessary gpio include Johan Hovold
@ 2020-06-11  8:25 ` Lukas Wunner
  2020-06-11  8:33   ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Lukas Wunner @ 2020-06-11  8:25 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel,
	Heiko Stübner

[cc += Heiko]

On Wed, Jun 10, 2020 at 05:51:21PM +0200, Johan Hovold wrote:
> 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

> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  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(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 1632f7d25acc..d64ca77d9cfa 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -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>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 3706f31b0c37..cba19f7d9ea3 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -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>
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 791f4844efeb..01fc4d9c9c54 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -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
> -- 
> 2.26.2
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: core: drop unnecessary gpio include
  2020-06-11  8:25 ` Lukas Wunner
@ 2020-06-11  8:33   ` Johan Hovold
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2020-06-11  8:33 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Johan Hovold, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
	linux-kernel, Heiko Stübner

On Thu, Jun 11, 2020 at 10:25:30AM +0200, Lukas Wunner wrote:
> [cc += Heiko]
> 
> On Wed, Jun 10, 2020 at 05:51:21PM +0200, Johan Hovold wrote:
> > 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-11  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 15:51 [PATCH] serial: core: drop unnecessary gpio include Johan Hovold
2020-06-11  8:25 ` Lukas Wunner
2020-06-11  8:33   ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).