tty: remove file from tty_ldisc_ops::ioctl and compat_ioctl
authorJiri Slaby <jslaby@suse.cz>
Mon, 22 Nov 2021 09:45:29 +0000 (10:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Nov 2021 17:36:27 +0000 (18:36 +0100)
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>
14 files changed:
drivers/bluetooth/hci_ldisc.c
drivers/input/serio/serport.c
drivers/net/can/slcan.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/mkiss.c
drivers/net/ppp/ppp_async.c
drivers/net/ppp/ppp_synctty.c
drivers/net/slip/slip.c
drivers/tty/n_gsm.c
drivers/tty/n_hdlc.c
drivers/tty/n_tty.c
drivers/tty/tty_io.c
include/linux/tty_ldisc.h
net/nfc/nci/uart.c

index ecdf8e034351d690f4f8ff5a2a44cc46b1c46d19..f537673ede17440acafc13e3d74040c989e5a733 100644 (file)
@@ -739,14 +739,13 @@ static int hci_uart_set_flags(struct hci_uart *hu, unsigned long flags)
  * Arguments:
  *
  *    tty        pointer to tty instance data
- *    file       pointer to open file object for device
  *    cmd        IOCTL command code
  *    arg        argument for IOCTL call (cmd dependent)
  *
  * Return Value:    Command dependent
  */
-static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file *file,
-                             unsigned int cmd, unsigned long arg)
+static int hci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
+                             unsigned long arg)
 {
        struct hci_uart *hu = tty->disc_data;
        int err = 0;
index 17eb8f2aa48dd324ee2fb262a99eaad9511deea9..669a728095b8bba77e1a24e41f740e3d4081e18e 100644 (file)
@@ -207,8 +207,8 @@ static void serport_set_type(struct tty_struct *tty, unsigned long type)
  * serport_ldisc_ioctl() allows to set the port protocol, and device ID
  */
 
-static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file,
-                              unsigned int cmd, unsigned long arg)
+static int serport_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd,
+                              unsigned long arg)
 {
        if (cmd == SPIOCSTYPE) {
                unsigned long type;
@@ -226,7 +226,6 @@ static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file,
 #ifdef CONFIG_COMPAT
 #define COMPAT_SPIOCSTYPE      _IOW('q', 0x01, compat_ulong_t)
 static int serport_ldisc_compat_ioctl(struct tty_struct *tty,
-                                      struct file *file,
                                       unsigned int cmd, unsigned long arg)
 {
        if (cmd == COMPAT_SPIOCSTYPE) {
index 9a4ebda30510ef2f0ea1de1ab3a620e6514938e4..113763790ac9c97031ae03228a328b78bce1978b 100644 (file)
@@ -670,8 +670,8 @@ static void slcan_hangup(struct tty_struct *tty)
 }
 
 /* Perform I/O control on an active SLCAN channel. */
-static int slcan_ioctl(struct tty_struct *tty, struct file *file,
-                      unsigned int cmd, unsigned long arg)
+static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd,
+                      unsigned long arg)
 {
        struct slcan *sl = (struct slcan *) tty->disc_data;
        unsigned int tmp;
index 8a19a06b505d125dcc88e7accd1765b4decb7530..b1fc153125d9d3d37870858d45c13030915e1899 100644 (file)
@@ -681,8 +681,8 @@ static void sixpack_close(struct tty_struct *tty)
 }
 
 /* Perform I/O control on an active 6pack channel. */
-static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static int sixpack_ioctl(struct tty_struct *tty, unsigned int cmd,
+               unsigned long arg)
 {
        struct sixpack *sp = sp_get(tty);
        struct net_device *dev;
index e2b332b54f06d2babe198e51e03b02aed0980122..894b5f92b85feed51b5680375ae911bf5dc318a1 100644 (file)
@@ -804,8 +804,8 @@ static void mkiss_close(struct tty_struct *tty)
 }
 
 /* Perform I/O control on an active ax25 channel. */
-static int mkiss_ioctl(struct tty_struct *tty, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd,
+               unsigned long arg)
 {
        struct mkiss *ax = mkiss_get(tty);
        struct net_device *dev;
index f4429b93a9c84c7c6764b21a55d3d6fe3293a4cf..15a179631903f31e0db40facbac02779776ff318 100644 (file)
@@ -281,8 +281,7 @@ ppp_asynctty_write(struct tty_struct *tty, struct file *file,
  */
 
 static int
-ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
-                  unsigned int cmd, unsigned long arg)
+ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
 {
        struct asyncppp *ap = ap_get(tty);
        int err, val;
index b3a71b409a800f2b705cd63c13ece994f55bb54a..18283b7b94bcd429b942135f2e66dd780d729aaa 100644 (file)
@@ -274,8 +274,7 @@ ppp_sync_write(struct tty_struct *tty, struct file *file,
 }
 
 static int
-ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
-                 unsigned int cmd, unsigned long arg)
+ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
 {
        struct syncppp *ap = sp_get(tty);
        int __user *p = (int __user *)arg;
index 9f3b4c1aa5ce888091f6239565cd7e60701dbabc..98f586f910fb199fe9e60a6436060b9a689721f2 100644 (file)
@@ -1072,8 +1072,8 @@ static void slip_unesc6(struct slip *sl, unsigned char s)
 #endif /* CONFIG_SLIP_MODE_SLIP6 */
 
 /* Perform I/O control on an active SLIP channel. */
-static int slip_ioctl(struct tty_struct *tty, struct file *file,
-                                       unsigned int cmd, unsigned long arg)
+static int slip_ioctl(struct tty_struct *tty, unsigned int cmd,
+               unsigned long arg)
 {
        struct slip *sl = tty->disc_data;
        unsigned int tmp;
index 68e6df27d2e324b407b70af7e477d2cf042c40c7..ba27b274c9674bc6410056804fed0fd4cf59b4f7 100644 (file)
@@ -2687,8 +2687,8 @@ static __poll_t gsmld_poll(struct tty_struct *tty, struct file *file,
        return mask;
 }
 
-static int gsmld_ioctl(struct tty_struct *tty, struct file *file,
-                      unsigned int cmd, unsigned long arg)
+static int gsmld_ioctl(struct tty_struct *tty, unsigned int cmd,
+                      unsigned long arg)
 {
        struct gsm_config c;
        struct gsm_mux *gsm = tty->disc_data;
index 7e0884ecc74f522ba7ac1a9a7198e8977daf582c..a66915032e7ecb81331dcc7b6568b4a3bda1dbc2 100644 (file)
@@ -572,14 +572,13 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
 /**
  * n_hdlc_tty_ioctl - process IOCTL system call for the tty device.
  * @tty: pointer to tty instance data
- * @file: pointer to open file object for device
  * @cmd: IOCTL command code
  * @arg: argument for IOCTL call (cmd dependent)
  *
  * Returns command dependent result.
  */
-static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
-                           unsigned int cmd, unsigned long arg)
+static int n_hdlc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
+                           unsigned long arg)
 {
        struct n_hdlc *n_hdlc = tty->disc_data;
        int error = 0;
index 5be6d02dc690b17a8420d2c3caa2f37d6144468f..5b0f50373fc6c2e0179269a7ca28f1555e156299 100644 (file)
@@ -2400,8 +2400,8 @@ static unsigned long inq_canon(struct n_tty_data *ldata)
        return nr;
 }
 
-static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
-                      unsigned int cmd, unsigned long arg)
+static int n_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
+                      unsigned long arg)
 {
        struct n_tty_data *ldata = tty->disc_data;
        int retval;
index 99cad1560876bb0e98712f437871c2556a0fb263..3c2349b2089c0bd58a6b8971f2640fd8ecaeea07 100644 (file)
@@ -2811,7 +2811,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                return hung_up_tty_ioctl(file, cmd, arg);
        retval = -EINVAL;
        if (ld->ops->ioctl) {
-               retval = ld->ops->ioctl(tty, file, cmd, arg);
+               retval = ld->ops->ioctl(tty, cmd, arg);
                if (retval == -ENOIOCTLCMD)
                        retval = -ENOTTY;
        }
@@ -2990,10 +2990,10 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
        if (!ld)
                return hung_up_tty_compat_ioctl(file, cmd, arg);
        if (ld->ops->compat_ioctl)
-               retval = ld->ops->compat_ioctl(tty, file, cmd, arg);
+               retval = ld->ops->compat_ioctl(tty, cmd, arg);
        if (retval == -ENOIOCTLCMD && ld->ops->ioctl)
-               retval = ld->ops->ioctl(tty, file,
-                               (unsigned long)compat_ptr(cmd), arg);
+               retval = ld->ops->ioctl(tty, (unsigned long)compat_ptr(cmd),
+                               arg);
        tty_ldisc_deref(ld);
 
        return retval;
index b85d84fb5f4956221389968ffed3f1945aed1087..25f07017bbad152618d042f43e551c8ce789a8a0 100644 (file)
@@ -45,8 +45,7 @@ struct tty_struct;
  *     some processing on the characters first.  If this function is
  *     not defined, the user will receive an EIO error.
  *
- * int (*ioctl)(struct tty_struct * tty, struct file * file,
- *              unsigned int cmd, unsigned long arg);
+ * int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
  *
  *     This function is called when the user requests an ioctl which
  *     is not handled by the tty layer or the low-level tty driver.
@@ -56,8 +55,8 @@ struct tty_struct;
  *     low-level driver can "grab" an ioctl request before the line
  *     discpline has a chance to see it.
  *
- * int (*compat_ioctl)(struct tty_struct * tty, struct file * file,
- *                     unsigned int cmd, unsigned long arg);
+ * int (*compat_ioctl)(struct tty_struct *tty, unsigned int cmd,
+ *                     unsigned long arg);
  *
  *     Process ioctl calls from 32-bit process on 64-bit system
  *
@@ -192,10 +191,10 @@ struct tty_ldisc_ops {
                        void **cookie, unsigned long offset);
        ssize_t (*write)(struct tty_struct *tty, struct file *file,
                         const unsigned char *buf, size_t nr);
-       int     (*ioctl)(struct tty_struct *tty, struct file *file,
-                        unsigned int cmd, unsigned long arg);
-       int     (*compat_ioctl)(struct tty_struct *tty, struct file *file,
-                               unsigned int cmd, unsigned long arg);
+       int     (*ioctl)(struct tty_struct *tty, unsigned int cmd,
+                       unsigned long arg);
+       int     (*compat_ioctl)(struct tty_struct *tty, unsigned int cmd,
+                       unsigned long arg);
        void    (*set_termios)(struct tty_struct *tty, struct ktermios *old);
        __poll_t (*poll)(struct tty_struct *, struct file *,
                             struct poll_table_struct *);
index c027c76d493cb0409821512e3f0dd1a67a875e40..cc8fa9e3615976469dd95baa29943b9b564af8ed 100644 (file)
@@ -317,14 +317,13 @@ static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
  * Arguments:
  *
  *    tty        pointer to tty instance data
- *    file       pointer to open file object for device
  *    cmd        IOCTL command code
  *    arg        argument for IOCTL call (cmd dependent)
  *
  * Return Value:    Command dependent
  */
-static int nci_uart_tty_ioctl(struct tty_struct *tty, struct file *file,
-                             unsigned int cmd, unsigned long arg)
+static int nci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
+                             unsigned long arg)
 {
        struct nci_uart *nu = (void *)tty->disc_data;
        int err = 0;