Re: [PATCH] tty: remove duplicate hung_up_tty_compat_ioctl()

From: Jiri Slaby
Date: Tue May 02 2023 - 01:04:30 EST


On 29. 04. 23, 22:34, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@xxxxxxxx>

The hung_up_tty_compat_ioctl() has been identical to hung_up_tty_ioctl()
for a very long time, but now the only caller is inside of an #ifdef,
causing a harmless warning:

drivers/tty/tty_io.c:446:13: error: 'hung_up_tty_compat_ioctl' defined but not used [-Werror=unused-function]
446 | static long hung_up_tty_compat_ioctl(struct file *file,

Avoid this by removing the function entirely and just using the native
one in its place.

Fixes: 04f378b198da ("tty: BKL pushdown")
Fixes: 4c87e9e5479b ("tty: tty_io: remove hung_up_tty_fops")
Link: https://lore.kernel.org/all/2a07bded-25e5-fd27-a2de-8b606e4d1d2c@xxxxxxxxxxxxxxxxxxx/
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

Reviewed-by: Jiri Slaby <jirislaby@xxxxxxxxxx>


---
I did this patch to fix the build failure locally before I saw it
was already under discussion. Sending it anyway in case nobody
else has done a formal fix yet.
---
drivers/tty/tty_io.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 553182753098..31d465279b6c 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -443,12 +443,6 @@ static long hung_up_tty_ioctl(struct file *file, unsigned int cmd,
return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
}
-static long hung_up_tty_compat_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
-{
- return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
-}
-
static int hung_up_tty_fasync(int fd, struct file *file, int on)
{
return -ENOTTY;
@@ -2941,7 +2935,7 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
}
if (tty_hung_up_p(file))
- return hung_up_tty_compat_ioctl(file, cmd, arg);
+ return hung_up_tty_ioctl(file, cmd, arg);
if (tty_paranoia_check(tty, file_inode(file), "tty_ioctl"))
return -EINVAL;
@@ -2959,7 +2953,7 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
ld = tty_ldisc_ref_wait(tty);
if (!ld)
- return hung_up_tty_compat_ioctl(file, cmd, arg);
+ return hung_up_tty_ioctl(file, cmd, arg);
if (ld->ops->compat_ioctl)
retval = ld->ops->compat_ioctl(tty, cmd, arg);
if (retval == -ENOIOCTLCMD && ld->ops->ioctl)

--
js
suse labs