Skip to contentSkip to conversation

tty: remove duplicate hung_up_tty_compat_ioctl()

PATCH In review Arnd Bergmann 2 participants 2 messages Apr 29, 2023 – May 2, 2023 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: remove duplicate hung_up_tty_compat_ioctl()

From: Arnd Bergmann <[email protected]>

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")

---
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(-)
drivers/tty/tty_io.c +2 -8
index 553182753098..31d465279b6c 100644
@@ -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)
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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,

Quoted 7 lines

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")
Quoted 43 lines

---
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(-)
drivers/tty/tty_io.c +2 -8
index 553182753098..31d465279b6c 100644
@@ -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)
Signature · 2 lines
js
suse labs