Commit 37449adc authored by Ping Cheng's avatar Ping Cheng Committed by Jiri Kosina

HID: wacom - Clean up of sysfs

changed to scnprintf(buf, PAGE_SIZE, ... ) as suggested in sysfs.txt
for show functions
Signed-off-by: default avatarPaul A. Tessier <phernost@gmail.com>
Signed-Off-by: default avatarPing Cheng <pingc@wacom.com>
Tested-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent e0984bc3
...@@ -605,7 +605,8 @@ static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ ...@@ -605,7 +605,8 @@ static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \
{ \ { \
struct hid_device *hdev = container_of(dev, struct hid_device, dev);\ struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
struct wacom *wacom = hid_get_drvdata(hdev); \ struct wacom *wacom = hid_get_drvdata(hdev); \
return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ return scnprintf(buf, PAGE_SIZE, "%d\n", \
wacom->led.select[SET_ID]); \
} \ } \
static DEVICE_ATTR(status_led##SET_ID##_select, DEV_ATTR_RW_PERM, \ static DEVICE_ATTR(status_led##SET_ID##_select, DEV_ATTR_RW_PERM, \
wacom_led##SET_ID##_select_show, \ wacom_led##SET_ID##_select_show, \
...@@ -644,8 +645,15 @@ static ssize_t wacom_##name##_luminance_store(struct device *dev, \ ...@@ -644,8 +645,15 @@ static ssize_t wacom_##name##_luminance_store(struct device *dev, \
return wacom_luminance_store(wacom, &wacom->led.field, \ return wacom_luminance_store(wacom, &wacom->led.field, \
buf, count); \ buf, count); \
} \ } \
static ssize_t wacom_##name##_luminance_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct wacom *wacom = dev_get_drvdata(dev); \
return scnprintf(buf, PAGE_SIZE, "%d\n", wacom->led.field); \
} \
static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM, \ static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM, \
NULL, wacom_##name##_luminance_store) wacom_##name##_luminance_show, \
wacom_##name##_luminance_store)
DEVICE_LUMINANCE_ATTR(status0, llv); DEVICE_LUMINANCE_ATTR(status0, llv);
DEVICE_LUMINANCE_ATTR(status1, hlv); DEVICE_LUMINANCE_ATTR(status1, hlv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment