]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
USB: serial: clean up attribute permissions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Aug 2013 23:18:34 +0000 (16:18 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Aug 2013 22:12:03 +0000 (15:12 -0700)
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/bus.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/io_ti.c
drivers/usb/serial/iuu_phoenix.c

index f053b302a00d543e83fe6562a995ff9960c4e9af..0ce51f21ed2a1d5db4435b15d490e8b7bd2f124e 100644 (file)
@@ -38,15 +38,14 @@ static int usb_serial_device_match(struct device *dev,
        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 usb_serial_port *port = to_usb_serial_port(dev);
 
        return sprintf(buf, "%d\n", port->port_number);
 }
-
-static DEVICE_ATTR(port_number, S_IRUGO, show_port_number, NULL);
+static DEVICE_ATTR_RO(port_number);
 
 static int usb_serial_device_probe(struct device *dev)
 {
index dbf2f2818823c41637d0510bc0d8219b62d2c9b6..c45f9c0a1b3493f8f5566c87d6b8702f9fc8116c 100644 (file)
@@ -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,
-                               struct device_attribute *attr, char *buf)
+static ssize_t latency_timer_show(struct device *dev,
+                                 struct device_attribute *attr, char *buf)
 {
        struct usb_serial_port *port = to_usb_serial_port(dev);
        struct ftdi_private *priv = usb_get_serial_port_data(port);
@@ -1572,11 +1572,10 @@ static ssize_t show_latency_timer(struct device *dev,
                return sprintf(buf, "%i\n", priv->latency);
 }
 
-
 /* Write a new value of the latency timer, in units of milliseconds. */
-static ssize_t store_latency_timer(struct device *dev,
-                       struct device_attribute *attr, const char *valbuf,
-                       size_t count)
+static ssize_t latency_timer_store(struct device *dev,
+                                  struct device_attribute *attr,
+                                  const char *valbuf, size_t count)
 {
        struct usb_serial_port *port = to_usb_serial_port(dev);
        struct ftdi_private *priv = usb_get_serial_port_data(port);
@@ -1589,6 +1588,7 @@ static ssize_t store_latency_timer(struct device *dev,
                return -EIO;
        return count;
 }
+static DEVICE_ATTR_RW(latency_timer);
 
 /* 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. */
@@ -1616,9 +1616,6 @@ static ssize_t store_event_char(struct device *dev,
 
        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 int create_sysfs_attrs(struct usb_serial_port *port)
index 9c18f5985c8dbb73c0e4ba1b7eac8f8630eae53e..b7187bf3246946f3090e4f49d1110e3a0bf90486 100644 (file)
@@ -2484,7 +2484,7 @@ static int edge_port_remove(struct usb_serial_port *port)
 
 /* 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 usb_serial_port *port = to_usb_serial_port(dev);
@@ -2493,7 +2493,7 @@ static ssize_t show_uart_mode(struct device *dev,
        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 usb_serial_port *port = to_usb_serial_port(dev);
@@ -2509,9 +2509,7 @@ static ssize_t store_uart_mode(struct device *dev,
 
        return count;
 }
-
-static DEVICE_ATTR(uart_mode, S_IWUSR | S_IRUGO, show_uart_mode,
-                                                       store_uart_mode);
+static DEVICE_ATTR_RW(uart_mode);
 
 static int edge_create_sysfs_attrs(struct usb_serial_port *port)
 {
index 790673e5faa744de7da4dfcb38fa2ba11b418ea6..57c439a24b5adda966a7fee7218487f227386b1d 100644 (file)
@@ -1130,7 +1130,7 @@ static int iuu_vcc_set(struct usb_serial_port *port, unsigned int vcc)
  * 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 usb_serial_port *port = to_usb_serial_port(dev);
@@ -1139,7 +1139,7 @@ static ssize_t show_vcc_mode(struct device *dev,
        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 usb_serial_port *port = to_usb_serial_port(dev);
@@ -1163,9 +1163,7 @@ static ssize_t store_vcc_mode(struct device *dev,
 fail_store_vcc_mode:
        return count;
 }
-
-static DEVICE_ATTR(vcc_mode, S_IRUSR | S_IWUSR, show_vcc_mode,
-       store_vcc_mode);
+static DEVICE_ATTR_RW(vcc_mode);
 
 static int iuu_create_sysfs_attrs(struct usb_serial_port *port)
 {