On Fri, Jan 29, 2021 at 02:06:27PM -0800, Scott Branden wrote:
> Correct compile issue if CONFIG_TTY is not set by
> only adding ttyVK devices if CONFIG_TTY is set.
> 
> Reported-by: Randy Dunlap <rdun...@infradead.org>
> Signed-off-by: Scott Branden <scott.bran...@broadcom.com>
> 
> ---
> Changes since v1:
> Add function stubs rather than compiling out code
> ---
>  drivers/misc/bcm-vk/Makefile     |  4 ++--
>  drivers/misc/bcm-vk/bcm_vk.h     | 35 +++++++++++++++++++++++++++++---
>  drivers/misc/bcm-vk/bcm_vk_dev.c |  3 +--
>  drivers/misc/bcm-vk/bcm_vk_tty.c |  6 ++++++
>  4 files changed, 41 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/misc/bcm-vk/Makefile b/drivers/misc/bcm-vk/Makefile
> index e4a1486f7209..8d81a734fcad 100644
> --- a/drivers/misc/bcm-vk/Makefile
> +++ b/drivers/misc/bcm-vk/Makefile
> @@ -7,6 +7,6 @@ obj-$(CONFIG_BCM_VK) += bcm_vk.o
>  bcm_vk-objs := \
>       bcm_vk_dev.o \
>       bcm_vk_msg.o \
> -     bcm_vk_sg.o \
> -     bcm_vk_tty.o
> +     bcm_vk_sg.o
>  
> +bcm_vk-$(CONFIG_TTY) += bcm_vk_tty.o
> diff --git a/drivers/misc/bcm-vk/bcm_vk.h b/drivers/misc/bcm-vk/bcm_vk.h
> index 3f37c640a814..4a1d515374c7 100644
> --- a/drivers/misc/bcm-vk/bcm_vk.h
> +++ b/drivers/misc/bcm-vk/bcm_vk.h
> @@ -258,7 +258,11 @@ enum pci_barno {
>       BAR_2
>  };
>  
> +#ifdef CONFIG_TTY
>  #define BCM_VK_NUM_TTY 2
> +#else
> +#define BCM_VK_NUM_TTY 0
> +#endif
>  
>  struct bcm_vk_tty {
>       struct tty_port port;
> @@ -366,11 +370,15 @@ struct bcm_vk {
>       struct miscdevice miscdev;
>       int devid; /* dev id allocated */
>  
> +#ifdef CONFIG_TTY
>       struct tty_driver *tty_drv;
>       struct timer_list serial_timer;
>       struct bcm_vk_tty tty[BCM_VK_NUM_TTY];
>       struct workqueue_struct *tty_wq_thread;
>       struct work_struct tty_wq_work;
> +#else
> +     struct bcm_vk_tty *tty;

Why do you still need this pointer?

And should you just have a separate config option for your tty driver
instead that depends on CONFIG_TTY?  Would you ever want to run this
driver without the tty portion?

Oh, and much better than the previous version, thanks for cleaning it
up.

thanks,

greg k-h

Reply via email to