diff options
author | Christoph Hellwig <hch@lst.de> | 2018-05-15 09:57:23 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:23:35 -0400 |
commit | 3f3942aca6da351a12543aa776467791b63b3a78 (patch) | |
tree | 31030e086ea36920e07078ea2289b9b72c0b2939 /drivers/acpi/button.c | |
parent | 44414d82cfe0f68cb59d0a42f599ccd893ae0032 (diff) |
proc: introduce proc_create_single{,_data}
Variants of proc_create{,_data} that directly take a seq_file show
callback and drastically reduces the boilerplate code in the callers.
All trivial callers converted over.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/acpi/button.c')
-rw-r--r-- | drivers/acpi/button.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index f1cc4f9d31cd..2345a5ee2dbb 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -263,19 +263,6 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | |||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | ||
267 | { | ||
268 | return single_open(file, acpi_button_state_seq_show, PDE_DATA(inode)); | ||
269 | } | ||
270 | |||
271 | static const struct file_operations acpi_button_state_fops = { | ||
272 | .owner = THIS_MODULE, | ||
273 | .open = acpi_button_state_open_fs, | ||
274 | .read = seq_read, | ||
275 | .llseek = seq_lseek, | ||
276 | .release = single_release, | ||
277 | }; | ||
278 | |||
279 | static int acpi_button_add_fs(struct acpi_device *device) | 266 | static int acpi_button_add_fs(struct acpi_device *device) |
280 | { | 267 | { |
281 | struct acpi_button *button = acpi_driver_data(device); | 268 | struct acpi_button *button = acpi_driver_data(device); |
@@ -311,9 +298,9 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
311 | } | 298 | } |
312 | 299 | ||
313 | /* create /proc/acpi/button/lid/LID/state */ | 300 | /* create /proc/acpi/button/lid/LID/state */ |
314 | entry = proc_create_data(ACPI_BUTTON_FILE_STATE, | 301 | entry = proc_create_single_data(ACPI_BUTTON_FILE_STATE, S_IRUGO, |
315 | S_IRUGO, acpi_device_dir(device), | 302 | acpi_device_dir(device), acpi_button_state_seq_show, |
316 | &acpi_button_state_fops, device); | 303 | device); |
317 | if (!entry) { | 304 | if (!entry) { |
318 | ret = -ENODEV; | 305 | ret = -ENODEV; |
319 | goto remove_dev_dir; | 306 | goto remove_dev_dir; |