diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-02-14 11:08:17 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-09 12:27:55 -0500 |
| commit | e8c56f274da4d2ac8ba55e482f41b73148d5f885 (patch) | |
| tree | cb81232637636d3f6fe26f6b30d41660d7ef66cd /drivers/usb/chipidea | |
| parent | 02cad961cae556357e4a63b11f849e80418c1ffc (diff) | |
USB: chipidea: Re-use DEFINE_SHOW_ATTRIBUTE() macro
...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.
Cc: Peter Chen <Peter.Chen@nxp.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea')
| -rw-r--r-- | drivers/usb/chipidea/debug.c | 65 |
1 files changed, 5 insertions, 60 deletions
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index c9e1a165ed82..ce648cb3ed94 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c | |||
| @@ -45,18 +45,7 @@ static int ci_device_show(struct seq_file *s, void *data) | |||
| 45 | 45 | ||
| 46 | return 0; | 46 | return 0; |
| 47 | } | 47 | } |
| 48 | 48 | DEFINE_SHOW_ATTRIBUTE(ci_device); | |
| 49 | static int ci_device_open(struct inode *inode, struct file *file) | ||
| 50 | { | ||
| 51 | return single_open(file, ci_device_show, inode->i_private); | ||
| 52 | } | ||
| 53 | |||
| 54 | static const struct file_operations ci_device_fops = { | ||
| 55 | .open = ci_device_open, | ||
| 56 | .read = seq_read, | ||
| 57 | .llseek = seq_lseek, | ||
| 58 | .release = single_release, | ||
| 59 | }; | ||
| 60 | 49 | ||
| 61 | /** | 50 | /** |
| 62 | * ci_port_test_show: reads port test mode | 51 | * ci_port_test_show: reads port test mode |
| @@ -156,18 +145,7 @@ static int ci_qheads_show(struct seq_file *s, void *data) | |||
| 156 | 145 | ||
| 157 | return 0; | 146 | return 0; |
| 158 | } | 147 | } |
| 159 | 148 | DEFINE_SHOW_ATTRIBUTE(ci_qheads); | |
| 160 | static int ci_qheads_open(struct inode *inode, struct file *file) | ||
| 161 | { | ||
| 162 | return single_open(file, ci_qheads_show, inode->i_private); | ||
| 163 | } | ||
| 164 | |||
| 165 | static const struct file_operations ci_qheads_fops = { | ||
| 166 | .open = ci_qheads_open, | ||
| 167 | .read = seq_read, | ||
| 168 | .llseek = seq_lseek, | ||
| 169 | .release = single_release, | ||
| 170 | }; | ||
| 171 | 149 | ||
| 172 | /** | 150 | /** |
| 173 | * ci_requests_show: DMA contents of all requests currently queued (all endpts) | 151 | * ci_requests_show: DMA contents of all requests currently queued (all endpts) |
| @@ -204,18 +182,7 @@ static int ci_requests_show(struct seq_file *s, void *data) | |||
| 204 | 182 | ||
| 205 | return 0; | 183 | return 0; |
| 206 | } | 184 | } |
| 207 | 185 | DEFINE_SHOW_ATTRIBUTE(ci_requests); | |
| 208 | static int ci_requests_open(struct inode *inode, struct file *file) | ||
| 209 | { | ||
| 210 | return single_open(file, ci_requests_show, inode->i_private); | ||
| 211 | } | ||
| 212 | |||
| 213 | static const struct file_operations ci_requests_fops = { | ||
| 214 | .open = ci_requests_open, | ||
| 215 | .read = seq_read, | ||
| 216 | .llseek = seq_lseek, | ||
| 217 | .release = single_release, | ||
| 218 | }; | ||
| 219 | 186 | ||
| 220 | static int ci_otg_show(struct seq_file *s, void *unused) | 187 | static int ci_otg_show(struct seq_file *s, void *unused) |
| 221 | { | 188 | { |
| @@ -278,18 +245,7 @@ static int ci_otg_show(struct seq_file *s, void *unused) | |||
| 278 | 245 | ||
| 279 | return 0; | 246 | return 0; |
| 280 | } | 247 | } |
| 281 | 248 | DEFINE_SHOW_ATTRIBUTE(ci_otg); | |
| 282 | static int ci_otg_open(struct inode *inode, struct file *file) | ||
| 283 | { | ||
| 284 | return single_open(file, ci_otg_show, inode->i_private); | ||
| 285 | } | ||
| 286 | |||
| 287 | static const struct file_operations ci_otg_fops = { | ||
| 288 | .open = ci_otg_open, | ||
| 289 | .read = seq_read, | ||
| 290 | .llseek = seq_lseek, | ||
| 291 | .release = single_release, | ||
| 292 | }; | ||
| 293 | 249 | ||
| 294 | static int ci_role_show(struct seq_file *s, void *data) | 250 | static int ci_role_show(struct seq_file *s, void *data) |
| 295 | { | 251 | { |
| @@ -376,18 +332,7 @@ static int ci_registers_show(struct seq_file *s, void *unused) | |||
| 376 | 332 | ||
| 377 | return 0; | 333 | return 0; |
| 378 | } | 334 | } |
| 379 | 335 | DEFINE_SHOW_ATTRIBUTE(ci_registers); | |
| 380 | static int ci_registers_open(struct inode *inode, struct file *file) | ||
| 381 | { | ||
| 382 | return single_open(file, ci_registers_show, inode->i_private); | ||
| 383 | } | ||
| 384 | |||
| 385 | static const struct file_operations ci_registers_fops = { | ||
| 386 | .open = ci_registers_open, | ||
| 387 | .read = seq_read, | ||
| 388 | .llseek = seq_lseek, | ||
| 389 | .release = single_release, | ||
| 390 | }; | ||
| 391 | 336 | ||
| 392 | /** | 337 | /** |
| 393 | * dbg_create_files: initializes the attribute interface | 338 | * dbg_create_files: initializes the attribute interface |
