Re: [PATCH] binder: remove BINDER_DEBUG_ENTRY()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 30, 2018 at 5:26 PM Yangtao Li <tiny.windzz@xxxxxxxxx> wrote:
>
> We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
> such a macro,so remove BINDER_DEBUG_ENTRY.
>
> Signed-off-by: Yangtao Li <tiny.windzz@xxxxxxxxx>

Acked-by: Todd Kjos <tkjos@xxxxxxxxxxx>

> ---
>  drivers/android/binder.c | 48 ++++++++++++++--------------------------
>  1 file changed, 17 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index cb30a524d16d..5496b8e07234 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -94,22 +94,8 @@ static struct dentry *binder_debugfs_dir_entry_root;
>  static struct dentry *binder_debugfs_dir_entry_proc;
>  static atomic_t binder_last_id;
>
> -#define BINDER_DEBUG_ENTRY(name) \
> -static int binder_##name##_open(struct inode *inode, struct file *file) \
> -{ \
> -       return single_open(file, binder_##name##_show, inode->i_private); \
> -} \
> -\
> -static const struct file_operations binder_##name##_fops = { \
> -       .owner = THIS_MODULE, \
> -       .open = binder_##name##_open, \
> -       .read = seq_read, \
> -       .llseek = seq_lseek, \
> -       .release = single_release, \
> -}
> -
> -static int binder_proc_show(struct seq_file *m, void *unused);
> -BINDER_DEBUG_ENTRY(proc);
> +static int proc_show(struct seq_file *m, void *unused);
> +DEFINE_SHOW_ATTRIBUTE(proc);
>
>  /* This is only defined in include/asm-arm/sizes.h */
>  #ifndef SZ_1K
> @@ -4964,7 +4950,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
>                 proc->debugfs_entry = debugfs_create_file(strbuf, 0444,
>                         binder_debugfs_dir_entry_proc,
>                         (void *)(unsigned long)proc->pid,
> -                       &binder_proc_fops);
> +                       &proc_fops);
>         }
>
>         return 0;
> @@ -5592,7 +5578,7 @@ static void print_binder_proc_stats(struct seq_file *m,
>  }
>
>
> -static int binder_state_show(struct seq_file *m, void *unused)
> +static int state_show(struct seq_file *m, void *unused)
>  {
>         struct binder_proc *proc;
>         struct binder_node *node;
> @@ -5631,7 +5617,7 @@ static int binder_state_show(struct seq_file *m, void *unused)
>         return 0;
>  }
>
> -static int binder_stats_show(struct seq_file *m, void *unused)
> +static int stats_show(struct seq_file *m, void *unused)
>  {
>         struct binder_proc *proc;
>
> @@ -5647,7 +5633,7 @@ static int binder_stats_show(struct seq_file *m, void *unused)
>         return 0;
>  }
>
> -static int binder_transactions_show(struct seq_file *m, void *unused)
> +static int transactions_show(struct seq_file *m, void *unused)
>  {
>         struct binder_proc *proc;
>
> @@ -5660,7 +5646,7 @@ static int binder_transactions_show(struct seq_file *m, void *unused)
>         return 0;
>  }
>
> -static int binder_proc_show(struct seq_file *m, void *unused)
> +static int proc_show(struct seq_file *m, void *unused)
>  {
>         struct binder_proc *itr;
>         int pid = (unsigned long)m->private;
> @@ -5703,7 +5689,7 @@ static void print_binder_transaction_log_entry(struct seq_file *m,
>                         "\n" : " (incomplete)\n");
>  }
>
> -static int binder_transaction_log_show(struct seq_file *m, void *unused)
> +static int transaction_log_show(struct seq_file *m, void *unused)
>  {
>         struct binder_transaction_log *log = m->private;
>         unsigned int log_cur = atomic_read(&log->cur);
> @@ -5735,10 +5721,10 @@ static const struct file_operations binder_fops = {
>         .release = binder_release,
>  };
>
> -BINDER_DEBUG_ENTRY(state);
> -BINDER_DEBUG_ENTRY(stats);
> -BINDER_DEBUG_ENTRY(transactions);
> -BINDER_DEBUG_ENTRY(transaction_log);
> +DEFINE_SHOW_ATTRIBUTE(state);
> +DEFINE_SHOW_ATTRIBUTE(stats);
> +DEFINE_SHOW_ATTRIBUTE(transactions);
> +DEFINE_SHOW_ATTRIBUTE(transaction_log);
>
>  static int __init init_binder_device(const char *name)
>  {
> @@ -5792,27 +5778,27 @@ static int __init binder_init(void)
>                                     0444,
>                                     binder_debugfs_dir_entry_root,
>                                     NULL,
> -                                   &binder_state_fops);
> +                                   &state_fops);
>                 debugfs_create_file("stats",
>                                     0444,
>                                     binder_debugfs_dir_entry_root,
>                                     NULL,
> -                                   &binder_stats_fops);
> +                                   &stats_fops);
>                 debugfs_create_file("transactions",
>                                     0444,
>                                     binder_debugfs_dir_entry_root,
>                                     NULL,
> -                                   &binder_transactions_fops);
> +                                   &transactions_fops);
>                 debugfs_create_file("transaction_log",
>                                     0444,
>                                     binder_debugfs_dir_entry_root,
>                                     &binder_transaction_log,
> -                                   &binder_transaction_log_fops);
> +                                   &transaction_log_fops);
>                 debugfs_create_file("failed_transaction_log",
>                                     0444,
>                                     binder_debugfs_dir_entry_root,
>                                     &binder_transaction_log_failed,
> -                                   &binder_transaction_log_fops);
> +                                   &transaction_log_fops);
>         }
>
>         /*
> --
> 2.17.0
>
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux