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>
This commit is contained in:
Jiri Slaby 2021-11-22 10:45:29 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 5db96ef23b
Коммит d78328bcc4
14 изменённых файлов: 33 добавлений и 40 удалений

Просмотреть файл

@ -739,14 +739,13 @@ static int hci_uart_set_flags(struct hci_uart *hu, unsigned long flags)
* Arguments: * Arguments:
* *
* tty pointer to tty instance data * tty pointer to tty instance data
* file pointer to open file object for device
* cmd IOCTL command code * cmd IOCTL command code
* arg argument for IOCTL call (cmd dependent) * arg argument for IOCTL call (cmd dependent)
* *
* Return Value: Command dependent * Return Value: Command dependent
*/ */
static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file *file, static int hci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct hci_uart *hu = tty->disc_data; struct hci_uart *hu = tty->disc_data;
int err = 0; int err = 0;

Просмотреть файл

@ -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 * serport_ldisc_ioctl() allows to set the port protocol, and device ID
*/ */
static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file, static int serport_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
if (cmd == SPIOCSTYPE) { if (cmd == SPIOCSTYPE) {
unsigned long type; unsigned long type;
@ -226,7 +226,6 @@ static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
#define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t) #define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t)
static int serport_ldisc_compat_ioctl(struct tty_struct *tty, static int serport_ldisc_compat_ioctl(struct tty_struct *tty,
struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
if (cmd == COMPAT_SPIOCSTYPE) { if (cmd == COMPAT_SPIOCSTYPE) {

Просмотреть файл

@ -670,8 +670,8 @@ static void slcan_hangup(struct tty_struct *tty)
} }
/* Perform I/O control on an active SLCAN channel. */ /* Perform I/O control on an active SLCAN channel. */
static int slcan_ioctl(struct tty_struct *tty, struct file *file, static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct slcan *sl = (struct slcan *) tty->disc_data; struct slcan *sl = (struct slcan *) tty->disc_data;
unsigned int tmp; unsigned int tmp;

Просмотреть файл

@ -681,8 +681,8 @@ static void sixpack_close(struct tty_struct *tty)
} }
/* Perform I/O control on an active 6pack channel. */ /* Perform I/O control on an active 6pack channel. */
static int sixpack_ioctl(struct tty_struct *tty, struct file *file, static int sixpack_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct sixpack *sp = sp_get(tty); struct sixpack *sp = sp_get(tty);
struct net_device *dev; struct net_device *dev;

Просмотреть файл

@ -804,8 +804,8 @@ static void mkiss_close(struct tty_struct *tty)
} }
/* Perform I/O control on an active ax25 channel. */ /* Perform I/O control on an active ax25 channel. */
static int mkiss_ioctl(struct tty_struct *tty, struct file *file, static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct mkiss *ax = mkiss_get(tty); struct mkiss *ax = mkiss_get(tty);
struct net_device *dev; struct net_device *dev;

Просмотреть файл

@ -281,8 +281,7 @@ ppp_asynctty_write(struct tty_struct *tty, struct file *file,
*/ */
static int static int
ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct asyncppp *ap = ap_get(tty); struct asyncppp *ap = ap_get(tty);
int err, val; int err, val;

Просмотреть файл

@ -274,8 +274,7 @@ ppp_sync_write(struct tty_struct *tty, struct file *file,
} }
static int static int
ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct syncppp *ap = sp_get(tty); struct syncppp *ap = sp_get(tty);
int __user *p = (int __user *)arg; int __user *p = (int __user *)arg;

Просмотреть файл

@ -1072,8 +1072,8 @@ static void slip_unesc6(struct slip *sl, unsigned char s)
#endif /* CONFIG_SLIP_MODE_SLIP6 */ #endif /* CONFIG_SLIP_MODE_SLIP6 */
/* Perform I/O control on an active SLIP channel. */ /* Perform I/O control on an active SLIP channel. */
static int slip_ioctl(struct tty_struct *tty, struct file *file, static int slip_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct slip *sl = tty->disc_data; struct slip *sl = tty->disc_data;
unsigned int tmp; unsigned int tmp;

Просмотреть файл

@ -2687,8 +2687,8 @@ static __poll_t gsmld_poll(struct tty_struct *tty, struct file *file,
return mask; return mask;
} }
static int gsmld_ioctl(struct tty_struct *tty, struct file *file, static int gsmld_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct gsm_config c; struct gsm_config c;
struct gsm_mux *gsm = tty->disc_data; struct gsm_mux *gsm = tty->disc_data;

Просмотреть файл

@ -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. * n_hdlc_tty_ioctl - process IOCTL system call for the tty device.
* @tty: pointer to tty instance data * @tty: pointer to tty instance data
* @file: pointer to open file object for device
* @cmd: IOCTL command code * @cmd: IOCTL command code
* @arg: argument for IOCTL call (cmd dependent) * @arg: argument for IOCTL call (cmd dependent)
* *
* Returns command dependent result. * Returns command dependent result.
*/ */
static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, static int n_hdlc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct n_hdlc *n_hdlc = tty->disc_data; struct n_hdlc *n_hdlc = tty->disc_data;
int error = 0; int error = 0;

Просмотреть файл

@ -2400,8 +2400,8 @@ static unsigned long inq_canon(struct n_tty_data *ldata)
return nr; return nr;
} }
static int n_tty_ioctl(struct tty_struct *tty, struct file *file, static int n_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct n_tty_data *ldata = tty->disc_data; struct n_tty_data *ldata = tty->disc_data;
int retval; int retval;

Просмотреть файл

@ -2811,7 +2811,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return hung_up_tty_ioctl(file, cmd, arg); return hung_up_tty_ioctl(file, cmd, arg);
retval = -EINVAL; retval = -EINVAL;
if (ld->ops->ioctl) { if (ld->ops->ioctl) {
retval = ld->ops->ioctl(tty, file, cmd, arg); retval = ld->ops->ioctl(tty, cmd, arg);
if (retval == -ENOIOCTLCMD) if (retval == -ENOIOCTLCMD)
retval = -ENOTTY; retval = -ENOTTY;
} }
@ -2990,10 +2990,10 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
if (!ld) if (!ld)
return hung_up_tty_compat_ioctl(file, cmd, arg); return hung_up_tty_compat_ioctl(file, cmd, arg);
if (ld->ops->compat_ioctl) 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) if (retval == -ENOIOCTLCMD && ld->ops->ioctl)
retval = ld->ops->ioctl(tty, file, retval = ld->ops->ioctl(tty, (unsigned long)compat_ptr(cmd),
(unsigned long)compat_ptr(cmd), arg); arg);
tty_ldisc_deref(ld); tty_ldisc_deref(ld);
return retval; return retval;

Просмотреть файл

@ -45,8 +45,7 @@ struct tty_struct;
* some processing on the characters first. If this function is * some processing on the characters first. If this function is
* not defined, the user will receive an EIO error. * not defined, the user will receive an EIO error.
* *
* int (*ioctl)(struct tty_struct * tty, struct file * file, * int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
* unsigned int cmd, unsigned long arg);
* *
* This function is called when the user requests an ioctl which * This function is called when the user requests an ioctl which
* is not handled by the tty layer or the low-level tty driver. * 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 * low-level driver can "grab" an ioctl request before the line
* discpline has a chance to see it. * discpline has a chance to see it.
* *
* int (*compat_ioctl)(struct tty_struct * tty, struct file * file, * int (*compat_ioctl)(struct tty_struct *tty, unsigned int cmd,
* unsigned int cmd, unsigned long arg); * unsigned long arg);
* *
* Process ioctl calls from 32-bit process on 64-bit system * Process ioctl calls from 32-bit process on 64-bit system
* *
@ -192,10 +191,10 @@ struct tty_ldisc_ops {
void **cookie, unsigned long offset); void **cookie, unsigned long offset);
ssize_t (*write)(struct tty_struct *tty, struct file *file, ssize_t (*write)(struct tty_struct *tty, struct file *file,
const unsigned char *buf, size_t nr); const unsigned char *buf, size_t nr);
int (*ioctl)(struct tty_struct *tty, struct file *file, int (*ioctl)(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg); unsigned long arg);
int (*compat_ioctl)(struct tty_struct *tty, struct file *file, int (*compat_ioctl)(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg); unsigned long arg);
void (*set_termios)(struct tty_struct *tty, struct ktermios *old); void (*set_termios)(struct tty_struct *tty, struct ktermios *old);
__poll_t (*poll)(struct tty_struct *, struct file *, __poll_t (*poll)(struct tty_struct *, struct file *,
struct poll_table_struct *); struct poll_table_struct *);

Просмотреть файл

@ -317,14 +317,13 @@ static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
* Arguments: * Arguments:
* *
* tty pointer to tty instance data * tty pointer to tty instance data
* file pointer to open file object for device
* cmd IOCTL command code * cmd IOCTL command code
* arg argument for IOCTL call (cmd dependent) * arg argument for IOCTL call (cmd dependent)
* *
* Return Value: Command dependent * Return Value: Command dependent
*/ */
static int nci_uart_tty_ioctl(struct tty_struct *tty, struct file *file, static int nci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
struct nci_uart *nu = (void *)tty->disc_data; struct nci_uart *nu = (void *)tty->disc_data;
int err = 0; int err = 0;