For all of these, a simple DEVICE_ATTR_*() macro should be used instead, so convert the drivers to use them. Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/misc/cytherm.c | 45 +++++++++++++------------------------------- drivers/usb/misc/usbsevseg.c | 6 +++--- 2 files changed, 16 insertions(+), 35 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, diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index 793f6c498d5c..1923d5b6d9c9 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c @@ -165,7 +165,7 @@ static void update_display_visual(struct usb_sevsegdev *mydev, gfp_t mf) } #define MYDEV_ATTR_SIMPLE_UNSIGNED(name, update_fcn) \ -static ssize_t show_attr_##name(struct device *dev, \ +static ssize_t name##_show(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ struct usb_interface *intf = to_usb_interface(dev); \ @@ -174,7 +174,7 @@ static ssize_t show_attr_##name(struct device *dev, \ return sprintf(buf, "%u\n", mydev->name); \ } \ \ -static ssize_t set_attr_##name(struct device *dev, \ +static ssize_t name##_store(struct device *dev, \ struct device_attribute *attr, const char *buf, size_t count) \ { \ struct usb_interface *intf = to_usb_interface(dev); \ @@ -185,7 +185,7 @@ static ssize_t set_attr_##name(struct device *dev, \ \ return count; \ } \ -static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); +static DEVICE_ATTR_RW(name); static ssize_t text_show(struct device *dev, struct device_attribute *attr, char *buf) -- 2.16.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html