aboutsummaryrefslogtreecommitdiffstats
path: root/fs/debugfs
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.wolfsonmicro.com>2015-06-23 09:32:54 -0400
committerMark Brown <broonie@kernel.org>2015-07-20 13:44:50 -0400
commit0642ef6f2992eba46c41abb5ceb7d4fa14ba888e (patch)
treefd4fe479afa4f75a2b599ef3f450d9fee5b7ff6e /fs/debugfs
parentbc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff)
debugfs: Export bool read/write functions
The file read/write functions for bools have no special dependencies on debugfs internals and are sufficiently non-trivial to be worth exporting so clients can re-use the implementation. Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'fs/debugfs')
-rw-r--r--fs/debugfs/file.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 284f9aa0028b..6c55ade071c3 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -435,8 +435,8 @@ struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
435} 435}
436EXPORT_SYMBOL_GPL(debugfs_create_atomic_t); 436EXPORT_SYMBOL_GPL(debugfs_create_atomic_t);
437 437
438static ssize_t read_file_bool(struct file *file, char __user *user_buf, 438ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf,
439 size_t count, loff_t *ppos) 439 size_t count, loff_t *ppos)
440{ 440{
441 char buf[3]; 441 char buf[3];
442 u32 *val = file->private_data; 442 u32 *val = file->private_data;
@@ -449,9 +449,10 @@ static ssize_t read_file_bool(struct file *file, char __user *user_buf,
449 buf[2] = 0x00; 449 buf[2] = 0x00;
450 return simple_read_from_buffer(user_buf, count, ppos, buf, 2); 450 return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
451} 451}
452EXPORT_SYMBOL_GPL(debugfs_read_file_bool);
452 453
453static ssize_t write_file_bool(struct file *file, const char __user *user_buf, 454ssize_t debugfs_write_file_bool(struct file *file, const char __user *user_buf,
454 size_t count, loff_t *ppos) 455 size_t count, loff_t *ppos)
455{ 456{
456 char buf[32]; 457 char buf[32];
457 size_t buf_size; 458 size_t buf_size;
@@ -468,10 +469,11 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf,
468 469
469 return count; 470 return count;
470} 471}
472EXPORT_SYMBOL_GPL(debugfs_write_file_bool);
471 473
472static const struct file_operations fops_bool = { 474static const struct file_operations fops_bool = {
473 .read = read_file_bool, 475 .read = debugfs_read_file_bool,
474 .write = write_file_bool, 476 .write = debugfs_write_file_bool,
475 .open = simple_open, 477 .open = simple_open,
476 .llseek = default_llseek, 478 .llseek = default_llseek,
477}; 479};