Re: [PATCH v3] serial: 8250: add gpio support to exar

One Thousand Gnomes
2015-12-20T17:29:41Z

> > If you are linking it into the driver you don't need the module_init/exit
> > gpio_init/exit methods. Your Kconfig becomes a bool and you combine the
> > file into the driver based upon that bool.
>
> But isn't it better to have the gpio code separete from the 8250 code?
> But how do i combine a file? is it like:
>
> #ifdef SERIAL_8250_EXAR_GPIO
> #include "8250_gpio.c"
> #endif
>
> or should it be:
>
> #ifdef SERIAL_8250_EXAR_GPIO
>
> all c code
>
> #endif

Neither of the above. Take a look how other parts of the kernel combine
multiple files into a single module. It's supported by the
Kconfig/Makefile system, and they will get linked together as a single
binary while being separate sources.

For an example look at drivers/tty/ipwireless

Alan