mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Scott Branden <scott.branden@broadcom.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Scott Branden <scott.branden@broadcom.com>
Cc: Kees Cook <keescook@chromium.org>,
	linux-kernel@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com,
	Olof Johansson <olof@lixom.net>,
	Desmond Yan <desmond.yan@broadcom.com>
Subject: [PATCH] misc: bcm-vk: only support ttyVK if CONFIG_TTY is set
Date: Thu, 28 Jan 2021 22:04:43 -0800	[thread overview]
Message-ID: <20210129060443.14864-1-scott.branden@broadcom.com> (raw)

Correct compile issue if CONFIG_TTY is not set by
only adding ttyVK devices if CONFIG_TTY is set.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Scott Branden <scott.branden@broadcom.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


             reply	other threads:[~2021-01-29  6:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29  6:04 Scott Branden [this message]
2021-01-29  7:17 ` Randy Dunlap
2021-02-03 21:04 Scott Branden
2021-02-03 22:17 ` Greg Kroah-Hartman
2021-02-03 22:41   ` Scott Branden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210129060443.14864-1-scott.branden@broadcom.com \
    --to=scott.branden@broadcom.com \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=desmond.yan@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®