11e2e000d76f1699b79575ab31040fd0950c5ba9
[oweals/openwrt.git] /
1 From 4940fd338dc53324603c0bd2642b0a3864baa5fe Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Fri, 1 Jun 2018 13:10:04 +0200
4 Subject: [PATCH 386/454] staging: vc04_services: no need to save the log
5  debufs dentries
6
7 commit 3b93c0f4b6accb8105152900d7e414593a8b0c79 upstream
8
9 The log entry dentries are only set, never referenced, so no need to
10 keep them around.  Remove the pointer from struct
11 vchiq_debugfs_log_entry as it is not needed anymore and get rid of the
12 separate vchiq_debugfs_create_log_entries() function as it is only used
13 in one place.
14
15 Suggested-by: Eric Anholt <eric@anholt.net>
16 Cc: Stefan Wahren <stefan.wahren@i2se.com>
17 Cc: Kees Cook <keescook@chromium.org>
18 Cc: Dan Carpenter <dan.carpenter@oracle.com>
19 Cc: Arnd Bergmann <arnd@arndb.de>
20 Cc: Keerthi Reddy <keerthigd4990@gmail.com>
21 Cc: linux-rpi-kernel@lists.infradead.org
22 Cc: linux-arm-kernel@lists.infradead.org
23 Reviewed-by: Eric Anholt <eric@anholt.net>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26  .../interface/vchiq_arm/vchiq_debugfs.c       | 29 +++++++------------
27  1 file changed, 10 insertions(+), 19 deletions(-)
28
29 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
30 +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
31 @@ -60,7 +60,6 @@ struct dentry *vchiq_dbg_clients;
32  struct vchiq_debugfs_log_entry {
33         const char *name;
34         void *plevel;
35 -       struct dentry *dir;
36  };
37  
38  static struct vchiq_debugfs_log_entry vchiq_debugfs_log_entries[] = {
39 @@ -145,23 +144,6 @@ static const struct file_operations debu
40         .release        = single_release,
41  };
42  
43 -/* create an entry under <debugfs>/vchiq/log for each log category */
44 -static void vchiq_debugfs_create_log_entries(struct dentry *top)
45 -{
46 -       struct dentry *dir;
47 -       size_t i;
48 -
49 -       dir = debugfs_create_dir("log", vchiq_dbg_dir);
50 -
51 -       for (i = 0; i < n_log_entries; i++) {
52 -               dir = debugfs_create_file(vchiq_debugfs_log_entries[i].name,
53 -                                         0644, dir,
54 -                                         vchiq_debugfs_log_entries[i].plevel,
55 -                                         &debugfs_log_fops);
56 -               vchiq_debugfs_log_entries[i].dir = dir;
57 -       }
58 -}
59 -
60  static int debugfs_usecount_show(struct seq_file *f, void *offset)
61  {
62         VCHIQ_INSTANCE_T instance = f->private;
63 @@ -269,10 +251,19 @@ void vchiq_debugfs_remove_instance(VCHIQ
64  
65  void vchiq_debugfs_init(void)
66  {
67 +       struct dentry *dir;
68 +       int i;
69 +
70         vchiq_dbg_dir = debugfs_create_dir("vchiq", NULL);
71         vchiq_dbg_clients = debugfs_create_dir("clients", vchiq_dbg_dir);
72  
73 -       vchiq_debugfs_create_log_entries(vchiq_dbg_dir);
74 +       /* create an entry under <debugfs>/vchiq/log for each log category */
75 +       dir = debugfs_create_dir("log", vchiq_dbg_dir);
76 +
77 +       for (i = 0; i < n_log_entries; i++)
78 +               debugfs_create_file(vchiq_debugfs_log_entries[i].name, 0644,
79 +                                   dir, vchiq_debugfs_log_entries[i].plevel,
80 +                                   &debugfs_log_fops);
81  }
82  
83  /* remove all the debugfs entries */