[PATCH 1/2] pty: define and set show_fdinfo only if procfs is enabled

From: Tobias Klauser
Date: Mon Mar 02 2020 - 05:55:23 EST


Follow the pattern used with other *_show_fdinfo functions and only
define and use pty_show_fdinfo if CONFIG_PROC_FS is set.

Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx>
---
drivers/tty/pty.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 00099a8439d2..dceaff332ca5 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -756,10 +756,12 @@ static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
}
}

+#ifdef CONFIG_PROC_FS
static void pty_show_fdinfo(struct tty_struct *tty, struct seq_file *m)
{
seq_printf(m, "tty-index:\t%d\n", tty->index);
}
+#endif

static const struct tty_operations ptm_unix98_ops = {
.lookup = ptm_unix98_lookup,
@@ -776,7 +778,9 @@ static const struct tty_operations ptm_unix98_ops = {
.compat_ioctl = pty_unix98_compat_ioctl,
.resize = pty_resize,
.cleanup = pty_cleanup,
+#ifdef CONFIG_PROC_FS
.show_fdinfo = pty_show_fdinfo,
+#endif
};

static const struct tty_operations pty_unix98_ops = {
--
2.25.0