diff options
| author | Joe Perches <joe@perches.com> | 2017-12-19 13:15:07 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-09 10:33:31 -0500 |
| commit | b6b996b6cdeecf7e1646c87422e04e446ddce124 (patch) | |
| tree | ef1b873db80200b159624ce2611137024abf1672 /lib | |
| parent | 353c6ddaa963d453dc56ced2f3cbfd9bd57409c7 (diff) | |
treewide: Use DEVICE_ATTR_RW
Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
Done with perl script:
$ git grep -w --name-only DEVICE_ATTR | \
xargs perl -i -e 'local $/; while (<>) { s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*\1_show\s*,\s*\1_store\s*\)/DEVICE_ATTR_RW(\1)/g; print;}'
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/test_firmware.c | 14 | ||||
| -rw-r--r-- | lib/test_kmod.c | 14 |
2 files changed, 10 insertions, 18 deletions
diff --git a/lib/test_firmware.c b/lib/test_firmware.c index 64a4c76cba2b..964784dc1602 100644 --- a/lib/test_firmware.c +++ b/lib/test_firmware.c | |||
| @@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device *dev, | |||
| 359 | { | 359 | { |
| 360 | return config_test_show_str(buf, test_fw_config->name); | 360 | return config_test_show_str(buf, test_fw_config->name); |
| 361 | } | 361 | } |
| 362 | static DEVICE_ATTR(config_name, 0644, config_name_show, config_name_store); | 362 | static DEVICE_ATTR_RW(config_name); |
| 363 | 363 | ||
| 364 | static ssize_t config_num_requests_store(struct device *dev, | 364 | static ssize_t config_num_requests_store(struct device *dev, |
| 365 | struct device_attribute *attr, | 365 | struct device_attribute *attr, |
| @@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct device *dev, | |||
| 388 | { | 388 | { |
| 389 | return test_dev_config_show_u8(buf, test_fw_config->num_requests); | 389 | return test_dev_config_show_u8(buf, test_fw_config->num_requests); |
| 390 | } | 390 | } |
| 391 | static DEVICE_ATTR(config_num_requests, 0644, config_num_requests_show, | 391 | static DEVICE_ATTR_RW(config_num_requests); |
| 392 | config_num_requests_store); | ||
| 393 | 392 | ||
| 394 | static ssize_t config_sync_direct_store(struct device *dev, | 393 | static ssize_t config_sync_direct_store(struct device *dev, |
| 395 | struct device_attribute *attr, | 394 | struct device_attribute *attr, |
| @@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct device *dev, | |||
| 411 | { | 410 | { |
| 412 | return test_dev_config_show_bool(buf, test_fw_config->sync_direct); | 411 | return test_dev_config_show_bool(buf, test_fw_config->sync_direct); |
| 413 | } | 412 | } |
| 414 | static DEVICE_ATTR(config_sync_direct, 0644, config_sync_direct_show, | 413 | static DEVICE_ATTR_RW(config_sync_direct); |
| 415 | config_sync_direct_store); | ||
| 416 | 414 | ||
| 417 | static ssize_t config_send_uevent_store(struct device *dev, | 415 | static ssize_t config_send_uevent_store(struct device *dev, |
| 418 | struct device_attribute *attr, | 416 | struct device_attribute *attr, |
| @@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct device *dev, | |||
| 428 | { | 426 | { |
| 429 | return test_dev_config_show_bool(buf, test_fw_config->send_uevent); | 427 | return test_dev_config_show_bool(buf, test_fw_config->send_uevent); |
| 430 | } | 428 | } |
| 431 | static DEVICE_ATTR(config_send_uevent, 0644, config_send_uevent_show, | 429 | static DEVICE_ATTR_RW(config_send_uevent); |
| 432 | config_send_uevent_store); | ||
| 433 | 430 | ||
| 434 | static ssize_t config_read_fw_idx_store(struct device *dev, | 431 | static ssize_t config_read_fw_idx_store(struct device *dev, |
| 435 | struct device_attribute *attr, | 432 | struct device_attribute *attr, |
| @@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct device *dev, | |||
| 445 | { | 442 | { |
| 446 | return test_dev_config_show_u8(buf, test_fw_config->read_fw_idx); | 443 | return test_dev_config_show_u8(buf, test_fw_config->read_fw_idx); |
| 447 | } | 444 | } |
| 448 | static DEVICE_ATTR(config_read_fw_idx, 0644, config_read_fw_idx_show, | 445 | static DEVICE_ATTR_RW(config_read_fw_idx); |
| 449 | config_read_fw_idx_store); | ||
| 450 | 446 | ||
| 451 | 447 | ||
| 452 | static ssize_t trigger_request_store(struct device *dev, | 448 | static ssize_t trigger_request_store(struct device *dev, |
diff --git a/lib/test_kmod.c b/lib/test_kmod.c index 337f408b4de6..e372b97eee13 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c | |||
| @@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct device *dev, | |||
| 694 | return config_test_show_str(&test_dev->config_mutex, buf, | 694 | return config_test_show_str(&test_dev->config_mutex, buf, |
| 695 | config->test_driver); | 695 | config->test_driver); |
| 696 | } | 696 | } |
| 697 | static DEVICE_ATTR(config_test_driver, 0644, config_test_driver_show, | 697 | static DEVICE_ATTR_RW(config_test_driver); |
| 698 | config_test_driver_store); | ||
| 699 | 698 | ||
| 700 | static ssize_t config_test_fs_store(struct device *dev, | 699 | static ssize_t config_test_fs_store(struct device *dev, |
| 701 | struct device_attribute *attr, | 700 | struct device_attribute *attr, |
| @@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device *dev, | |||
| 726 | return config_test_show_str(&test_dev->config_mutex, buf, | 725 | return config_test_show_str(&test_dev->config_mutex, buf, |
| 727 | config->test_fs); | 726 | config->test_fs); |
| 728 | } | 727 | } |
| 729 | static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show, | 728 | static DEVICE_ATTR_RW(config_test_fs); |
| 730 | config_test_fs_store); | ||
| 731 | 729 | ||
| 732 | static int trigger_config_run_type(struct kmod_test_device *test_dev, | 730 | static int trigger_config_run_type(struct kmod_test_device *test_dev, |
| 733 | enum kmod_test_case test_case, | 731 | enum kmod_test_case test_case, |
| @@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct device *dev, | |||
| 1012 | 1010 | ||
| 1013 | return test_dev_config_show_int(test_dev, buf, config->num_threads); | 1011 | return test_dev_config_show_int(test_dev, buf, config->num_threads); |
| 1014 | } | 1012 | } |
| 1015 | static DEVICE_ATTR(config_num_threads, 0644, config_num_threads_show, | 1013 | static DEVICE_ATTR_RW(config_num_threads); |
| 1016 | config_num_threads_store); | ||
| 1017 | 1014 | ||
| 1018 | static ssize_t config_test_case_store(struct device *dev, | 1015 | static ssize_t config_test_case_store(struct device *dev, |
| 1019 | struct device_attribute *attr, | 1016 | struct device_attribute *attr, |
| @@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct device *dev, | |||
| 1037 | 1034 | ||
| 1038 | return test_dev_config_show_uint(test_dev, buf, config->test_case); | 1035 | return test_dev_config_show_uint(test_dev, buf, config->test_case); |
| 1039 | } | 1036 | } |
| 1040 | static DEVICE_ATTR(config_test_case, 0644, config_test_case_show, | 1037 | static DEVICE_ATTR_RW(config_test_case); |
| 1041 | config_test_case_store); | ||
| 1042 | 1038 | ||
| 1043 | static ssize_t test_result_show(struct device *dev, | 1039 | static ssize_t test_result_show(struct device *dev, |
| 1044 | struct device_attribute *attr, | 1040 | struct device_attribute *attr, |
| @@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device *dev, | |||
| 1049 | 1045 | ||
| 1050 | return test_dev_config_show_int(test_dev, buf, config->test_result); | 1046 | return test_dev_config_show_int(test_dev, buf, config->test_result); |
| 1051 | } | 1047 | } |
| 1052 | static DEVICE_ATTR(test_result, 0644, test_result_show, test_result_store); | 1048 | static DEVICE_ATTR_RW(test_result); |
| 1053 | 1049 | ||
| 1054 | #define TEST_KMOD_DEV_ATTR(name) &dev_attr_##name.attr | 1050 | #define TEST_KMOD_DEV_ATTR(name) &dev_attr_##name.attr |
| 1055 | 1051 | ||
