tty: define hung_up_tty_compat_ioctl with CONFIG_COMPAT

Message ID 20230501025602.2905173-1-trix@redhat.com
State New
Headers
Series tty: define hung_up_tty_compat_ioctl with CONFIG_COMPAT |

Commit Message

Tom Rix May 1, 2023, 2:56 a.m. UTC
  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.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/tty/tty_io.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Jiri Slaby May 2, 2023, 5:02 a.m. UTC | #1
On 01. 05. 23, 4:56, Tom Rix wrote:
> 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.



> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   drivers/tty/tty_io.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> index 553182753098..7fe404d56ce7 100644
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -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)
>   {

Hi,

Arnd sent a better fix already:
https://lore.kernel.org/all/20230429203523.538756-1-arnd@kernel.org/

thanks,
  

Patch

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 553182753098..7fe404d56ce7 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -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)
 {