hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/soc/versatile/soc-integrator.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2014 Linaro Ltd.
34 *
45 * Author: Linus Walleij <linus.walleij@linaro.org>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2, as
8
- * published by the Free Software Foundation.
9
- *
106 */
117 #include <linux/init.h>
128 #include <linux/io.h>
....@@ -60,49 +56,51 @@
6056 }
6157 }
6258
63
-static ssize_t integrator_get_manf(struct device *dev,
64
- struct device_attribute *attr,
65
- char *buf)
59
+static ssize_t
60
+manufacturer_show(struct device *dev, struct device_attribute *attr, char *buf)
6661 {
6762 return sprintf(buf, "%02x\n", integrator_coreid >> 24);
6863 }
6964
70
-static struct device_attribute integrator_manf_attr =
71
- __ATTR(manufacturer, S_IRUGO, integrator_get_manf, NULL);
65
+static DEVICE_ATTR_RO(manufacturer);
7266
73
-static ssize_t integrator_get_arch(struct device *dev,
74
- struct device_attribute *attr,
75
- char *buf)
67
+static ssize_t
68
+arch_show(struct device *dev, struct device_attribute *attr, char *buf)
7669 {
7770 return sprintf(buf, "%s\n", integrator_arch_str(integrator_coreid));
7871 }
7972
80
-static struct device_attribute integrator_arch_attr =
81
- __ATTR(arch, S_IRUGO, integrator_get_arch, NULL);
73
+static DEVICE_ATTR_RO(arch);
8274
83
-static ssize_t integrator_get_fpga(struct device *dev,
84
- struct device_attribute *attr,
85
- char *buf)
75
+static ssize_t
76
+fpga_show(struct device *dev, struct device_attribute *attr, char *buf)
8677 {
8778 return sprintf(buf, "%s\n", integrator_fpga_str(integrator_coreid));
8879 }
8980
90
-static struct device_attribute integrator_fpga_attr =
91
- __ATTR(fpga, S_IRUGO, integrator_get_fpga, NULL);
81
+static DEVICE_ATTR_RO(fpga);
9282
93
-static ssize_t integrator_get_build(struct device *dev,
94
- struct device_attribute *attr,
95
- char *buf)
83
+static ssize_t
84
+build_show(struct device *dev, struct device_attribute *attr, char *buf)
9685 {
9786 return sprintf(buf, "%02x\n", (integrator_coreid >> 4) & 0xFF);
9887 }
9988
100
-static struct device_attribute integrator_build_attr =
101
- __ATTR(build, S_IRUGO, integrator_get_build, NULL);
89
+static DEVICE_ATTR_RO(build);
90
+
91
+static struct attribute *integrator_attrs[] = {
92
+ &dev_attr_manufacturer.attr,
93
+ &dev_attr_arch.attr,
94
+ &dev_attr_fpga.attr,
95
+ &dev_attr_build.attr,
96
+ NULL
97
+};
98
+
99
+ATTRIBUTE_GROUPS(integrator);
102100
103101 static int __init integrator_soc_init(void)
104102 {
105
- static struct regmap *syscon_regmap;
103
+ struct regmap *syscon_regmap;
106104 struct soc_device *soc_dev;
107105 struct soc_device_attribute *soc_dev_attr;
108106 struct device_node *np;
....@@ -131,17 +129,13 @@
131129 soc_dev_attr->soc_id = "Integrator";
132130 soc_dev_attr->machine = "Integrator";
133131 soc_dev_attr->family = "Versatile";
132
+ soc_dev_attr->custom_attr_group = integrator_groups[0];
134133 soc_dev = soc_device_register(soc_dev_attr);
135134 if (IS_ERR(soc_dev)) {
136135 kfree(soc_dev_attr);
137136 return -ENODEV;
138137 }
139138 dev = soc_device_to_device(soc_dev);
140
-
141
- device_create_file(dev, &integrator_manf_attr);
142
- device_create_file(dev, &integrator_arch_attr);
143
- device_create_file(dev, &integrator_fpga_attr);
144
- device_create_file(dev, &integrator_build_attr);
145139
146140 dev_info(dev, "Detected ARM core module:\n");
147141 dev_info(dev, " Manufacturer: %02x\n", (val >> 24));