aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/time.c
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2010-01-05 06:47:58 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-07 20:04:47 -0500
commitc9be0a36f9bf392a7984473124a67a12964df11f (patch)
tree23fcf49f277d9a093b2b29831811219410ad7b05 /arch/s390/kernel/time.c
parent3d03ba4d1dd2246adff5a9ff1194a539b3bc05a7 (diff)
sysdev: Pass attribute in sysdev_class attributes show/store
Passing the attribute to the low level IO functions allows all kinds of cleanups, by sharing low level IO code without requiring an own function for every piece of data. Also drivers can extend the attributes with own data fields and use that in the low level function. Similar to sysdev_attributes and normal attributes. This is a tree-wide sweep, converting everything in one go. No functional changes in this patch other than passing the new argument everywhere. Tested on x86, the non x86 parts are uncompiled. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/s390/kernel/time.c')
-rw-r--r--arch/s390/kernel/time.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index a8f93f1705ad..75894c281710 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -1116,14 +1116,18 @@ static struct sys_device etr_port1_dev = {
1116/* 1116/*
1117 * ETR class attributes 1117 * ETR class attributes
1118 */ 1118 */
1119static ssize_t etr_stepping_port_show(struct sysdev_class *class, char *buf) 1119static ssize_t etr_stepping_port_show(struct sysdev_class *class,
1120 struct sysdev_class_attribute *attr,
1121 char *buf)
1120{ 1122{
1121 return sprintf(buf, "%i\n", etr_port0.esw.p); 1123 return sprintf(buf, "%i\n", etr_port0.esw.p);
1122} 1124}
1123 1125
1124static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); 1126static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL);
1125 1127
1126static ssize_t etr_stepping_mode_show(struct sysdev_class *class, char *buf) 1128static ssize_t etr_stepping_mode_show(struct sysdev_class *class,
1129 struct sysdev_class_attribute *attr,
1130 char *buf)
1127{ 1131{
1128 char *mode_str; 1132 char *mode_str;
1129 1133
@@ -1584,7 +1588,9 @@ static struct sysdev_class stp_sysclass = {
1584 .name = "stp", 1588 .name = "stp",
1585}; 1589};
1586 1590
1587static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf) 1591static ssize_t stp_ctn_id_show(struct sysdev_class *class,
1592 struct sysdev_class_attribute *attr,
1593 char *buf)
1588{ 1594{
1589 if (!stp_online) 1595 if (!stp_online)
1590 return -ENODATA; 1596 return -ENODATA;
@@ -1594,7 +1600,9 @@ static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf)
1594 1600
1595static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); 1601static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
1596 1602
1597static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf) 1603static ssize_t stp_ctn_type_show(struct sysdev_class *class,
1604 struct sysdev_class_attribute *attr,
1605 char *buf)
1598{ 1606{
1599 if (!stp_online) 1607 if (!stp_online)
1600 return -ENODATA; 1608 return -ENODATA;
@@ -1603,7 +1611,9 @@ static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf)
1603 1611
1604static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); 1612static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
1605 1613
1606static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf) 1614static ssize_t stp_dst_offset_show(struct sysdev_class *class,
1615 struct sysdev_class_attribute *attr,
1616 char *buf)
1607{ 1617{
1608 if (!stp_online || !(stp_info.vbits & 0x2000)) 1618 if (!stp_online || !(stp_info.vbits & 0x2000))
1609 return -ENODATA; 1619 return -ENODATA;
@@ -1612,7 +1622,9 @@ static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf)
1612 1622
1613static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); 1623static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
1614 1624
1615static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf) 1625static ssize_t stp_leap_seconds_show(struct sysdev_class *class,
1626 struct sysdev_class_attribute *attr,
1627 char *buf)
1616{ 1628{
1617 if (!stp_online || !(stp_info.vbits & 0x8000)) 1629 if (!stp_online || !(stp_info.vbits & 0x8000))
1618 return -ENODATA; 1630 return -ENODATA;
@@ -1621,7 +1633,9 @@ static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf)
1621 1633
1622static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); 1634static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
1623 1635
1624static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf) 1636static ssize_t stp_stratum_show(struct sysdev_class *class,
1637 struct sysdev_class_attribute *attr,
1638 char *buf)
1625{ 1639{
1626 if (!stp_online) 1640 if (!stp_online)
1627 return -ENODATA; 1641 return -ENODATA;
@@ -1630,7 +1644,9 @@ static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf)
1630 1644
1631static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); 1645static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL);
1632 1646
1633static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf) 1647static ssize_t stp_time_offset_show(struct sysdev_class *class,
1648 struct sysdev_class_attribute *attr,
1649 char *buf)
1634{ 1650{
1635 if (!stp_online || !(stp_info.vbits & 0x0800)) 1651 if (!stp_online || !(stp_info.vbits & 0x0800))
1636 return -ENODATA; 1652 return -ENODATA;
@@ -1639,7 +1655,9 @@ static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf)
1639 1655
1640static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); 1656static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
1641 1657
1642static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf) 1658static ssize_t stp_time_zone_offset_show(struct sysdev_class *class,
1659 struct sysdev_class_attribute *attr,
1660 char *buf)
1643{ 1661{
1644 if (!stp_online || !(stp_info.vbits & 0x4000)) 1662 if (!stp_online || !(stp_info.vbits & 0x4000))
1645 return -ENODATA; 1663 return -ENODATA;
@@ -1649,7 +1667,9 @@ static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf)
1649static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, 1667static SYSDEV_CLASS_ATTR(time_zone_offset, 0400,
1650 stp_time_zone_offset_show, NULL); 1668 stp_time_zone_offset_show, NULL);
1651 1669
1652static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf) 1670static ssize_t stp_timing_mode_show(struct sysdev_class *class,
1671 struct sysdev_class_attribute *attr,
1672 char *buf)
1653{ 1673{
1654 if (!stp_online) 1674 if (!stp_online)
1655 return -ENODATA; 1675 return -ENODATA;
@@ -1658,7 +1678,9 @@ static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf)
1658 1678
1659static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); 1679static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
1660 1680
1661static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf) 1681static ssize_t stp_timing_state_show(struct sysdev_class *class,
1682 struct sysdev_class_attribute *attr,
1683 char *buf)
1662{ 1684{
1663 if (!stp_online) 1685 if (!stp_online)
1664 return -ENODATA; 1686 return -ENODATA;
@@ -1667,12 +1689,15 @@ static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf)
1667 1689
1668static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); 1690static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
1669 1691
1670static ssize_t stp_online_show(struct sysdev_class *class, char *buf) 1692static ssize_t stp_online_show(struct sysdev_class *class,
1693 struct sysdev_class_attribute *attr,
1694 char *buf)
1671{ 1695{
1672 return sprintf(buf, "%i\n", stp_online); 1696 return sprintf(buf, "%i\n", stp_online);
1673} 1697}
1674 1698
1675static ssize_t stp_online_store(struct sysdev_class *class, 1699static ssize_t stp_online_store(struct sysdev_class *class,
1700 struct sysdev_class_attribute *attr,
1676 const char *buf, size_t count) 1701 const char *buf, size_t count)
1677{ 1702{
1678 unsigned int value; 1703 unsigned int value;