Commit 154547c4 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: clean up attribute permissions

Clean up the DEVICE_ATTR usage in the USB serial drivers, making them
more obvious as to the permissions that the sysfs files should be.

Note: ftdi_sio.c still has a DEVICE_ATTR() used, that will have to wait
until after 3.12-rc1 comes out when DEVICE_ATTR_WO() shows up in Linus's
tree.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2a6eb8ac
...@@ -38,15 +38,14 @@ static int usb_serial_device_match(struct device *dev, ...@@ -38,15 +38,14 @@ static int usb_serial_device_match(struct device *dev,
return 0; return 0;
} }
static ssize_t show_port_number(struct device *dev, static ssize_t port_number_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct usb_serial_port *port = to_usb_serial_port(dev); struct usb_serial_port *port = to_usb_serial_port(dev);
return sprintf(buf, "%d\n", port->port_number); return sprintf(buf, "%d\n", port->port_number);
} }
static DEVICE_ATTR_RO(port_number);
static DEVICE_ATTR(port_number, S_IRUGO, show_port_number, NULL);
static int usb_serial_device_probe(struct device *dev) static int usb_serial_device_probe(struct device *dev)
{ {
......
...@@ -1561,8 +1561,8 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port) ...@@ -1561,8 +1561,8 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port)
* *************************************************************************** * ***************************************************************************
*/ */
static ssize_t show_latency_timer(struct device *dev, static ssize_t latency_timer_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct usb_serial_port *port = to_usb_serial_port(dev); struct usb_serial_port *port = to_usb_serial_port(dev);
struct ftdi_private *priv = usb_get_serial_port_data(port); struct ftdi_private *priv = usb_get_serial_port_data(port);
...@@ -1572,11 +1572,10 @@ static ssize_t show_latency_timer(struct device *dev, ...@@ -1572,11 +1572,10 @@ static ssize_t show_latency_timer(struct device *dev,
return sprintf(buf, "%i\n", priv->latency); return sprintf(buf, "%i\n", priv->latency);
} }
/* Write a new value of the latency timer, in units of milliseconds. */ /* Write a new value of the latency timer, in units of milliseconds. */
static ssize_t store_latency_timer(struct device *dev, static ssize_t latency_timer_store(struct device *dev,
struct device_attribute *attr, const char *valbuf, struct device_attribute *attr,
size_t count) const char *valbuf, size_t count)
{ {
struct usb_serial_port *port = to_usb_serial_port(dev); struct usb_serial_port *port = to_usb_serial_port(dev);
struct ftdi_private *priv = usb_get_serial_port_data(port); struct ftdi_private *priv = usb_get_serial_port_data(port);
...@@ -1589,6 +1588,7 @@ static ssize_t store_latency_timer(struct device *dev, ...@@ -1589,6 +1588,7 @@ static ssize_t store_latency_timer(struct device *dev,
return -EIO; return -EIO;
return count; return count;
} }
static DEVICE_ATTR_RW(latency_timer);
/* Write an event character directly to the FTDI register. The ASCII /* Write an event character directly to the FTDI register. The ASCII
value is in the low 8 bits, with the enable bit in the 9th bit. */ value is in the low 8 bits, with the enable bit in the 9th bit. */
...@@ -1616,9 +1616,6 @@ static ssize_t store_event_char(struct device *dev, ...@@ -1616,9 +1616,6 @@ static ssize_t store_event_char(struct device *dev,
return count; return count;
} }
static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer,
store_latency_timer);
static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char);
static int create_sysfs_attrs(struct usb_serial_port *port) static int create_sysfs_attrs(struct usb_serial_port *port)
......
...@@ -2484,7 +2484,7 @@ static int edge_port_remove(struct usb_serial_port *port) ...@@ -2484,7 +2484,7 @@ static int edge_port_remove(struct usb_serial_port *port)
/* Sysfs Attributes */ /* Sysfs Attributes */
static ssize_t show_uart_mode(struct device *dev, static ssize_t uart_mode_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct usb_serial_port *port = to_usb_serial_port(dev); struct usb_serial_port *port = to_usb_serial_port(dev);
...@@ -2493,7 +2493,7 @@ static ssize_t show_uart_mode(struct device *dev, ...@@ -2493,7 +2493,7 @@ static ssize_t show_uart_mode(struct device *dev,
return sprintf(buf, "%d\n", edge_port->bUartMode); return sprintf(buf, "%d\n", edge_port->bUartMode);
} }
static ssize_t store_uart_mode(struct device *dev, static ssize_t uart_mode_store(struct device *dev,
struct device_attribute *attr, const char *valbuf, size_t count) struct device_attribute *attr, const char *valbuf, size_t count)
{ {
struct usb_serial_port *port = to_usb_serial_port(dev); struct usb_serial_port *port = to_usb_serial_port(dev);
...@@ -2509,9 +2509,7 @@ static ssize_t store_uart_mode(struct device *dev, ...@@ -2509,9 +2509,7 @@ static ssize_t store_uart_mode(struct device *dev,
return count; return count;
} }
static DEVICE_ATTR_RW(uart_mode);
static DEVICE_ATTR(uart_mode, S_IWUSR | S_IRUGO, show_uart_mode,
store_uart_mode);
static int edge_create_sysfs_attrs(struct usb_serial_port *port) static int edge_create_sysfs_attrs(struct usb_serial_port *port)
{ {
......
...@@ -1130,7 +1130,7 @@ static int iuu_vcc_set(struct usb_serial_port *port, unsigned int vcc) ...@@ -1130,7 +1130,7 @@ static int iuu_vcc_set(struct usb_serial_port *port, unsigned int vcc)
* Sysfs Attributes * Sysfs Attributes
*/ */
static ssize_t show_vcc_mode(struct device *dev, static ssize_t vcc_mode_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct usb_serial_port *port = to_usb_serial_port(dev); struct usb_serial_port *port = to_usb_serial_port(dev);
...@@ -1139,7 +1139,7 @@ static ssize_t show_vcc_mode(struct device *dev, ...@@ -1139,7 +1139,7 @@ static ssize_t show_vcc_mode(struct device *dev,
return sprintf(buf, "%d\n", priv->vcc); return sprintf(buf, "%d\n", priv->vcc);
} }
static ssize_t store_vcc_mode(struct device *dev, static ssize_t vcc_mode_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
struct usb_serial_port *port = to_usb_serial_port(dev); struct usb_serial_port *port = to_usb_serial_port(dev);
...@@ -1163,9 +1163,7 @@ static ssize_t store_vcc_mode(struct device *dev, ...@@ -1163,9 +1163,7 @@ static ssize_t store_vcc_mode(struct device *dev,
fail_store_vcc_mode: fail_store_vcc_mode:
return count; return count;
} }
static DEVICE_ATTR_RW(vcc_mode);
static DEVICE_ATTR(vcc_mode, S_IRUSR | S_IWUSR, show_vcc_mode,
store_vcc_mode);
static int iuu_create_sysfs_attrs(struct usb_serial_port *port) static int iuu_create_sysfs_attrs(struct usb_serial_port *port)
{ {
......
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