aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_io.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-02-27 16:59:05 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-27 16:59:05 -0500
commit6131ffaa1f091415b7a24abb01f033d9c0a727f4 (patch)
tree8983574e9458a5328a30900cb3466e3648421355 /drivers/tty/tty_io.c
parent45e09bd51b2be1fbb86c2e3d5bb00d32744f1ecb (diff)
more file_inode() open-coded instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r--drivers/tty/tty_io.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index fd473639ab70..05400acbc456 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -960,11 +960,10 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
960 loff_t *ppos) 960 loff_t *ppos)
961{ 961{
962 int i; 962 int i;
963 struct inode *inode = file->f_path.dentry->d_inode;
964 struct tty_struct *tty = file_tty(file); 963 struct tty_struct *tty = file_tty(file);
965 struct tty_ldisc *ld; 964 struct tty_ldisc *ld;
966 965
967 if (tty_paranoia_check(tty, inode, "tty_read")) 966 if (tty_paranoia_check(tty, file_inode(file), "tty_read"))
968 return -EIO; 967 return -EIO;
969 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags))) 968 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags)))
970 return -EIO; 969 return -EIO;
@@ -1132,12 +1131,11 @@ void tty_write_message(struct tty_struct *tty, char *msg)
1132static ssize_t tty_write(struct file *file, const char __user *buf, 1131static ssize_t tty_write(struct file *file, const char __user *buf,
1133 size_t count, loff_t *ppos) 1132 size_t count, loff_t *ppos)
1134{ 1133{
1135 struct inode *inode = file->f_path.dentry->d_inode;
1136 struct tty_struct *tty = file_tty(file); 1134 struct tty_struct *tty = file_tty(file);
1137 struct tty_ldisc *ld; 1135 struct tty_ldisc *ld;
1138 ssize_t ret; 1136 ssize_t ret;
1139 1137
1140 if (tty_paranoia_check(tty, inode, "tty_write")) 1138 if (tty_paranoia_check(tty, file_inode(file), "tty_write"))
1141 return -EIO; 1139 return -EIO;
1142 if (!tty || !tty->ops->write || 1140 if (!tty || !tty->ops->write ||
1143 (test_bit(TTY_IO_ERROR, &tty->flags))) 1141 (test_bit(TTY_IO_ERROR, &tty->flags)))
@@ -2047,7 +2045,7 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait)
2047 struct tty_ldisc *ld; 2045 struct tty_ldisc *ld;
2048 int ret = 0; 2046 int ret = 0;
2049 2047
2050 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_poll")) 2048 if (tty_paranoia_check(tty, file_inode(filp), "tty_poll"))
2051 return 0; 2049 return 0;
2052 2050
2053 ld = tty_ldisc_ref_wait(tty); 2051 ld = tty_ldisc_ref_wait(tty);
@@ -2063,7 +2061,7 @@ static int __tty_fasync(int fd, struct file *filp, int on)
2063 unsigned long flags; 2061 unsigned long flags;
2064 int retval = 0; 2062 int retval = 0;
2065 2063
2066 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync")) 2064 if (tty_paranoia_check(tty, file_inode(filp), "tty_fasync"))
2067 goto out; 2065 goto out;
2068 2066
2069 retval = fasync_helper(fd, filp, on, &tty->fasync); 2067 retval = fasync_helper(fd, filp, on, &tty->fasync);
@@ -2637,9 +2635,8 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2637 void __user *p = (void __user *)arg; 2635 void __user *p = (void __user *)arg;
2638 int retval; 2636 int retval;
2639 struct tty_ldisc *ld; 2637 struct tty_ldisc *ld;
2640 struct inode *inode = file->f_dentry->d_inode;
2641 2638
2642 if (tty_paranoia_check(tty, inode, "tty_ioctl")) 2639 if (tty_paranoia_check(tty, file_inode(file), "tty_ioctl"))
2643 return -EINVAL; 2640 return -EINVAL;
2644 2641
2645 real_tty = tty_pair_get_tty(tty); 2642 real_tty = tty_pair_get_tty(tty);
@@ -2780,12 +2777,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2780static long tty_compat_ioctl(struct file *file, unsigned int cmd, 2777static long tty_compat_ioctl(struct file *file, unsigned int cmd,
2781 unsigned long arg) 2778 unsigned long arg)
2782{ 2779{
2783 struct inode *inode = file->f_dentry->d_inode;
2784 struct tty_struct *tty = file_tty(file); 2780 struct tty_struct *tty = file_tty(file);
2785 struct tty_ldisc *ld; 2781 struct tty_ldisc *ld;
2786 int retval = -ENOIOCTLCMD; 2782 int retval = -ENOIOCTLCMD;
2787 2783
2788 if (tty_paranoia_check(tty, inode, "tty_ioctl")) 2784 if (tty_paranoia_check(tty, file_inode(file), "tty_ioctl"))
2789 return -EINVAL; 2785 return -EINVAL;
2790 2786
2791 if (tty->ops->compat_ioctl) { 2787 if (tty->ops->compat_ioctl) {