diff options
Diffstat (limited to 'drivers/usb/misc/cytherm.c')
-rw-r--r-- | drivers/usb/misc/cytherm.c | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c index 66be86077292..8b15ab5e1450 100644 --- a/drivers/usb/misc/cytherm.c +++ b/drivers/usb/misc/cytherm.c @@ -78,7 +78,7 @@ static int vendor_command(struct usb_device *dev, unsigned char request, #define BRIGHTNESS 0x2c /* RAM location for brightness value */ #define BRIGHTNESS_SEM 0x2b /* RAM location for brightness semaphore */ -static ssize_t show_brightness(struct device *dev, struct device_attribute *attr, char *buf) +static ssize_t brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(dev); struct usb_cytherm *cytherm = usb_get_intfdata(intf); @@ -86,7 +86,7 @@ static ssize_t show_brightness(struct device *dev, struct device_attribute *attr return sprintf(buf, "%i", cytherm->brightness); } -static ssize_t set_brightness(struct device *dev, struct device_attribute *attr, const char *buf, +static ssize_t brightness_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct usb_interface *intf = to_usb_interface(dev); @@ -121,15 +121,13 @@ static ssize_t set_brightness(struct device *dev, struct device_attribute *attr, return count; } - -static DEVICE_ATTR(brightness, S_IRUGO | S_IWUSR | S_IWGRP, - show_brightness, set_brightness); +static DEVICE_ATTR_RW(brightness); #define TEMP 0x33 /* RAM location for temperature */ #define SIGN 0x34 /* RAM location for temperature sign */ -static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) +static ssize_t temp_show(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(dev); @@ -161,19 +159,12 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char return sprintf(buf, "%c%i.%i", sign ? '-' : '+', temp >> 1, 5*(temp - ((temp >> 1) << 1))); } - - -static ssize_t set_temp(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -{ - return count; -} - -static DEVICE_ATTR(temp, S_IRUGO, show_temp, set_temp); +static DEVICE_ATTR_RO(temp); #define BUTTON 0x7a -static ssize_t show_button(struct device *dev, struct device_attribute *attr, char *buf) +static ssize_t button_show(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(dev); @@ -200,17 +191,10 @@ static ssize_t show_button(struct device *dev, struct device_attribute *attr, ch else return sprintf(buf, "0"); } +static DEVICE_ATTR_RO(button); -static ssize_t set_button(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -{ - return count; -} - -static DEVICE_ATTR(button, S_IRUGO, show_button, set_button); - - -static ssize_t show_port0(struct device *dev, struct device_attribute *attr, char *buf) +static ssize_t port0_show(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(dev); struct usb_cytherm *cytherm = usb_get_intfdata(intf); @@ -234,7 +218,7 @@ static ssize_t show_port0(struct device *dev, struct device_attribute *attr, cha } -static ssize_t set_port0(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +static ssize_t port0_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct usb_interface *intf = to_usb_interface(dev); struct usb_cytherm *cytherm = usb_get_intfdata(intf); @@ -263,10 +247,9 @@ static ssize_t set_port0(struct device *dev, struct device_attribute *attr, cons return count; } +static DEVICE_ATTR_RW(port0); -static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR | S_IWGRP, show_port0, set_port0); - -static ssize_t show_port1(struct device *dev, struct device_attribute *attr, char *buf) +static ssize_t port1_show(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(dev); struct usb_cytherm *cytherm = usb_get_intfdata(intf); @@ -290,7 +273,7 @@ static ssize_t show_port1(struct device *dev, struct device_attribute *attr, cha } -static ssize_t set_port1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +static ssize_t port1_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct usb_interface *intf = to_usb_interface(dev); struct usb_cytherm *cytherm = usb_get_intfdata(intf); @@ -319,9 +302,7 @@ static ssize_t set_port1(struct device *dev, struct device_attribute *attr, cons return count; } - -static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR | S_IWGRP, show_port1, set_port1); - +static DEVICE_ATTR_RW(port1); static int cytherm_probe(struct usb_interface *interface, |