aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2015-03-17 05:28:46 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-03-25 06:49:49 -0400
commit0f024379ff8bce40d2387bd7de2dbf0921ab5a5c (patch)
tree069fe403b1b7ba0ab7d6a280743683b1353e8492 /arch/s390
parent22d557abf75ce39f8b2264c86058b4bcc7a8f9f0 (diff)
s390/ipl: cleanup shutdown_action attributes
Use macros wherever applicable and create a shutdown_action attribute group to simplify the code. Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/ipl.c51
1 files changed, 20 insertions, 31 deletions
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 31625912cff8..dd8a3505e52a 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -1675,9 +1675,7 @@ static ssize_t on_reboot_store(struct kobject *kobj,
1675{ 1675{
1676 return set_trigger(buf, &on_reboot_trigger, len); 1676 return set_trigger(buf, &on_reboot_trigger, len);
1677} 1677}
1678 1678static struct kobj_attribute on_reboot_attr = __ATTR_RW(on_reboot);
1679static struct kobj_attribute on_reboot_attr =
1680 __ATTR(on_reboot, 0644, on_reboot_show, on_reboot_store);
1681 1679
1682static void do_machine_restart(char *__unused) 1680static void do_machine_restart(char *__unused)
1683{ 1681{
@@ -1703,9 +1701,7 @@ static ssize_t on_panic_store(struct kobject *kobj,
1703{ 1701{
1704 return set_trigger(buf, &on_panic_trigger, len); 1702 return set_trigger(buf, &on_panic_trigger, len);
1705} 1703}
1706 1704static struct kobj_attribute on_panic_attr = __ATTR_RW(on_panic);
1707static struct kobj_attribute on_panic_attr =
1708 __ATTR(on_panic, 0644, on_panic_show, on_panic_store);
1709 1705
1710static void do_panic(void) 1706static void do_panic(void)
1711{ 1707{
@@ -1731,9 +1727,7 @@ static ssize_t on_restart_store(struct kobject *kobj,
1731{ 1727{
1732 return set_trigger(buf, &on_restart_trigger, len); 1728 return set_trigger(buf, &on_restart_trigger, len);
1733} 1729}
1734 1730static struct kobj_attribute on_restart_attr = __ATTR_RW(on_restart);
1735static struct kobj_attribute on_restart_attr =
1736 __ATTR(on_restart, 0644, on_restart_show, on_restart_store);
1737 1731
1738static void __do_restart(void *ignore) 1732static void __do_restart(void *ignore)
1739{ 1733{
@@ -1770,10 +1764,7 @@ static ssize_t on_halt_store(struct kobject *kobj,
1770{ 1764{
1771 return set_trigger(buf, &on_halt_trigger, len); 1765 return set_trigger(buf, &on_halt_trigger, len);
1772} 1766}
1773 1767static struct kobj_attribute on_halt_attr = __ATTR_RW(on_halt);
1774static struct kobj_attribute on_halt_attr =
1775 __ATTR(on_halt, 0644, on_halt_show, on_halt_store);
1776
1777 1768
1778static void do_machine_halt(void) 1769static void do_machine_halt(void)
1779{ 1770{
@@ -1799,10 +1790,7 @@ static ssize_t on_poff_store(struct kobject *kobj,
1799{ 1790{
1800 return set_trigger(buf, &on_poff_trigger, len); 1791 return set_trigger(buf, &on_poff_trigger, len);
1801} 1792}
1802 1793static struct kobj_attribute on_poff_attr = __ATTR_RW(on_poff);
1803static struct kobj_attribute on_poff_attr =
1804 __ATTR(on_poff, 0644, on_poff_show, on_poff_store);
1805
1806 1794
1807static void do_machine_power_off(void) 1795static void do_machine_power_off(void)
1808{ 1796{
@@ -1812,26 +1800,27 @@ static void do_machine_power_off(void)
1812} 1800}
1813void (*_machine_power_off)(void) = do_machine_power_off; 1801void (*_machine_power_off)(void) = do_machine_power_off;
1814 1802
1803static struct attribute *shutdown_action_attrs[] = {
1804 &on_restart_attr.attr,
1805 &on_reboot_attr.attr,
1806 &on_panic_attr.attr,
1807 &on_halt_attr.attr,
1808 &on_poff_attr.attr,
1809 NULL,
1810};
1811
1812static struct attribute_group shutdown_action_attr_group = {
1813 .attrs = shutdown_action_attrs,
1814};
1815
1815static void __init shutdown_triggers_init(void) 1816static void __init shutdown_triggers_init(void)
1816{ 1817{
1817 shutdown_actions_kset = kset_create_and_add("shutdown_actions", NULL, 1818 shutdown_actions_kset = kset_create_and_add("shutdown_actions", NULL,
1818 firmware_kobj); 1819 firmware_kobj);
1819 if (!shutdown_actions_kset) 1820 if (!shutdown_actions_kset)
1820 goto fail; 1821 goto fail;
1821 if (sysfs_create_file(&shutdown_actions_kset->kobj, 1822 if (sysfs_create_group(&shutdown_actions_kset->kobj,
1822 &on_reboot_attr.attr)) 1823 &shutdown_action_attr_group))
1823 goto fail;
1824 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1825 &on_panic_attr.attr))
1826 goto fail;
1827 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1828 &on_halt_attr.attr))
1829 goto fail;
1830 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1831 &on_poff_attr.attr))
1832 goto fail;
1833 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1834 &on_restart_attr.attr))
1835 goto fail; 1824 goto fail;
1836 return; 1825 return;
1837fail: 1826fail: