Skip to contentSkip to conversation

tty: define hung_up_tty_compat_ioctl with CONFIG_COMPAT

PATCH In review Tom Rix 2 participants 2 messages May 1, 2023 – May 2, 2023 TTY layer and serial drivers

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 tty: define hung_up_tty_compat_ioctl with CONFIG_COMPAT

gcc reports
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,

      |             ^~~~~~~~~~~~~~~~~~~~~~~~

hung_up_tty_compat_ioctl is used conditionally with CONFIG_COMPAT, so it should be likewise defined.

---
 drivers/tty/tty_io.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/tty/tty_io.c +2 -0
index 553182753098..7fe404d56ce7 100644
@@ -443,11 +443,13 @@ static long hung_up_tty_ioctl(struct file *file, unsigned int cmd,
 	return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
 }
 
+#ifdef CONFIG_COMPAT
 static long hung_up_tty_compat_ioctl(struct file *file,
 				     unsigned int cmd, unsigned long arg)
 {
 	return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
 }
+#endif
 
 static int hung_up_tty_fasync(int fd, struct file *file, int on)
 {
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 24 lines · Tom Rix

gcc reports
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,

       |             ^~~~~~~~~~~~~~~~~~~~~~~~

hung_up_tty_compat_ioctl is used conditionally with CONFIG_COMPAT, so it should be likewise defined.

---
  drivers/tty/tty_io.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/tty/tty_io.c +0 -0
index 553182753098..7fe404d56ce7 100644
@@ -443,11 +443,13 @@ static long hung_up_tty_ioctl(struct file *file, unsigned int cmd,
  	return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
  }
 

drivers/tty/tty_io.c static long hung_up_tty_ioctl(struct file *file, unsigned int cmd, · line 455

Quoted 10 lines
drivers/tty/tty_io.c +2 -0
+#ifdef CONFIG_COMPAT
  static long hung_up_tty_compat_ioctl(struct file *file,
  				     unsigned int cmd, unsigned long arg)
  {
  	return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
  }
+#endif
 
  static int hung_up_tty_fasync(int fd, struct file *file, int on)
  {

Hi,

Arnd sent a better fix already:
https://lore.kernel.org/all/[email protected]/

thanks,

Signature · 2 lines
js
suse labs