Commit 13309764 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Andrew Morton

proc: use __auto_type more

Switch away from quite chatty declarations using typeof_member().

In theory this is faster to compile too because there is no macro
expansion and there is less type checking.

Link: https://lkml.kernel.org/r/81bf02fd-8724-4f4d-a2bb-c59620b7d716@p183Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent dab2214f
...@@ -303,9 +303,7 @@ static ssize_t proc_reg_read_iter(struct kiocb *iocb, struct iov_iter *iter) ...@@ -303,9 +303,7 @@ static ssize_t proc_reg_read_iter(struct kiocb *iocb, struct iov_iter *iter)
static ssize_t pde_read(struct proc_dir_entry *pde, struct file *file, char __user *buf, size_t count, loff_t *ppos) static ssize_t pde_read(struct proc_dir_entry *pde, struct file *file, char __user *buf, size_t count, loff_t *ppos)
{ {
typeof_member(struct proc_ops, proc_read) read; __auto_type read = pde->proc_ops->proc_read;
read = pde->proc_ops->proc_read;
if (read) if (read)
return read(file, buf, count, ppos); return read(file, buf, count, ppos);
return -EIO; return -EIO;
...@@ -327,9 +325,7 @@ static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, ...@@ -327,9 +325,7 @@ static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count,
static ssize_t pde_write(struct proc_dir_entry *pde, struct file *file, const char __user *buf, size_t count, loff_t *ppos) static ssize_t pde_write(struct proc_dir_entry *pde, struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
typeof_member(struct proc_ops, proc_write) write; __auto_type write = pde->proc_ops->proc_write;
write = pde->proc_ops->proc_write;
if (write) if (write)
return write(file, buf, count, ppos); return write(file, buf, count, ppos);
return -EIO; return -EIO;
...@@ -351,9 +347,7 @@ static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t ...@@ -351,9 +347,7 @@ static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t
static __poll_t pde_poll(struct proc_dir_entry *pde, struct file *file, struct poll_table_struct *pts) static __poll_t pde_poll(struct proc_dir_entry *pde, struct file *file, struct poll_table_struct *pts)
{ {
typeof_member(struct proc_ops, proc_poll) poll; __auto_type poll = pde->proc_ops->proc_poll;
poll = pde->proc_ops->proc_poll;
if (poll) if (poll)
return poll(file, pts); return poll(file, pts);
return DEFAULT_POLLMASK; return DEFAULT_POLLMASK;
...@@ -375,9 +369,7 @@ static __poll_t proc_reg_poll(struct file *file, struct poll_table_struct *pts) ...@@ -375,9 +369,7 @@ static __poll_t proc_reg_poll(struct file *file, struct poll_table_struct *pts)
static long pde_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg) static long pde_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg)
{ {
typeof_member(struct proc_ops, proc_ioctl) ioctl; __auto_type ioctl = pde->proc_ops->proc_ioctl;
ioctl = pde->proc_ops->proc_ioctl;
if (ioctl) if (ioctl)
return ioctl(file, cmd, arg); return ioctl(file, cmd, arg);
return -ENOTTY; return -ENOTTY;
...@@ -400,9 +392,7 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne ...@@ -400,9 +392,7 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static long pde_compat_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg) static long pde_compat_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg)
{ {
typeof_member(struct proc_ops, proc_compat_ioctl) compat_ioctl; __auto_type compat_ioctl = pde->proc_ops->proc_compat_ioctl;
compat_ioctl = pde->proc_ops->proc_compat_ioctl;
if (compat_ioctl) if (compat_ioctl)
return compat_ioctl(file, cmd, arg); return compat_ioctl(file, cmd, arg);
return -ENOTTY; return -ENOTTY;
...@@ -424,9 +414,7 @@ static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned ...@@ -424,9 +414,7 @@ static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned
static int pde_mmap(struct proc_dir_entry *pde, struct file *file, struct vm_area_struct *vma) static int pde_mmap(struct proc_dir_entry *pde, struct file *file, struct vm_area_struct *vma)
{ {
typeof_member(struct proc_ops, proc_mmap) mmap; __auto_type mmap = pde->proc_ops->proc_mmap;
mmap = pde->proc_ops->proc_mmap;
if (mmap) if (mmap)
return mmap(file, vma); return mmap(file, vma);
return -EIO; return -EIO;
...@@ -483,7 +471,6 @@ static int proc_reg_open(struct inode *inode, struct file *file) ...@@ -483,7 +471,6 @@ static int proc_reg_open(struct inode *inode, struct file *file)
struct proc_dir_entry *pde = PDE(inode); struct proc_dir_entry *pde = PDE(inode);
int rv = 0; int rv = 0;
typeof_member(struct proc_ops, proc_open) open; typeof_member(struct proc_ops, proc_open) open;
typeof_member(struct proc_ops, proc_release) release;
struct pde_opener *pdeo; struct pde_opener *pdeo;
if (!pde->proc_ops->proc_lseek) if (!pde->proc_ops->proc_lseek)
...@@ -510,7 +497,7 @@ static int proc_reg_open(struct inode *inode, struct file *file) ...@@ -510,7 +497,7 @@ static int proc_reg_open(struct inode *inode, struct file *file)
if (!use_pde(pde)) if (!use_pde(pde))
return -ENOENT; return -ENOENT;
release = pde->proc_ops->proc_release; __auto_type release = pde->proc_ops->proc_release;
if (release) { if (release) {
pdeo = kmem_cache_alloc(pde_opener_cache, GFP_KERNEL); pdeo = kmem_cache_alloc(pde_opener_cache, GFP_KERNEL);
if (!pdeo) { if (!pdeo) {
...@@ -547,9 +534,7 @@ static int proc_reg_release(struct inode *inode, struct file *file) ...@@ -547,9 +534,7 @@ static int proc_reg_release(struct inode *inode, struct file *file)
struct pde_opener *pdeo; struct pde_opener *pdeo;
if (pde_is_permanent(pde)) { if (pde_is_permanent(pde)) {
typeof_member(struct proc_ops, proc_release) release; __auto_type release = pde->proc_ops->proc_release;
release = pde->proc_ops->proc_release;
if (release) { if (release) {
return release(inode, file); return release(inode, file);
} }
......
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