Commit e56341ad authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

staging: comedi: convert class code to use dev_groups

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the comedi class code to use the
correct field.

Cc: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c9dce927
...@@ -262,7 +262,7 @@ static int resize_async_buffer(struct comedi_device *dev, ...@@ -262,7 +262,7 @@ static int resize_async_buffer(struct comedi_device *dev,
/* sysfs attribute files */ /* sysfs attribute files */
static ssize_t show_max_read_buffer_kb(struct device *csdev, static ssize_t max_read_buffer_kb_show(struct device *csdev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned int minor = MINOR(csdev->devt); unsigned int minor = MINOR(csdev->devt);
...@@ -283,7 +283,7 @@ static ssize_t show_max_read_buffer_kb(struct device *csdev, ...@@ -283,7 +283,7 @@ static ssize_t show_max_read_buffer_kb(struct device *csdev,
return snprintf(buf, PAGE_SIZE, "%i\n", size); return snprintf(buf, PAGE_SIZE, "%i\n", size);
} }
static ssize_t store_max_read_buffer_kb(struct device *csdev, static ssize_t max_read_buffer_kb_store(struct device *csdev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
...@@ -314,8 +314,9 @@ static ssize_t store_max_read_buffer_kb(struct device *csdev, ...@@ -314,8 +314,9 @@ static ssize_t store_max_read_buffer_kb(struct device *csdev,
return err ? err : count; return err ? err : count;
} }
static DEVICE_ATTR_RW(max_read_buffer_kb);
static ssize_t show_read_buffer_kb(struct device *csdev, static ssize_t read_buffer_kb_show(struct device *csdev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned int minor = MINOR(csdev->devt); unsigned int minor = MINOR(csdev->devt);
...@@ -336,7 +337,7 @@ static ssize_t show_read_buffer_kb(struct device *csdev, ...@@ -336,7 +337,7 @@ static ssize_t show_read_buffer_kb(struct device *csdev,
return snprintf(buf, PAGE_SIZE, "%i\n", size); return snprintf(buf, PAGE_SIZE, "%i\n", size);
} }
static ssize_t store_read_buffer_kb(struct device *csdev, static ssize_t read_buffer_kb_store(struct device *csdev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
...@@ -367,8 +368,9 @@ static ssize_t store_read_buffer_kb(struct device *csdev, ...@@ -367,8 +368,9 @@ static ssize_t store_read_buffer_kb(struct device *csdev,
return err ? err : count; return err ? err : count;
} }
static DEVICE_ATTR_RW(read_buffer_kb);
static ssize_t show_max_write_buffer_kb(struct device *csdev, static ssize_t max_write_buffer_kb_show(struct device *csdev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
...@@ -390,7 +392,7 @@ static ssize_t show_max_write_buffer_kb(struct device *csdev, ...@@ -390,7 +392,7 @@ static ssize_t show_max_write_buffer_kb(struct device *csdev,
return snprintf(buf, PAGE_SIZE, "%i\n", size); return snprintf(buf, PAGE_SIZE, "%i\n", size);
} }
static ssize_t store_max_write_buffer_kb(struct device *csdev, static ssize_t max_write_buffer_kb_store(struct device *csdev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
...@@ -421,8 +423,9 @@ static ssize_t store_max_write_buffer_kb(struct device *csdev, ...@@ -421,8 +423,9 @@ static ssize_t store_max_write_buffer_kb(struct device *csdev,
return err ? err : count; return err ? err : count;
} }
static DEVICE_ATTR_RW(max_write_buffer_kb);
static ssize_t show_write_buffer_kb(struct device *csdev, static ssize_t write_buffer_kb_show(struct device *csdev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned int minor = MINOR(csdev->devt); unsigned int minor = MINOR(csdev->devt);
...@@ -443,7 +446,7 @@ static ssize_t show_write_buffer_kb(struct device *csdev, ...@@ -443,7 +446,7 @@ static ssize_t show_write_buffer_kb(struct device *csdev,
return snprintf(buf, PAGE_SIZE, "%i\n", size); return snprintf(buf, PAGE_SIZE, "%i\n", size);
} }
static ssize_t store_write_buffer_kb(struct device *csdev, static ssize_t write_buffer_kb_store(struct device *csdev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
...@@ -474,18 +477,16 @@ static ssize_t store_write_buffer_kb(struct device *csdev, ...@@ -474,18 +477,16 @@ static ssize_t store_write_buffer_kb(struct device *csdev,
return err ? err : count; return err ? err : count;
} }
static DEVICE_ATTR_RW(write_buffer_kb);
static struct device_attribute comedi_dev_attrs[] = { static struct attribute *comedi_dev_attrs[] = {
__ATTR(max_read_buffer_kb, S_IRUGO | S_IWUSR, &dev_attr_max_read_buffer_kb.attr,
show_max_read_buffer_kb, store_max_read_buffer_kb), &dev_attr_read_buffer_kb.attr,
__ATTR(read_buffer_kb, S_IRUGO | S_IWUSR | S_IWGRP, &dev_attr_max_write_buffer_kb.attr,
show_read_buffer_kb, store_read_buffer_kb), &dev_attr_write_buffer_kb.attr,
__ATTR(max_write_buffer_kb, S_IRUGO | S_IWUSR, NULL,
show_max_write_buffer_kb, store_max_write_buffer_kb),
__ATTR(write_buffer_kb, S_IRUGO | S_IWUSR | S_IWGRP,
show_write_buffer_kb, store_write_buffer_kb),
__ATTR_NULL
}; };
ATTRIBUTE_GROUPS(comedi_dev);
static void comedi_set_subdevice_runflags(struct comedi_subdevice *s, static void comedi_set_subdevice_runflags(struct comedi_subdevice *s,
unsigned mask, unsigned bits) unsigned mask, unsigned bits)
...@@ -2554,7 +2555,7 @@ static int __init comedi_init(void) ...@@ -2554,7 +2555,7 @@ static int __init comedi_init(void)
return PTR_ERR(comedi_class); return PTR_ERR(comedi_class);
} }
comedi_class->dev_attrs = comedi_dev_attrs; comedi_class->dev_groups = comedi_dev_groups;
/* XXX requires /proc interface */ /* XXX requires /proc interface */
comedi_proc_init(); comedi_proc_init();
......
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