Commit 89dcefb5 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

staging: frontier: use better DEVICE_ATTR_ macros

Use the DEVICE_ATTR_RO/RW macros to better describe the permissions on
the file, and make them easier to audit.

Cc: David Täht <d@teklibre.com>
Cc: Sara Bird <sara.bird.iar@gmail.com>
Cc: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9d3ab801
...@@ -177,24 +177,24 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev) ...@@ -177,24 +177,24 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev)
} }
#define show_int(value) \ #define show_int(value) \
static ssize_t show_##value(struct device *dev, \ static ssize_t value##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
struct usb_interface *intf = to_usb_interface(dev); \ struct usb_interface *intf = to_usb_interface(dev); \
struct usb_tranzport *t = usb_get_intfdata(intf); \ struct usb_tranzport *t = usb_get_intfdata(intf); \
return sprintf(buf, "%d\n", t->value); \ return sprintf(buf, "%d\n", t->value); \
} \ } \
static DEVICE_ATTR(value, S_IRUGO, show_##value, NULL); static DEVICE_ATTR_RO(value)
#define show_set_int(value) \ #define show_set_int(value) \
static ssize_t show_##value(struct device *dev, \ static ssize_t value##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
struct usb_interface *intf = to_usb_interface(dev); \ struct usb_interface *intf = to_usb_interface(dev); \
struct usb_tranzport *t = usb_get_intfdata(intf); \ struct usb_tranzport *t = usb_get_intfdata(intf); \
return sprintf(buf, "%d\n", t->value); \ return sprintf(buf, "%d\n", t->value); \
} \ } \
static ssize_t set_##value(struct device *dev, \ static ssize_t value##_store(struct device *dev, \
struct device_attribute *attr, \ struct device_attribute *attr, \
const char *buf, size_t count) \ const char *buf, size_t count) \
{ \ { \
...@@ -206,7 +206,7 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev) ...@@ -206,7 +206,7 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev)
t->value = temp; \ t->value = temp; \
return count; \ return count; \
} \ } \
static DEVICE_ATTR(value, S_IWUSR | S_IRUGO, show_##value, set_##value); static DEVICE_ATTR_RW(value)
show_int(enable); show_int(enable);
show_int(offline); show_int(offline);
......
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