From 95350d03c4b3a672838412005e381ebe4c97a492 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 24 Mar 2020 15:56:05 +1100 Subject: [PATCH] proc-faster-open-read-close-with-permanent-files-checkpatch-fixes WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #12: Save 2 atomic ops, 1 allocation, 1 free per open/read/close sequence for such WARNING: braces {} are not necessary for single statement blocks #163: FILE: fs/proc/generic.c:536: + if (pde->proc_ops->proc_flags & PROC_ENTRY_PERMANENT) { + pde->flags |= PROC_ENTRY_PERMANENT; + } WARNING: line over 80 characters #203: FILE: fs/proc/generic.c:676: + WARN(1, "removing permanent /proc entry '%s'", de->name); WARNING: braces {} are not necessary for single statement blocks #207: FILE: fs/proc/generic.c:680: + if (S_ISDIR(de->mode)) { + parent->nlink--; + } WARNING: line over 80 characters #244: FILE: fs/proc/inode.c:198: +static loff_t pde_lseek(struct proc_dir_entry *pde, struct file *file, loff_t offset, int whence) WARNING: line over 80 characters #274: FILE: fs/proc/inode.c:222: +static ssize_t pde_read(struct proc_dir_entry *pde, struct file *file, char __user *buf, size_t count, loff_t *ppos) WARNING: line over 80 characters #303: FILE: fs/proc/inode.c:246: +static ssize_t pde_write(struct proc_dir_entry *pde, struct file *file, const char __user *buf, size_t count, loff_t *ppos) WARNING: line over 80 characters #332: FILE: fs/proc/inode.c:270: +static __poll_t pde_poll(struct proc_dir_entry *pde, struct file *file, struct poll_table_struct *pts) WARNING: line over 80 characters #361: FILE: fs/proc/inode.c:294: +static long pde_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg) WARNING: line over 80 characters #391: FILE: fs/proc/inode.c:319: +static long pde_compat_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg) WARNING: line over 80 characters #421: FILE: fs/proc/inode.c:343: +static int pde_mmap(struct proc_dir_entry *pde, struct file *file, struct vm_area_struct *vma) WARNING: line over 80 characters #452: FILE: fs/proc/inode.c:368: +pde_get_unmapped_area(struct proc_dir_entry *pde, struct file *file, unsigned long orig_addr, WARNING: line over 80 characters #489: FILE: fs/proc/inode.c:393: + return pde_get_unmapped_area(pde, file, orig_addr, len, pgoff, flags); WARNING: line over 80 characters #491: FILE: fs/proc/inode.c:395: + rv = pde_get_unmapped_area(pde, file, orig_addr, len, pgoff, flags); WARNING: braces {} are not necessary for single statement blocks #518: FILE: fs/proc/inode.c:470: + if (release) { + return release(inode, file); + } total: 0 errors, 15 warnings, 462 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. ./patches/proc-faster-open-read-close-with-permanent-files.patch has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please run checkpatch prior to sending patches Cc: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Stephen Rothwell --- fs/proc/generic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/proc/generic.c b/fs/proc/generic.c index f1e7dc6ed55680..4ed6dabdf6ffeb 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -533,9 +533,8 @@ struct proc_dir_entry *proc_create_reg(const char *name, umode_t mode, static inline void pde_set_flags(struct proc_dir_entry *pde) { - if (pde->proc_ops->proc_flags & PROC_ENTRY_PERMANENT) { + if (pde->proc_ops->proc_flags & PROC_ENTRY_PERMANENT) pde->flags |= PROC_ENTRY_PERMANENT; - } } struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, @@ -677,9 +676,8 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) de = NULL; } else { rb_erase(&de->subdir_node, &parent->subdir); - if (S_ISDIR(de->mode)) { + if (S_ISDIR(de->mode)) parent->nlink--; - } } } write_unlock(&proc_subdir_lock);