diff options
author | Ping Cheng <pinglinux@gmail.com> | 2014-09-10 15:40:30 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-09-11 04:24:13 -0400 |
commit | 37449adc582441f5ff1bbd95e6a8357073fae86b (patch) | |
tree | c36f70a4f670f59ef4aebe197739a0292da87f29 /drivers/hid/wacom_sys.c | |
parent | e0984bc376d84190d631d0a4f81215e48fa3a902 (diff) |
HID: wacom - Clean up of sysfs
changed to scnprintf(buf, PAGE_SIZE, ... ) as suggested in sysfs.txt
for show functions
Signed-off-by: Paul A. Tessier <phernost@gmail.com>
Signed-Off-by: Ping Cheng <pingc@wacom.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/wacom_sys.c')
-rw-r--r-- | drivers/hid/wacom_sys.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 779fd32c05d2..0a04c9a3e5b7 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -605,7 +605,8 @@ static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ | |||
605 | { \ | 605 | { \ |
606 | struct hid_device *hdev = container_of(dev, struct hid_device, dev);\ | 606 | struct hid_device *hdev = container_of(dev, struct hid_device, dev);\ |
607 | struct wacom *wacom = hid_get_drvdata(hdev); \ | 607 | struct wacom *wacom = hid_get_drvdata(hdev); \ |
608 | return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ | 608 | return scnprintf(buf, PAGE_SIZE, "%d\n", \ |
609 | wacom->led.select[SET_ID]); \ | ||
609 | } \ | 610 | } \ |
610 | static DEVICE_ATTR(status_led##SET_ID##_select, DEV_ATTR_RW_PERM, \ | 611 | static DEVICE_ATTR(status_led##SET_ID##_select, DEV_ATTR_RW_PERM, \ |
611 | wacom_led##SET_ID##_select_show, \ | 612 | wacom_led##SET_ID##_select_show, \ |
@@ -644,8 +645,15 @@ static ssize_t wacom_##name##_luminance_store(struct device *dev, \ | |||
644 | return wacom_luminance_store(wacom, &wacom->led.field, \ | 645 | return wacom_luminance_store(wacom, &wacom->led.field, \ |
645 | buf, count); \ | 646 | buf, count); \ |
646 | } \ | 647 | } \ |
648 | static ssize_t wacom_##name##_luminance_show(struct device *dev, \ | ||
649 | struct device_attribute *attr, char *buf) \ | ||
650 | { \ | ||
651 | struct wacom *wacom = dev_get_drvdata(dev); \ | ||
652 | return scnprintf(buf, PAGE_SIZE, "%d\n", wacom->led.field); \ | ||
653 | } \ | ||
647 | static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM, \ | 654 | static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM, \ |
648 | NULL, wacom_##name##_luminance_store) | 655 | wacom_##name##_luminance_show, \ |
656 | wacom_##name##_luminance_store) | ||
649 | 657 | ||
650 | DEVICE_LUMINANCE_ATTR(status0, llv); | 658 | DEVICE_LUMINANCE_ATTR(status0, llv); |
651 | DEVICE_LUMINANCE_ATTR(status1, hlv); | 659 | DEVICE_LUMINANCE_ATTR(status1, hlv); |