Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: remove file from tty_ldisc_ops::ioctl and compat_ioctl

After the previous patches, noone needs 'file' parameter in neither
ioctl hook from tty_ldisc_ops. So remove 'file' from both of them.

Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Paul Mackerras <paulus@samba.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> [NFC]
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20211122094529.24171-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby and committed by
Greg Kroah-Hartman
d78328bc 5db96ef2

+33 -40
+2 -3
drivers/bluetooth/hci_ldisc.c
··· 739 739 * Arguments: 740 740 * 741 741 * tty pointer to tty instance data 742 - * file pointer to open file object for device 743 742 * cmd IOCTL command code 744 743 * arg argument for IOCTL call (cmd dependent) 745 744 * 746 745 * Return Value: Command dependent 747 746 */ 748 - static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file *file, 749 - unsigned int cmd, unsigned long arg) 747 + static int hci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd, 748 + unsigned long arg) 750 749 { 751 750 struct hci_uart *hu = tty->disc_data; 752 751 int err = 0;
+2 -3
drivers/input/serio/serport.c
··· 207 207 * serport_ldisc_ioctl() allows to set the port protocol, and device ID 208 208 */ 209 209 210 - static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file, 211 - unsigned int cmd, unsigned long arg) 210 + static int serport_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd, 211 + unsigned long arg) 212 212 { 213 213 if (cmd == SPIOCSTYPE) { 214 214 unsigned long type; ··· 226 226 #ifdef CONFIG_COMPAT 227 227 #define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t) 228 228 static int serport_ldisc_compat_ioctl(struct tty_struct *tty, 229 - struct file *file, 230 229 unsigned int cmd, unsigned long arg) 231 230 { 232 231 if (cmd == COMPAT_SPIOCSTYPE) {
+2 -2
drivers/net/can/slcan.c
··· 670 670 } 671 671 672 672 /* Perform I/O control on an active SLCAN channel. */ 673 - static int slcan_ioctl(struct tty_struct *tty, struct file *file, 674 - unsigned int cmd, unsigned long arg) 673 + static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd, 674 + unsigned long arg) 675 675 { 676 676 struct slcan *sl = (struct slcan *) tty->disc_data; 677 677 unsigned int tmp;
+2 -2
drivers/net/hamradio/6pack.c
··· 681 681 } 682 682 683 683 /* Perform I/O control on an active 6pack channel. */ 684 - static int sixpack_ioctl(struct tty_struct *tty, struct file *file, 685 - unsigned int cmd, unsigned long arg) 684 + static int sixpack_ioctl(struct tty_struct *tty, unsigned int cmd, 685 + unsigned long arg) 686 686 { 687 687 struct sixpack *sp = sp_get(tty); 688 688 struct net_device *dev;
+2 -2
drivers/net/hamradio/mkiss.c
··· 804 804 } 805 805 806 806 /* Perform I/O control on an active ax25 channel. */ 807 - static int mkiss_ioctl(struct tty_struct *tty, struct file *file, 808 - unsigned int cmd, unsigned long arg) 807 + static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd, 808 + unsigned long arg) 809 809 { 810 810 struct mkiss *ax = mkiss_get(tty); 811 811 struct net_device *dev;
+1 -2
drivers/net/ppp/ppp_async.c
··· 281 281 */ 282 282 283 283 static int 284 - ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, 285 - unsigned int cmd, unsigned long arg) 284 + ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) 286 285 { 287 286 struct asyncppp *ap = ap_get(tty); 288 287 int err, val;
+1 -2
drivers/net/ppp/ppp_synctty.c
··· 274 274 } 275 275 276 276 static int 277 - ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, 278 - unsigned int cmd, unsigned long arg) 277 + ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) 279 278 { 280 279 struct syncppp *ap = sp_get(tty); 281 280 int __user *p = (int __user *)arg;
+2 -2
drivers/net/slip/slip.c
··· 1072 1072 #endif /* CONFIG_SLIP_MODE_SLIP6 */ 1073 1073 1074 1074 /* Perform I/O control on an active SLIP channel. */ 1075 - static int slip_ioctl(struct tty_struct *tty, struct file *file, 1076 - unsigned int cmd, unsigned long arg) 1075 + static int slip_ioctl(struct tty_struct *tty, unsigned int cmd, 1076 + unsigned long arg) 1077 1077 { 1078 1078 struct slip *sl = tty->disc_data; 1079 1079 unsigned int tmp;
+2 -2
drivers/tty/n_gsm.c
··· 2687 2687 return mask; 2688 2688 } 2689 2689 2690 - static int gsmld_ioctl(struct tty_struct *tty, struct file *file, 2691 - unsigned int cmd, unsigned long arg) 2690 + static int gsmld_ioctl(struct tty_struct *tty, unsigned int cmd, 2691 + unsigned long arg) 2692 2692 { 2693 2693 struct gsm_config c; 2694 2694 struct gsm_mux *gsm = tty->disc_data;
+2 -3
drivers/tty/n_hdlc.c
··· 572 572 /** 573 573 * n_hdlc_tty_ioctl - process IOCTL system call for the tty device. 574 574 * @tty: pointer to tty instance data 575 - * @file: pointer to open file object for device 576 575 * @cmd: IOCTL command code 577 576 * @arg: argument for IOCTL call (cmd dependent) 578 577 * 579 578 * Returns command dependent result. 580 579 */ 581 - static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, 582 - unsigned int cmd, unsigned long arg) 580 + static int n_hdlc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, 581 + unsigned long arg) 583 582 { 584 583 struct n_hdlc *n_hdlc = tty->disc_data; 585 584 int error = 0;
+2 -2
drivers/tty/n_tty.c
··· 2400 2400 return nr; 2401 2401 } 2402 2402 2403 - static int n_tty_ioctl(struct tty_struct *tty, struct file *file, 2404 - unsigned int cmd, unsigned long arg) 2403 + static int n_tty_ioctl(struct tty_struct *tty, unsigned int cmd, 2404 + unsigned long arg) 2405 2405 { 2406 2406 struct n_tty_data *ldata = tty->disc_data; 2407 2407 int retval;
+4 -4
drivers/tty/tty_io.c
··· 2811 2811 return hung_up_tty_ioctl(file, cmd, arg); 2812 2812 retval = -EINVAL; 2813 2813 if (ld->ops->ioctl) { 2814 - retval = ld->ops->ioctl(tty, file, cmd, arg); 2814 + retval = ld->ops->ioctl(tty, cmd, arg); 2815 2815 if (retval == -ENOIOCTLCMD) 2816 2816 retval = -ENOTTY; 2817 2817 } ··· 2990 2990 if (!ld) 2991 2991 return hung_up_tty_compat_ioctl(file, cmd, arg); 2992 2992 if (ld->ops->compat_ioctl) 2993 - retval = ld->ops->compat_ioctl(tty, file, cmd, arg); 2993 + retval = ld->ops->compat_ioctl(tty, cmd, arg); 2994 2994 if (retval == -ENOIOCTLCMD && ld->ops->ioctl) 2995 - retval = ld->ops->ioctl(tty, file, 2996 - (unsigned long)compat_ptr(cmd), arg); 2995 + retval = ld->ops->ioctl(tty, (unsigned long)compat_ptr(cmd), 2996 + arg); 2997 2997 tty_ldisc_deref(ld); 2998 2998 2999 2999 return retval;
+7 -8
include/linux/tty_ldisc.h
··· 45 45 * some processing on the characters first. If this function is 46 46 * not defined, the user will receive an EIO error. 47 47 * 48 - * int (*ioctl)(struct tty_struct * tty, struct file * file, 49 - * unsigned int cmd, unsigned long arg); 48 + * int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg); 50 49 * 51 50 * This function is called when the user requests an ioctl which 52 51 * is not handled by the tty layer or the low-level tty driver. ··· 55 56 * low-level driver can "grab" an ioctl request before the line 56 57 * discpline has a chance to see it. 57 58 * 58 - * int (*compat_ioctl)(struct tty_struct * tty, struct file * file, 59 - * unsigned int cmd, unsigned long arg); 59 + * int (*compat_ioctl)(struct tty_struct *tty, unsigned int cmd, 60 + * unsigned long arg); 60 61 * 61 62 * Process ioctl calls from 32-bit process on 64-bit system 62 63 * ··· 191 192 void **cookie, unsigned long offset); 192 193 ssize_t (*write)(struct tty_struct *tty, struct file *file, 193 194 const unsigned char *buf, size_t nr); 194 - int (*ioctl)(struct tty_struct *tty, struct file *file, 195 - unsigned int cmd, unsigned long arg); 196 - int (*compat_ioctl)(struct tty_struct *tty, struct file *file, 197 - unsigned int cmd, unsigned long arg); 195 + int (*ioctl)(struct tty_struct *tty, unsigned int cmd, 196 + unsigned long arg); 197 + int (*compat_ioctl)(struct tty_struct *tty, unsigned int cmd, 198 + unsigned long arg); 198 199 void (*set_termios)(struct tty_struct *tty, struct ktermios *old); 199 200 __poll_t (*poll)(struct tty_struct *, struct file *, 200 201 struct poll_table_struct *);
+2 -3
net/nfc/nci/uart.c
··· 317 317 * Arguments: 318 318 * 319 319 * tty pointer to tty instance data 320 - * file pointer to open file object for device 321 320 * cmd IOCTL command code 322 321 * arg argument for IOCTL call (cmd dependent) 323 322 * 324 323 * Return Value: Command dependent 325 324 */ 326 - static int nci_uart_tty_ioctl(struct tty_struct *tty, struct file *file, 327 - unsigned int cmd, unsigned long arg) 325 + static int nci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd, 326 + unsigned long arg) 328 327 { 329 328 struct nci_uart *nu = (void *)tty->disc_data; 330 329 int err = 0;