diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-02-14 11:08:28 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-09 12:31:26 -0500 |
commit | e23500dd34f2094e48dc6b53971b94dad5e8cfbf (patch) | |
tree | 45fb90e695df29741c43c792b8f55b047397fdb0 | |
parent | 0a9e8adea7946ef5fcb9f433dad0df7b512111d9 (diff) |
USB: host: whci: Re-use DEFINE_SHOW_ATTRIBUTE() macro
...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/whci/debug.c | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/drivers/usb/host/whci/debug.c b/drivers/usb/host/whci/debug.c index f154e5791bfd..8ddfe3f1f693 100644 --- a/drivers/usb/host/whci/debug.c +++ b/drivers/usb/host/whci/debug.c | |||
@@ -72,7 +72,7 @@ static void qset_print(struct seq_file *s, struct whc_qset *qset) | |||
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | static int di_print(struct seq_file *s, void *p) | 75 | static int di_show(struct seq_file *s, void *p) |
76 | { | 76 | { |
77 | struct whc *whc = s->private; | 77 | struct whc *whc = s->private; |
78 | int d; | 78 | int d; |
@@ -91,8 +91,9 @@ static int di_print(struct seq_file *s, void *p) | |||
91 | } | 91 | } |
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | DEFINE_SHOW_ATTRIBUTE(di); | ||
94 | 95 | ||
95 | static int asl_print(struct seq_file *s, void *p) | 96 | static int asl_show(struct seq_file *s, void *p) |
96 | { | 97 | { |
97 | struct whc *whc = s->private; | 98 | struct whc *whc = s->private; |
98 | struct whc_qset *qset; | 99 | struct whc_qset *qset; |
@@ -103,8 +104,9 @@ static int asl_print(struct seq_file *s, void *p) | |||
103 | 104 | ||
104 | return 0; | 105 | return 0; |
105 | } | 106 | } |
107 | DEFINE_SHOW_ATTRIBUTE(asl); | ||
106 | 108 | ||
107 | static int pzl_print(struct seq_file *s, void *p) | 109 | static int pzl_show(struct seq_file *s, void *p) |
108 | { | 110 | { |
109 | struct whc *whc = s->private; | 111 | struct whc *whc = s->private; |
110 | struct whc_qset *qset; | 112 | struct whc_qset *qset; |
@@ -118,45 +120,7 @@ static int pzl_print(struct seq_file *s, void *p) | |||
118 | } | 120 | } |
119 | return 0; | 121 | return 0; |
120 | } | 122 | } |
121 | 123 | DEFINE_SHOW_ATTRIBUTE(pzl); | |
122 | static int di_open(struct inode *inode, struct file *file) | ||
123 | { | ||
124 | return single_open(file, di_print, inode->i_private); | ||
125 | } | ||
126 | |||
127 | static int asl_open(struct inode *inode, struct file *file) | ||
128 | { | ||
129 | return single_open(file, asl_print, inode->i_private); | ||
130 | } | ||
131 | |||
132 | static int pzl_open(struct inode *inode, struct file *file) | ||
133 | { | ||
134 | return single_open(file, pzl_print, inode->i_private); | ||
135 | } | ||
136 | |||
137 | static const struct file_operations di_fops = { | ||
138 | .open = di_open, | ||
139 | .read = seq_read, | ||
140 | .llseek = seq_lseek, | ||
141 | .release = single_release, | ||
142 | .owner = THIS_MODULE, | ||
143 | }; | ||
144 | |||
145 | static const struct file_operations asl_fops = { | ||
146 | .open = asl_open, | ||
147 | .read = seq_read, | ||
148 | .llseek = seq_lseek, | ||
149 | .release = single_release, | ||
150 | .owner = THIS_MODULE, | ||
151 | }; | ||
152 | |||
153 | static const struct file_operations pzl_fops = { | ||
154 | .open = pzl_open, | ||
155 | .read = seq_read, | ||
156 | .llseek = seq_lseek, | ||
157 | .release = single_release, | ||
158 | .owner = THIS_MODULE, | ||
159 | }; | ||
160 | 124 | ||
161 | void whc_dbg_init(struct whc *whc) | 125 | void whc_dbg_init(struct whc *whc) |
162 | { | 126 | { |