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,
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,
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};
0 commit comments