aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-12-21 18:09:50 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-21 18:09:50 -0500
commit3fbacffbe9744920a80c04efc507c6a42e355c59 (patch)
treea364fe1d49dff37e7939bfb8355ee9d7000d590d /arch/s390
parent10fbcf4c6cb122005cdf36fc24d7683da92c7a27 (diff)
s390: time - convert sysdev_class to a regular subsystem
After all sysdev classes are ported to regular driver core entities, the sysdev implementation will be entirely removed from the kernel. Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/time.c260
1 files changed, 131 insertions, 129 deletions
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index ebbfab3c6e5a..fa02f443f5f6 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -27,7 +27,7 @@
27#include <linux/cpu.h> 27#include <linux/cpu.h>
28#include <linux/stop_machine.h> 28#include <linux/stop_machine.h>
29#include <linux/time.h> 29#include <linux/time.h>
30#include <linux/sysdev.h> 30#include <linux/device.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/smp.h> 33#include <linux/smp.h>
@@ -1116,34 +1116,35 @@ out_unlock:
1116/* 1116/*
1117 * Sysfs interface functions 1117 * Sysfs interface functions
1118 */ 1118 */
1119static struct sysdev_class etr_sysclass = { 1119static struct bus_type etr_subsys = {
1120 .name = "etr", 1120 .name = "etr",
1121 .dev_name = "etr",
1121}; 1122};
1122 1123
1123static struct sys_device etr_port0_dev = { 1124static struct device etr_port0_dev = {
1124 .id = 0, 1125 .id = 0,
1125 .cls = &etr_sysclass, 1126 .bus = &etr_subsys,
1126}; 1127};
1127 1128
1128static struct sys_device etr_port1_dev = { 1129static struct device etr_port1_dev = {
1129 .id = 1, 1130 .id = 1,
1130 .cls = &etr_sysclass, 1131 .bus = &etr_subsys,
1131}; 1132};
1132 1133
1133/* 1134/*
1134 * ETR class attributes 1135 * ETR subsys attributes
1135 */ 1136 */
1136static ssize_t etr_stepping_port_show(struct sysdev_class *class, 1137static ssize_t etr_stepping_port_show(struct device *dev,
1137 struct sysdev_class_attribute *attr, 1138 struct device_attribute *attr,
1138 char *buf) 1139 char *buf)
1139{ 1140{
1140 return sprintf(buf, "%i\n", etr_port0.esw.p); 1141 return sprintf(buf, "%i\n", etr_port0.esw.p);
1141} 1142}
1142 1143
1143static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); 1144static DEVICE_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL);
1144 1145
1145static ssize_t etr_stepping_mode_show(struct sysdev_class *class, 1146static ssize_t etr_stepping_mode_show(struct device *dev,
1146 struct sysdev_class_attribute *attr, 1147 struct device_attribute *attr,
1147 char *buf) 1148 char *buf)
1148{ 1149{
1149 char *mode_str; 1150 char *mode_str;
@@ -1157,12 +1158,12 @@ static ssize_t etr_stepping_mode_show(struct sysdev_class *class,
1157 return sprintf(buf, "%s\n", mode_str); 1158 return sprintf(buf, "%s\n", mode_str);
1158} 1159}
1159 1160
1160static SYSDEV_CLASS_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL); 1161static DEVICE_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL);
1161 1162
1162/* 1163/*
1163 * ETR port attributes 1164 * ETR port attributes
1164 */ 1165 */
1165static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev) 1166static inline struct etr_aib *etr_aib_from_dev(struct device *dev)
1166{ 1167{
1167 if (dev == &etr_port0_dev) 1168 if (dev == &etr_port0_dev)
1168 return etr_port0_online ? &etr_port0 : NULL; 1169 return etr_port0_online ? &etr_port0 : NULL;
@@ -1170,8 +1171,8 @@ static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev)
1170 return etr_port1_online ? &etr_port1 : NULL; 1171 return etr_port1_online ? &etr_port1 : NULL;
1171} 1172}
1172 1173
1173static ssize_t etr_online_show(struct sys_device *dev, 1174static ssize_t etr_online_show(struct device *dev,
1174 struct sysdev_attribute *attr, 1175 struct device_attribute *attr,
1175 char *buf) 1176 char *buf)
1176{ 1177{
1177 unsigned int online; 1178 unsigned int online;
@@ -1180,8 +1181,8 @@ static ssize_t etr_online_show(struct sys_device *dev,
1180 return sprintf(buf, "%i\n", online); 1181 return sprintf(buf, "%i\n", online);
1181} 1182}
1182 1183
1183static ssize_t etr_online_store(struct sys_device *dev, 1184static ssize_t etr_online_store(struct device *dev,
1184 struct sysdev_attribute *attr, 1185 struct device_attribute *attr,
1185 const char *buf, size_t count) 1186 const char *buf, size_t count)
1186{ 1187{
1187 unsigned int value; 1188 unsigned int value;
@@ -1218,20 +1219,20 @@ out:
1218 return count; 1219 return count;
1219} 1220}
1220 1221
1221static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); 1222static DEVICE_ATTR(online, 0600, etr_online_show, etr_online_store);
1222 1223
1223static ssize_t etr_stepping_control_show(struct sys_device *dev, 1224static ssize_t etr_stepping_control_show(struct device *dev,
1224 struct sysdev_attribute *attr, 1225 struct device_attribute *attr,
1225 char *buf) 1226 char *buf)
1226{ 1227{
1227 return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? 1228 return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ?
1228 etr_eacr.e0 : etr_eacr.e1); 1229 etr_eacr.e0 : etr_eacr.e1);
1229} 1230}
1230 1231
1231static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); 1232static DEVICE_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL);
1232 1233
1233static ssize_t etr_mode_code_show(struct sys_device *dev, 1234static ssize_t etr_mode_code_show(struct device *dev,
1234 struct sysdev_attribute *attr, char *buf) 1235 struct device_attribute *attr, char *buf)
1235{ 1236{
1236 if (!etr_port0_online && !etr_port1_online) 1237 if (!etr_port0_online && !etr_port1_online)
1237 /* Status word is not uptodate if both ports are offline. */ 1238 /* Status word is not uptodate if both ports are offline. */
@@ -1240,10 +1241,10 @@ static ssize_t etr_mode_code_show(struct sys_device *dev,
1240 etr_port0.esw.psc0 : etr_port0.esw.psc1); 1241 etr_port0.esw.psc0 : etr_port0.esw.psc1);
1241} 1242}
1242 1243
1243static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); 1244static DEVICE_ATTR(state_code, 0400, etr_mode_code_show, NULL);
1244 1245
1245static ssize_t etr_untuned_show(struct sys_device *dev, 1246static ssize_t etr_untuned_show(struct device *dev,
1246 struct sysdev_attribute *attr, char *buf) 1247 struct device_attribute *attr, char *buf)
1247{ 1248{
1248 struct etr_aib *aib = etr_aib_from_dev(dev); 1249 struct etr_aib *aib = etr_aib_from_dev(dev);
1249 1250
@@ -1252,10 +1253,10 @@ static ssize_t etr_untuned_show(struct sys_device *dev,
1252 return sprintf(buf, "%i\n", aib->edf1.u); 1253 return sprintf(buf, "%i\n", aib->edf1.u);
1253} 1254}
1254 1255
1255static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); 1256static DEVICE_ATTR(untuned, 0400, etr_untuned_show, NULL);
1256 1257
1257static ssize_t etr_network_id_show(struct sys_device *dev, 1258static ssize_t etr_network_id_show(struct device *dev,
1258 struct sysdev_attribute *attr, char *buf) 1259 struct device_attribute *attr, char *buf)
1259{ 1260{
1260 struct etr_aib *aib = etr_aib_from_dev(dev); 1261 struct etr_aib *aib = etr_aib_from_dev(dev);
1261 1262
@@ -1264,10 +1265,10 @@ static ssize_t etr_network_id_show(struct sys_device *dev,
1264 return sprintf(buf, "%i\n", aib->edf1.net_id); 1265 return sprintf(buf, "%i\n", aib->edf1.net_id);
1265} 1266}
1266 1267
1267static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); 1268static DEVICE_ATTR(network, 0400, etr_network_id_show, NULL);
1268 1269
1269static ssize_t etr_id_show(struct sys_device *dev, 1270static ssize_t etr_id_show(struct device *dev,
1270 struct sysdev_attribute *attr, char *buf) 1271 struct device_attribute *attr, char *buf)
1271{ 1272{
1272 struct etr_aib *aib = etr_aib_from_dev(dev); 1273 struct etr_aib *aib = etr_aib_from_dev(dev);
1273 1274
@@ -1276,10 +1277,10 @@ static ssize_t etr_id_show(struct sys_device *dev,
1276 return sprintf(buf, "%i\n", aib->edf1.etr_id); 1277 return sprintf(buf, "%i\n", aib->edf1.etr_id);
1277} 1278}
1278 1279
1279static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); 1280static DEVICE_ATTR(id, 0400, etr_id_show, NULL);
1280 1281
1281static ssize_t etr_port_number_show(struct sys_device *dev, 1282static ssize_t etr_port_number_show(struct device *dev,
1282 struct sysdev_attribute *attr, char *buf) 1283 struct device_attribute *attr, char *buf)
1283{ 1284{
1284 struct etr_aib *aib = etr_aib_from_dev(dev); 1285 struct etr_aib *aib = etr_aib_from_dev(dev);
1285 1286
@@ -1288,10 +1289,10 @@ static ssize_t etr_port_number_show(struct sys_device *dev,
1288 return sprintf(buf, "%i\n", aib->edf1.etr_pn); 1289 return sprintf(buf, "%i\n", aib->edf1.etr_pn);
1289} 1290}
1290 1291
1291static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); 1292static DEVICE_ATTR(port, 0400, etr_port_number_show, NULL);
1292 1293
1293static ssize_t etr_coupled_show(struct sys_device *dev, 1294static ssize_t etr_coupled_show(struct device *dev,
1294 struct sysdev_attribute *attr, char *buf) 1295 struct device_attribute *attr, char *buf)
1295{ 1296{
1296 struct etr_aib *aib = etr_aib_from_dev(dev); 1297 struct etr_aib *aib = etr_aib_from_dev(dev);
1297 1298
@@ -1300,10 +1301,10 @@ static ssize_t etr_coupled_show(struct sys_device *dev,
1300 return sprintf(buf, "%i\n", aib->edf3.c); 1301 return sprintf(buf, "%i\n", aib->edf3.c);
1301} 1302}
1302 1303
1303static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); 1304static DEVICE_ATTR(coupled, 0400, etr_coupled_show, NULL);
1304 1305
1305static ssize_t etr_local_time_show(struct sys_device *dev, 1306static ssize_t etr_local_time_show(struct device *dev,
1306 struct sysdev_attribute *attr, char *buf) 1307 struct device_attribute *attr, char *buf)
1307{ 1308{
1308 struct etr_aib *aib = etr_aib_from_dev(dev); 1309 struct etr_aib *aib = etr_aib_from_dev(dev);
1309 1310
@@ -1312,10 +1313,10 @@ static ssize_t etr_local_time_show(struct sys_device *dev,
1312 return sprintf(buf, "%i\n", aib->edf3.blto); 1313 return sprintf(buf, "%i\n", aib->edf3.blto);
1313} 1314}
1314 1315
1315static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); 1316static DEVICE_ATTR(local_time, 0400, etr_local_time_show, NULL);
1316 1317
1317static ssize_t etr_utc_offset_show(struct sys_device *dev, 1318static ssize_t etr_utc_offset_show(struct device *dev,
1318 struct sysdev_attribute *attr, char *buf) 1319 struct device_attribute *attr, char *buf)
1319{ 1320{
1320 struct etr_aib *aib = etr_aib_from_dev(dev); 1321 struct etr_aib *aib = etr_aib_from_dev(dev);
1321 1322
@@ -1324,64 +1325,64 @@ static ssize_t etr_utc_offset_show(struct sys_device *dev,
1324 return sprintf(buf, "%i\n", aib->edf3.buo); 1325 return sprintf(buf, "%i\n", aib->edf3.buo);
1325} 1326}
1326 1327
1327static SYSDEV_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL); 1328static DEVICE_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL);
1328 1329
1329static struct sysdev_attribute *etr_port_attributes[] = { 1330static struct device_attribute *etr_port_attributes[] = {
1330 &attr_online, 1331 &dev_attr_online,
1331 &attr_stepping_control, 1332 &dev_attr_stepping_control,
1332 &attr_state_code, 1333 &dev_attr_state_code,
1333 &attr_untuned, 1334 &dev_attr_untuned,
1334 &attr_network, 1335 &dev_attr_network,
1335 &attr_id, 1336 &dev_attr_id,
1336 &attr_port, 1337 &dev_attr_port,
1337 &attr_coupled, 1338 &dev_attr_coupled,
1338 &attr_local_time, 1339 &dev_attr_local_time,
1339 &attr_utc_offset, 1340 &dev_attr_utc_offset,
1340 NULL 1341 NULL
1341}; 1342};
1342 1343
1343static int __init etr_register_port(struct sys_device *dev) 1344static int __init etr_register_port(struct device *dev)
1344{ 1345{
1345 struct sysdev_attribute **attr; 1346 struct device_attribute **attr;
1346 int rc; 1347 int rc;
1347 1348
1348 rc = sysdev_register(dev); 1349 rc = device_register(dev);
1349 if (rc) 1350 if (rc)
1350 goto out; 1351 goto out;
1351 for (attr = etr_port_attributes; *attr; attr++) { 1352 for (attr = etr_port_attributes; *attr; attr++) {
1352 rc = sysdev_create_file(dev, *attr); 1353 rc = device_create_file(dev, *attr);
1353 if (rc) 1354 if (rc)
1354 goto out_unreg; 1355 goto out_unreg;
1355 } 1356 }
1356 return 0; 1357 return 0;
1357out_unreg: 1358out_unreg:
1358 for (; attr >= etr_port_attributes; attr--) 1359 for (; attr >= etr_port_attributes; attr--)
1359 sysdev_remove_file(dev, *attr); 1360 device_remove_file(dev, *attr);
1360 sysdev_unregister(dev); 1361 device_unregister(dev);
1361out: 1362out:
1362 return rc; 1363 return rc;
1363} 1364}
1364 1365
1365static void __init etr_unregister_port(struct sys_device *dev) 1366static void __init etr_unregister_port(struct device *dev)
1366{ 1367{
1367 struct sysdev_attribute **attr; 1368 struct device_attribute **attr;
1368 1369
1369 for (attr = etr_port_attributes; *attr; attr++) 1370 for (attr = etr_port_attributes; *attr; attr++)
1370 sysdev_remove_file(dev, *attr); 1371 device_remove_file(dev, *attr);
1371 sysdev_unregister(dev); 1372 device_unregister(dev);
1372} 1373}
1373 1374
1374static int __init etr_init_sysfs(void) 1375static int __init etr_init_sysfs(void)
1375{ 1376{
1376 int rc; 1377 int rc;
1377 1378
1378 rc = sysdev_class_register(&etr_sysclass); 1379 rc = subsys_system_register(&etr_subsys, NULL);
1379 if (rc) 1380 if (rc)
1380 goto out; 1381 goto out;
1381 rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_port); 1382 rc = device_create_file(etr_subsys.dev_root, &dev_attr_stepping_port);
1382 if (rc) 1383 if (rc)
1383 goto out_unreg_class; 1384 goto out_unreg_subsys;
1384 rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_mode); 1385 rc = device_create_file(etr_subsys.dev_root, &dev_attr_stepping_mode);
1385 if (rc) 1386 if (rc)
1386 goto out_remove_stepping_port; 1387 goto out_remove_stepping_port;
1387 rc = etr_register_port(&etr_port0_dev); 1388 rc = etr_register_port(&etr_port0_dev);
@@ -1395,11 +1396,11 @@ static int __init etr_init_sysfs(void)
1395out_remove_port0: 1396out_remove_port0:
1396 etr_unregister_port(&etr_port0_dev); 1397 etr_unregister_port(&etr_port0_dev);
1397out_remove_stepping_mode: 1398out_remove_stepping_mode:
1398 sysdev_class_remove_file(&etr_sysclass, &attr_stepping_mode); 1399 device_remove_file(etr_subsys.dev_root, &dev_attr_stepping_mode);
1399out_remove_stepping_port: 1400out_remove_stepping_port:
1400 sysdev_class_remove_file(&etr_sysclass, &attr_stepping_port); 1401 device_remove_file(etr_subsys.dev_root, &dev_attr_stepping_port);
1401out_unreg_class: 1402out_unreg_subsys:
1402 sysdev_class_unregister(&etr_sysclass); 1403 bus_unregister(&etr_subsys);
1403out: 1404out:
1404 return rc; 1405 return rc;
1405} 1406}
@@ -1599,14 +1600,15 @@ out_unlock:
1599} 1600}
1600 1601
1601/* 1602/*
1602 * STP class sysfs interface functions 1603 * STP subsys sysfs interface functions
1603 */ 1604 */
1604static struct sysdev_class stp_sysclass = { 1605static struct bus_type stp_subsys = {
1605 .name = "stp", 1606 .name = "stp",
1607 .dev_name = "stp",
1606}; 1608};
1607 1609
1608static ssize_t stp_ctn_id_show(struct sysdev_class *class, 1610static ssize_t stp_ctn_id_show(struct device *dev,
1609 struct sysdev_class_attribute *attr, 1611 struct device_attribute *attr,
1610 char *buf) 1612 char *buf)
1611{ 1613{
1612 if (!stp_online) 1614 if (!stp_online)
@@ -1615,10 +1617,10 @@ static ssize_t stp_ctn_id_show(struct sysdev_class *class,
1615 *(unsigned long long *) stp_info.ctnid); 1617 *(unsigned long long *) stp_info.ctnid);
1616} 1618}
1617 1619
1618static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); 1620static DEVICE_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
1619 1621
1620static ssize_t stp_ctn_type_show(struct sysdev_class *class, 1622static ssize_t stp_ctn_type_show(struct device *dev,
1621 struct sysdev_class_attribute *attr, 1623 struct device_attribute *attr,
1622 char *buf) 1624 char *buf)
1623{ 1625{
1624 if (!stp_online) 1626 if (!stp_online)
@@ -1626,10 +1628,10 @@ static ssize_t stp_ctn_type_show(struct sysdev_class *class,
1626 return sprintf(buf, "%i\n", stp_info.ctn); 1628 return sprintf(buf, "%i\n", stp_info.ctn);
1627} 1629}
1628 1630
1629static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); 1631static DEVICE_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
1630 1632
1631static ssize_t stp_dst_offset_show(struct sysdev_class *class, 1633static ssize_t stp_dst_offset_show(struct device *dev,
1632 struct sysdev_class_attribute *attr, 1634 struct device_attribute *attr,
1633 char *buf) 1635 char *buf)
1634{ 1636{
1635 if (!stp_online || !(stp_info.vbits & 0x2000)) 1637 if (!stp_online || !(stp_info.vbits & 0x2000))
@@ -1637,10 +1639,10 @@ static ssize_t stp_dst_offset_show(struct sysdev_class *class,
1637 return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto); 1639 return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto);
1638} 1640}
1639 1641
1640static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); 1642static DEVICE_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
1641 1643
1642static ssize_t stp_leap_seconds_show(struct sysdev_class *class, 1644static ssize_t stp_leap_seconds_show(struct device *dev,
1643 struct sysdev_class_attribute *attr, 1645 struct device_attribute *attr,
1644 char *buf) 1646 char *buf)
1645{ 1647{
1646 if (!stp_online || !(stp_info.vbits & 0x8000)) 1648 if (!stp_online || !(stp_info.vbits & 0x8000))
@@ -1648,10 +1650,10 @@ static ssize_t stp_leap_seconds_show(struct sysdev_class *class,
1648 return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps); 1650 return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps);
1649} 1651}
1650 1652
1651static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); 1653static DEVICE_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
1652 1654
1653static ssize_t stp_stratum_show(struct sysdev_class *class, 1655static ssize_t stp_stratum_show(struct device *dev,
1654 struct sysdev_class_attribute *attr, 1656 struct device_attribute *attr,
1655 char *buf) 1657 char *buf)
1656{ 1658{
1657 if (!stp_online) 1659 if (!stp_online)
@@ -1659,10 +1661,10 @@ static ssize_t stp_stratum_show(struct sysdev_class *class,
1659 return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum); 1661 return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum);
1660} 1662}
1661 1663
1662static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); 1664static DEVICE_ATTR(stratum, 0400, stp_stratum_show, NULL);
1663 1665
1664static ssize_t stp_time_offset_show(struct sysdev_class *class, 1666static ssize_t stp_time_offset_show(struct device *dev,
1665 struct sysdev_class_attribute *attr, 1667 struct device_attribute *attr,
1666 char *buf) 1668 char *buf)
1667{ 1669{
1668 if (!stp_online || !(stp_info.vbits & 0x0800)) 1670 if (!stp_online || !(stp_info.vbits & 0x0800))
@@ -1670,10 +1672,10 @@ static ssize_t stp_time_offset_show(struct sysdev_class *class,
1670 return sprintf(buf, "%i\n", (int) stp_info.tto); 1672 return sprintf(buf, "%i\n", (int) stp_info.tto);
1671} 1673}
1672 1674
1673static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); 1675static DEVICE_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
1674 1676
1675static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, 1677static ssize_t stp_time_zone_offset_show(struct device *dev,
1676 struct sysdev_class_attribute *attr, 1678 struct device_attribute *attr,
1677 char *buf) 1679 char *buf)
1678{ 1680{
1679 if (!stp_online || !(stp_info.vbits & 0x4000)) 1681 if (!stp_online || !(stp_info.vbits & 0x4000))
@@ -1681,11 +1683,11 @@ static ssize_t stp_time_zone_offset_show(struct sysdev_class *class,
1681 return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo); 1683 return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo);
1682} 1684}
1683 1685
1684static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, 1686static DEVICE_ATTR(time_zone_offset, 0400,
1685 stp_time_zone_offset_show, NULL); 1687 stp_time_zone_offset_show, NULL);
1686 1688
1687static ssize_t stp_timing_mode_show(struct sysdev_class *class, 1689static ssize_t stp_timing_mode_show(struct device *dev,
1688 struct sysdev_class_attribute *attr, 1690 struct device_attribute *attr,
1689 char *buf) 1691 char *buf)
1690{ 1692{
1691 if (!stp_online) 1693 if (!stp_online)
@@ -1693,10 +1695,10 @@ static ssize_t stp_timing_mode_show(struct sysdev_class *class,
1693 return sprintf(buf, "%i\n", stp_info.tmd); 1695 return sprintf(buf, "%i\n", stp_info.tmd);
1694} 1696}
1695 1697
1696static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); 1698static DEVICE_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
1697 1699
1698static ssize_t stp_timing_state_show(struct sysdev_class *class, 1700static ssize_t stp_timing_state_show(struct device *dev,
1699 struct sysdev_class_attribute *attr, 1701 struct device_attribute *attr,
1700 char *buf) 1702 char *buf)
1701{ 1703{
1702 if (!stp_online) 1704 if (!stp_online)
@@ -1704,17 +1706,17 @@ static ssize_t stp_timing_state_show(struct sysdev_class *class,
1704 return sprintf(buf, "%i\n", stp_info.tst); 1706 return sprintf(buf, "%i\n", stp_info.tst);
1705} 1707}
1706 1708
1707static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); 1709static DEVICE_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
1708 1710
1709static ssize_t stp_online_show(struct sysdev_class *class, 1711static ssize_t stp_online_show(struct device *dev,
1710 struct sysdev_class_attribute *attr, 1712 struct device_attribute *attr,
1711 char *buf) 1713 char *buf)
1712{ 1714{
1713 return sprintf(buf, "%i\n", stp_online); 1715 return sprintf(buf, "%i\n", stp_online);
1714} 1716}
1715 1717
1716static ssize_t stp_online_store(struct sysdev_class *class, 1718static ssize_t stp_online_store(struct device *dev,
1717 struct sysdev_class_attribute *attr, 1719 struct device_attribute *attr,
1718 const char *buf, size_t count) 1720 const char *buf, size_t count)
1719{ 1721{
1720 unsigned int value; 1722 unsigned int value;
@@ -1736,47 +1738,47 @@ static ssize_t stp_online_store(struct sysdev_class *class,
1736} 1738}
1737 1739
1738/* 1740/*
1739 * Can't use SYSDEV_CLASS_ATTR because the attribute should be named 1741 * Can't use DEVICE_ATTR because the attribute should be named
1740 * stp/online but attr_online already exists in this file .. 1742 * stp/online but dev_attr_online already exists in this file ..
1741 */ 1743 */
1742static struct sysdev_class_attribute attr_stp_online = { 1744static struct device_attribute dev_attr_stp_online = {
1743 .attr = { .name = "online", .mode = 0600 }, 1745 .attr = { .name = "online", .mode = 0600 },
1744 .show = stp_online_show, 1746 .show = stp_online_show,
1745 .store = stp_online_store, 1747 .store = stp_online_store,
1746}; 1748};
1747 1749
1748static struct sysdev_class_attribute *stp_attributes[] = { 1750static struct device_attribute *stp_attributes[] = {
1749 &attr_ctn_id, 1751 &dev_attr_ctn_id,
1750 &attr_ctn_type, 1752 &dev_attr_ctn_type,
1751 &attr_dst_offset, 1753 &dev_attr_dst_offset,
1752 &attr_leap_seconds, 1754 &dev_attr_leap_seconds,
1753 &attr_stp_online, 1755 &dev_attr_stp_online,
1754 &attr_stratum, 1756 &dev_attr_stratum,
1755 &attr_time_offset, 1757 &dev_attr_time_offset,
1756 &attr_time_zone_offset, 1758 &dev_attr_time_zone_offset,
1757 &attr_timing_mode, 1759 &dev_attr_timing_mode,
1758 &attr_timing_state, 1760 &dev_attr_timing_state,
1759 NULL 1761 NULL
1760}; 1762};
1761 1763
1762static int __init stp_init_sysfs(void) 1764static int __init stp_init_sysfs(void)
1763{ 1765{
1764 struct sysdev_class_attribute **attr; 1766 struct device_attribute **attr;
1765 int rc; 1767 int rc;
1766 1768
1767 rc = sysdev_class_register(&stp_sysclass); 1769 rc = subsys_system_register(&stp_subsys, NULL);
1768 if (rc) 1770 if (rc)
1769 goto out; 1771 goto out;
1770 for (attr = stp_attributes; *attr; attr++) { 1772 for (attr = stp_attributes; *attr; attr++) {
1771 rc = sysdev_class_create_file(&stp_sysclass, *attr); 1773 rc = device_create_file(stp_subsys.dev_root, *attr);
1772 if (rc) 1774 if (rc)
1773 goto out_unreg; 1775 goto out_unreg;
1774 } 1776 }
1775 return 0; 1777 return 0;
1776out_unreg: 1778out_unreg:
1777 for (; attr >= stp_attributes; attr--) 1779 for (; attr >= stp_attributes; attr--)
1778 sysdev_class_remove_file(&stp_sysclass, *attr); 1780 device_remove_file(stp_subsys.dev_root, *attr);
1779 sysdev_class_unregister(&stp_sysclass); 1781 bus_unregister(&stp_subsys);
1780out: 1782out:
1781 return rc; 1783 return rc;
1782} 1784}