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

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
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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)
{
+6 −9
Original line number Diff line number Diff line
@@ -1561,7 +1561,7 @@ 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 usb_serial_port *port = to_usb_serial_port(dev);
@@ -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)
+3 −5
Original line number Diff line number Diff line
@@ -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)
{
+3 −5
Original line number Diff line number Diff line
@@ -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)
{