History

PPS: 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 pps class code to use the correct field.

Greg Kroah-Hartman committed 13 years ago

Commit bd0eae41 parent e80b89a3 files · +37 −22Browse files

Unified · Split

3 files
  1. drivers/pps/pps.c +1 −1
  2. drivers/pps/sysfs.c +35 −20
  3. include/linux/pps_kernel.h +1 −1
drivers/pps/pps.c+1−1
@@ -406,7 +406,7 @@ static int __init pps_init(void) · 405 unmodified lines
406406 pr_err("failed to allocate class\n");
407407 return PTR_ERR(pps_class);
408408 }
409− pps_class->dev_attrs = pps_attrs;
409+ pps_class->dev_groups = pps_groups;
410410
411411 err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps");
412412 if (err < 0) {
drivers/pps/sysfs.c+35−20
@@ -29,8 +29,8 @@ · 28 unmodified lines
2929 * Attribute functions
3030 */
3131
32−static ssize_t pps_show_assert(struct device *dev,
33− struct device_attribute *attr, char *buf)
32+static ssize_t assert_show(struct device *dev, struct device_attribute *attr,
33+ char *buf)
3434 {
3535 struct pps_device *pps = dev_get_drvdata(dev);
3636
@@ -41,9 +41,10 @@ static ssize_t pps_show_assert(struct device *dev, · 4 unmodified lines
4141 (long long) pps->assert_tu.sec, pps->assert_tu.nsec,
4242 pps->assert_sequence);
4343 }
44+static DEVICE_ATTR_RO(assert);
4445
45−static ssize_t pps_show_clear(struct device *dev,
46− struct device_attribute *attr, char *buf)
46+static ssize_t clear_show(struct device *dev, struct device_attribute *attr,
47+ char *buf)
4748 {
4849 struct pps_device *pps = dev_get_drvdata(dev);
4950
@@ -54,45 +55,59 @@ static ssize_t pps_show_clear(struct device *dev, · 4 unmodified lines
5455 (long long) pps->clear_tu.sec, pps->clear_tu.nsec,
5556 pps->clear_sequence);
5657 }
58+static DEVICE_ATTR_RO(clear);
5759
58−static ssize_t pps_show_mode(struct device *dev,
59− struct device_attribute *attr, char *buf)
60+static ssize_t mode_show(struct device *dev, struct device_attribute *attr,
61+ char *buf)
6062 {
6163 struct pps_device *pps = dev_get_drvdata(dev);
6264
6365 return sprintf(buf, "%4x\n", pps->info.mode);
6466 }
67+static DEVICE_ATTR_RO(mode);
6568
66−static ssize_t pps_show_echo(struct device *dev,
67− struct device_attribute *attr, char *buf)
69+static ssize_t echo_show(struct device *dev, struct device_attribute *attr,
70+ char *buf)
6871 {
6972 struct pps_device *pps = dev_get_drvdata(dev);
7073
7174 return sprintf(buf, "%d\n", !!pps->info.echo);
7275 }
76+static DEVICE_ATTR_RO(echo);
7377
74−static ssize_t pps_show_name(struct device *dev,
75− struct device_attribute *attr, char *buf)
78+static ssize_t name_show(struct device *dev, struct device_attribute *attr,
79+ char *buf)
7680 {
7781 struct pps_device *pps = dev_get_drvdata(dev);
7882
7983 return sprintf(buf, "%s\n", pps->info.name);
8084 }
85+static DEVICE_ATTR_RO(name);
8186
82−static ssize_t pps_show_path(struct device *dev,
83− struct device_attribute *attr, char *buf)
87+static ssize_t path_show(struct device *dev, struct device_attribute *attr,
88+ char *buf)
8489 {
8590 struct pps_device *pps = dev_get_drvdata(dev);
8691
8792 return sprintf(buf, "%s\n", pps->info.path);
8893 }
94+static DEVICE_ATTR_RO(path);
95+
96+static struct attribute *pps_attrs[] = {
97+ &dev_attr_assert.attr,
98+ &dev_attr_clear.attr,
99+ &dev_attr_mode.attr,
100+ &dev_attr_echo.attr,
101+ &dev_attr_name.attr,
102+ &dev_attr_path.attr,
103+ NULL,
104+};
105+
106+static const struct attribute_group pps_group = {
107+ .attrs = pps_attrs,
108+};
89109
90−struct device_attribute pps_attrs[] = {
91− __ATTR(assert, S_IRUGO, pps_show_assert, NULL),
92− __ATTR(clear, S_IRUGO, pps_show_clear, NULL),
93− __ATTR(mode, S_IRUGO, pps_show_mode, NULL),
94− __ATTR(echo, S_IRUGO, pps_show_echo, NULL),
95− __ATTR(name, S_IRUGO, pps_show_name, NULL),
96− __ATTR(path, S_IRUGO, pps_show_path, NULL),
97− __ATTR_NULL,
110+const struct attribute_group *pps_groups[] = {
111+ &pps_group,
112+ NULL,
98113 };
include/linux/pps_kernel.h+1−1
@@ -80,7 +80,7 @@ struct pps_device { · 79 unmodified lines
8080 * Global variables
8181 */
8282
83−extern struct device_attribute pps_attrs[];
83+extern const struct attribute_group *pps_groups[];
8484
8585 /*
8686 * Internal functions.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t