diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-09-26 18:04:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-04 06:36:07 -0400 |
commit | 621a5f7ad9cd1ce7933f1d302067cbd58354173c (patch) | |
tree | a9cd51d4b4e70286a339ffc463618d0f33279c67 /fs/debugfs | |
parent | 6e58f752a6502b43e039fd7df2c7c5cde8dde437 (diff) |
debugfs: Pass bool pointer to debugfs_create_bool()
Its a bit odd that debugfs_create_bool() takes 'u32 *' as an argument,
when all it needs is a boolean pointer.
It would be better to update this API to make it accept 'bool *'
instead, as that will make it more consistent and often more convenient.
Over that bool takes just a byte.
That required updates to all user sites as well, in the same commit
updating the API. regmap core was also using
debugfs_{read|write}_file_bool(), directly and variable types were
updated for that to be bool as well.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/debugfs')
-rw-r--r-- | fs/debugfs/file.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 6c55ade071c3..b70c20fae502 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -439,7 +439,7 @@ ssize_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 | bool *val = file->private_data; |
443 | 443 | ||
444 | if (*val) | 444 | if (*val) |
445 | buf[0] = 'Y'; | 445 | buf[0] = 'Y'; |
@@ -457,7 +457,7 @@ ssize_t debugfs_write_file_bool(struct file *file, const char __user *user_buf, | |||
457 | char buf[32]; | 457 | char buf[32]; |
458 | size_t buf_size; | 458 | size_t buf_size; |
459 | bool bv; | 459 | bool bv; |
460 | u32 *val = file->private_data; | 460 | bool *val = file->private_data; |
461 | 461 | ||
462 | buf_size = min(count, (sizeof(buf)-1)); | 462 | buf_size = min(count, (sizeof(buf)-1)); |
463 | if (copy_from_user(buf, user_buf, buf_size)) | 463 | if (copy_from_user(buf, user_buf, buf_size)) |
@@ -503,7 +503,7 @@ static const struct file_operations fops_bool = { | |||
503 | * code. | 503 | * code. |
504 | */ | 504 | */ |
505 | struct dentry *debugfs_create_bool(const char *name, umode_t mode, | 505 | struct dentry *debugfs_create_bool(const char *name, umode_t mode, |
506 | struct dentry *parent, u32 *value) | 506 | struct dentry *parent, bool *value) |
507 | { | 507 | { |
508 | return debugfs_create_file(name, mode, parent, value, &fops_bool); | 508 | return debugfs_create_file(name, mode, parent, value, &fops_bool); |
509 | } | 509 | } |