Commit 79e55bcf authored by Ralf Baechle's avatar Ralf Baechle

[MIPS] Cleanup inode->r_dev usage.

    
imajor()/iminor() should be used instead of accessing r_dev directly.

Based on patch from Eric Sesterhenn (snakebyte@gmx.de).
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent b7755659
...@@ -398,15 +398,14 @@ ssize_t rtlx_write(int index, void *buffer, size_t count, int user) ...@@ -398,15 +398,14 @@ ssize_t rtlx_write(int index, void *buffer, size_t count, int user)
static int file_open(struct inode *inode, struct file *filp) static int file_open(struct inode *inode, struct file *filp)
{ {
int minor = MINOR(inode->i_rdev); int minor = iminor(inode);
return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1); return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1);
} }
static int file_release(struct inode *inode, struct file *filp) static int file_release(struct inode *inode, struct file *filp)
{ {
int minor; int minor = iminor(inode);
minor = MINOR(inode->i_rdev);
return rtlx_release(minor); return rtlx_release(minor);
} }
...@@ -416,7 +415,7 @@ static unsigned int file_poll(struct file *file, poll_table * wait) ...@@ -416,7 +415,7 @@ static unsigned int file_poll(struct file *file, poll_table * wait)
int minor; int minor;
unsigned int mask = 0; unsigned int mask = 0;
minor = MINOR(file->f_dentry->d_inode->i_rdev); minor = iminor(file->f_dentry->d_inode);
poll_wait(file, &channel_wqs[minor].rt_queue, wait); poll_wait(file, &channel_wqs[minor].rt_queue, wait);
poll_wait(file, &channel_wqs[minor].lx_queue, wait); poll_wait(file, &channel_wqs[minor].lx_queue, wait);
...@@ -438,7 +437,7 @@ static unsigned int file_poll(struct file *file, poll_table * wait) ...@@ -438,7 +437,7 @@ static unsigned int file_poll(struct file *file, poll_table * wait)
static ssize_t file_read(struct file *file, char __user * buffer, size_t count, static ssize_t file_read(struct file *file, char __user * buffer, size_t count,
loff_t * ppos) loff_t * ppos)
{ {
int minor = MINOR(file->f_dentry->d_inode->i_rdev); int minor = iminor(file->f_dentry->d_inode);
/* data available? */ /* data available? */
if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) { if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) {
...@@ -455,7 +454,7 @@ static ssize_t file_write(struct file *file, const char __user * buffer, ...@@ -455,7 +454,7 @@ static ssize_t file_write(struct file *file, const char __user * buffer,
struct rtlx_channel *rt; struct rtlx_channel *rt;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
minor = MINOR(file->f_dentry->d_inode->i_rdev); minor = iminor(file->f_dentry->d_inode);
rt = &rtlx->channel[minor]; rt = &rtlx->channel[minor];
/* any space left... */ /* any space left... */
......
...@@ -1072,7 +1072,7 @@ static int vpe_open(struct inode *inode, struct file *filp) ...@@ -1072,7 +1072,7 @@ static int vpe_open(struct inode *inode, struct file *filp)
struct vpe_notifications *not; struct vpe_notifications *not;
/* assume only 1 device at the mo. */ /* assume only 1 device at the mo. */
if ((minor = MINOR(inode->i_rdev)) != 1) { if ((minor = iminor(inode)) != 1) {
printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); printk(KERN_WARNING "VPE loader: only vpe1 is supported\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1133,7 +1133,7 @@ static int vpe_release(struct inode *inode, struct file *filp) ...@@ -1133,7 +1133,7 @@ static int vpe_release(struct inode *inode, struct file *filp)
struct vpe *v; struct vpe *v;
Elf_Ehdr *hdr; Elf_Ehdr *hdr;
minor = MINOR(inode->i_rdev); minor = iminor(inode);
if ((v = get_vpe(minor)) == NULL) if ((v = get_vpe(minor)) == NULL)
return -ENODEV; return -ENODEV;
...@@ -1174,7 +1174,7 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, ...@@ -1174,7 +1174,7 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer,
size_t ret = count; size_t ret = count;
struct vpe *v; struct vpe *v;
minor = MINOR(file->f_dentry->d_inode->i_rdev); minor = iminor(file->f_dentry->d_inode);
if ((v = get_vpe(minor)) == NULL) if ((v = get_vpe(minor)) == NULL)
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment