Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a6eb8ac authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

USB: usbtmc: fix up attribute permissions



In auditing the usbtmc sysfs files, a bunch of them were being created
as "read only", yet they have logic to handle writing to.  So fix them
up by setting the permissions properly.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d03f254f
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -899,7 +899,7 @@ static int get_capabilities(struct usbtmc_device_data *data)
}
}


#define capability_attribute(name)					\
#define capability_attribute(name)					\
static ssize_t show_##name(struct device *dev,				\
static ssize_t name##_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);		\
@@ -907,7 +907,7 @@ static ssize_t show_##name(struct device *dev, \
									\
									\
	return sprintf(buf, "%d\n", data->capabilities.name);		\
	return sprintf(buf, "%d\n", data->capabilities.name);		\
}									\
}									\
static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
static DEVICE_ATTR_RO(name)


capability_attribute(interface_capabilities);
capability_attribute(interface_capabilities);
capability_attribute(device_capabilities);
capability_attribute(device_capabilities);
@@ -926,7 +926,7 @@ static struct attribute_group capability_attr_grp = {
	.attrs = capability_attrs,
	.attrs = capability_attrs,
};
};


static ssize_t show_TermChar(struct device *dev,
static ssize_t TermChar_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);
@@ -935,7 +935,7 @@ static ssize_t show_TermChar(struct device *dev,
	return sprintf(buf, "%c\n", data->TermChar);
	return sprintf(buf, "%c\n", data->TermChar);
}
}


static ssize_t store_TermChar(struct device *dev,
static ssize_t TermChar_store(struct device *dev,
			      struct device_attribute *attr,
			      struct device_attribute *attr,
			      const char *buf, size_t count)
			      const char *buf, size_t count)
{
{
@@ -947,10 +947,10 @@ static ssize_t store_TermChar(struct device *dev,
	data->TermChar = buf[0];
	data->TermChar = buf[0];
	return count;
	return count;
}
}
static DEVICE_ATTR(TermChar, S_IRUGO, show_TermChar, store_TermChar);
static DEVICE_ATTR_RW(TermChar);


#define data_attribute(name)						\
#define data_attribute(name)						\
static ssize_t show_##name(struct device *dev,				\
static ssize_t name##_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);		\
@@ -958,7 +958,7 @@ static ssize_t show_##name(struct device *dev, \
									\
									\
	return sprintf(buf, "%d\n", data->name);			\
	return sprintf(buf, "%d\n", data->name);			\
}									\
}									\
static ssize_t store_##name(struct device *dev,				\
static ssize_t name##_store(struct device *dev,				\
			    struct device_attribute *attr,		\
			    struct device_attribute *attr,		\
			    const char *buf, size_t count)		\
			    const char *buf, size_t count)		\
{									\
{									\
@@ -976,7 +976,7 @@ static ssize_t store_##name(struct device *dev, \
	else								\
	else								\
		return count;						\
		return count;						\
}									\
}									\
static DEVICE_ATTR(name, S_IRUGO, show_##name, store_##name)
static DEVICE_ATTR_RW(name)


data_attribute(TermCharEnabled);
data_attribute(TermCharEnabled);
data_attribute(auto_abort);
data_attribute(auto_abort);