[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210129060443.14864-1-scott.branden@broadcom.com>
Date: Thu, 28 Jan 2021 22:04:43 -0800
From: Scott Branden <scott.branden@...adcom.com>
To: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Scott Branden <scott.branden@...adcom.com>
Cc: Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org,
bcm-kernel-feedback-list@...adcom.com,
Olof Johansson <olof@...om.net>,
Desmond Yan <desmond.yan@...adcom.com>
Subject: [PATCH] misc: bcm-vk: only support ttyVK if CONFIG_TTY is set
Correct compile issue if CONFIG_TTY is not set by
only adding ttyVK devices if CONFIG_TTY is set.
Reported-by: Randy Dunlap <rdunlap@...radead.org>
Signed-off-by: Scott Branden <scott.branden@...adcom.com>
---
drivers/misc/bcm-vk/Makefile | 4 ++--
drivers/misc/bcm-vk/bcm_vk_dev.c | 13 +++++++++++++
2 files changed, 15 insertions(+), 2 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_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c
index c3d2bba68ef1..ae63fbdf14bc 100644
--- a/drivers/misc/bcm-vk/bcm_vk_dev.c
+++ b/drivers/misc/bcm-vk/bcm_vk_dev.c
@@ -525,7 +525,10 @@ void bcm_vk_blk_drv_access(struct bcm_vk *vk)
}
}
}
+
+#ifdef CONFIG_TTY
bcm_vk_tty_terminate_tty_user(vk);
+#endif
spin_unlock(&vk->ctx_lock);
}
@@ -1385,6 +1388,7 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
vk->num_irqs++;
+#ifdef CONFIG_TTY
for (i = 0;
(i < VK_MSIX_TTY_MAX) && (vk->num_irqs < irq);
i++, vk->num_irqs++) {
@@ -1398,6 +1402,7 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
vk->tty[i].irq_enabled = true;
}
+#endif
id = ida_simple_get(&bcm_vk_ida, 0, 0, GFP_KERNEL);
if (id < 0) {
@@ -1451,10 +1456,12 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_destroy_workqueue;
}
+#ifdef CONFIG_TTY
snprintf(name, sizeof(name), KBUILD_MODNAME ".%d_ttyVK", id);
err = bcm_vk_tty_init(vk, name);
if (err)
goto err_unregister_panic_notifier;
+#endif
/*
* lets trigger an auto download. We don't want to do it serially here
@@ -1480,9 +1487,11 @@ static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0;
err_bcm_vk_tty_exit:
+#ifdef CONFIG_TTY
bcm_vk_tty_exit(vk);
err_unregister_panic_notifier:
+#endif
atomic_notifier_chain_unregister(&panic_notifier_list,
&vk->panic_nb);
@@ -1560,7 +1569,9 @@ static void bcm_vk_remove(struct pci_dev *pdev)
&vk->panic_nb);
bcm_vk_msg_remove(vk);
+#ifdef CONFIG_TTY
bcm_vk_tty_exit(vk);
+#endif
if (vk->tdma_vaddr)
dma_free_coherent(&pdev->dev, nr_scratch_pages * PAGE_SIZE,
@@ -1580,8 +1591,10 @@ static void bcm_vk_remove(struct pci_dev *pdev)
cancel_work_sync(&vk->wq_work);
destroy_workqueue(vk->wq_thread);
+#ifdef CONFIG_TTY
cancel_work_sync(&vk->tty_wq_work);
destroy_workqueue(vk->tty_wq_thread);
+#endif
for (i = 0; i < MAX_BAR; i++) {
if (vk->bar[i])
--
2.17.1
Powered by blists - more mailing lists