.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2014 Linaro Ltd. |
---|
3 | 4 | * |
---|
4 | 5 | * 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 | | - * |
---|
10 | 6 | */ |
---|
11 | 7 | #include <linux/init.h> |
---|
12 | 8 | #include <linux/io.h> |
---|
.. | .. |
---|
43 | 39 | } |
---|
44 | 40 | } |
---|
45 | 41 | |
---|
46 | | -static ssize_t realview_get_manf(struct device *dev, |
---|
47 | | - struct device_attribute *attr, |
---|
48 | | - char *buf) |
---|
| 42 | +static ssize_t |
---|
| 43 | +manufacturer_show(struct device *dev, struct device_attribute *attr, char *buf) |
---|
49 | 44 | { |
---|
50 | 45 | return sprintf(buf, "%02x\n", realview_coreid >> 24); |
---|
51 | 46 | } |
---|
52 | 47 | |
---|
53 | | -static struct device_attribute realview_manf_attr = |
---|
54 | | - __ATTR(manufacturer, S_IRUGO, realview_get_manf, NULL); |
---|
| 48 | +static DEVICE_ATTR_RO(manufacturer); |
---|
55 | 49 | |
---|
56 | | -static ssize_t realview_get_board(struct device *dev, |
---|
57 | | - struct device_attribute *attr, |
---|
58 | | - char *buf) |
---|
| 50 | +static ssize_t |
---|
| 51 | +board_show(struct device *dev, struct device_attribute *attr, char *buf) |
---|
59 | 52 | { |
---|
60 | 53 | return sprintf(buf, "HBI-%03x\n", ((realview_coreid >> 16) & 0xfff)); |
---|
61 | 54 | } |
---|
62 | 55 | |
---|
63 | | -static struct device_attribute realview_board_attr = |
---|
64 | | - __ATTR(board, S_IRUGO, realview_get_board, NULL); |
---|
| 56 | +static DEVICE_ATTR_RO(board); |
---|
65 | 57 | |
---|
66 | | -static ssize_t realview_get_arch(struct device *dev, |
---|
67 | | - struct device_attribute *attr, |
---|
68 | | - char *buf) |
---|
| 58 | +static ssize_t |
---|
| 59 | +fpga_show(struct device *dev, struct device_attribute *attr, char *buf) |
---|
69 | 60 | { |
---|
70 | 61 | return sprintf(buf, "%s\n", realview_arch_str(realview_coreid)); |
---|
71 | 62 | } |
---|
72 | 63 | |
---|
73 | | -static struct device_attribute realview_arch_attr = |
---|
74 | | - __ATTR(fpga, S_IRUGO, realview_get_arch, NULL); |
---|
| 64 | +static DEVICE_ATTR_RO(fpga); |
---|
75 | 65 | |
---|
76 | | -static ssize_t realview_get_build(struct device *dev, |
---|
77 | | - struct device_attribute *attr, |
---|
78 | | - char *buf) |
---|
| 66 | +static ssize_t |
---|
| 67 | +build_show(struct device *dev, struct device_attribute *attr, char *buf) |
---|
79 | 68 | { |
---|
80 | 69 | return sprintf(buf, "%02x\n", (realview_coreid & 0xFF)); |
---|
81 | 70 | } |
---|
82 | 71 | |
---|
83 | | -static struct device_attribute realview_build_attr = |
---|
84 | | - __ATTR(build, S_IRUGO, realview_get_build, NULL); |
---|
| 72 | +static DEVICE_ATTR_RO(build); |
---|
| 73 | + |
---|
| 74 | +static struct attribute *realview_attrs[] = { |
---|
| 75 | + &dev_attr_manufacturer.attr, |
---|
| 76 | + &dev_attr_board.attr, |
---|
| 77 | + &dev_attr_fpga.attr, |
---|
| 78 | + &dev_attr_build.attr, |
---|
| 79 | + NULL |
---|
| 80 | +}; |
---|
| 81 | + |
---|
| 82 | +ATTRIBUTE_GROUPS(realview); |
---|
85 | 83 | |
---|
86 | 84 | static int realview_soc_probe(struct platform_device *pdev) |
---|
87 | 85 | { |
---|
.. | .. |
---|
106 | 104 | |
---|
107 | 105 | soc_dev_attr->machine = "RealView"; |
---|
108 | 106 | soc_dev_attr->family = "Versatile"; |
---|
| 107 | + soc_dev_attr->custom_attr_group = realview_groups[0]; |
---|
109 | 108 | soc_dev = soc_device_register(soc_dev_attr); |
---|
110 | 109 | if (IS_ERR(soc_dev)) { |
---|
111 | 110 | kfree(soc_dev_attr); |
---|
.. | .. |
---|
115 | 114 | &realview_coreid); |
---|
116 | 115 | if (ret) |
---|
117 | 116 | return -ENODEV; |
---|
118 | | - |
---|
119 | | - device_create_file(soc_device_to_device(soc_dev), &realview_manf_attr); |
---|
120 | | - device_create_file(soc_device_to_device(soc_dev), &realview_board_attr); |
---|
121 | | - device_create_file(soc_device_to_device(soc_dev), &realview_arch_attr); |
---|
122 | | - device_create_file(soc_device_to_device(soc_dev), &realview_build_attr); |
---|
123 | 117 | |
---|
124 | 118 | dev_info(&pdev->dev, "RealView Syscon Core ID: 0x%08x, HBI-%03x\n", |
---|
125 | 119 | realview_coreid, |
---|