diff options
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index f91c065bed5a..7e5dc8f4984a 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/syscore_ops.h> | ||
30 | 31 | ||
31 | #include <asm/ptrace.h> | 32 | #include <asm/ptrace.h> |
32 | #include <asm/signal.h> | 33 | #include <asm/signal.h> |
@@ -1702,9 +1703,8 @@ void mpic_reset_core(int cpu) | |||
1702 | #endif /* CONFIG_SMP */ | 1703 | #endif /* CONFIG_SMP */ |
1703 | 1704 | ||
1704 | #ifdef CONFIG_PM | 1705 | #ifdef CONFIG_PM |
1705 | static int mpic_suspend(struct sys_device *dev, pm_message_t state) | 1706 | static void mpic_suspend_one(struct mpic *mpic) |
1706 | { | 1707 | { |
1707 | struct mpic *mpic = container_of(dev, struct mpic, sysdev); | ||
1708 | int i; | 1708 | int i; |
1709 | 1709 | ||
1710 | for (i = 0; i < mpic->num_sources; i++) { | 1710 | for (i = 0; i < mpic->num_sources; i++) { |
@@ -1713,13 +1713,22 @@ static int mpic_suspend(struct sys_device *dev, pm_message_t state) | |||
1713 | mpic->save_data[i].dest = | 1713 | mpic->save_data[i].dest = |
1714 | mpic_irq_read(i, MPIC_INFO(IRQ_DESTINATION)); | 1714 | mpic_irq_read(i, MPIC_INFO(IRQ_DESTINATION)); |
1715 | } | 1715 | } |
1716 | } | ||
1717 | |||
1718 | static int mpic_suspend(void) | ||
1719 | { | ||
1720 | struct mpic *mpic = mpics; | ||
1721 | |||
1722 | while (mpic) { | ||
1723 | mpic_suspend_one(mpic); | ||
1724 | mpic = mpic->next; | ||
1725 | } | ||
1716 | 1726 | ||
1717 | return 0; | 1727 | return 0; |
1718 | } | 1728 | } |
1719 | 1729 | ||
1720 | static int mpic_resume(struct sys_device *dev) | 1730 | static void mpic_resume_one(struct mpic *mpic) |
1721 | { | 1731 | { |
1722 | struct mpic *mpic = container_of(dev, struct mpic, sysdev); | ||
1723 | int i; | 1732 | int i; |
1724 | 1733 | ||
1725 | for (i = 0; i < mpic->num_sources; i++) { | 1734 | for (i = 0; i < mpic->num_sources; i++) { |
@@ -1746,33 +1755,28 @@ static int mpic_resume(struct sys_device *dev) | |||
1746 | } | 1755 | } |
1747 | #endif | 1756 | #endif |
1748 | } /* end for loop */ | 1757 | } /* end for loop */ |
1758 | } | ||
1749 | 1759 | ||
1750 | return 0; | 1760 | static void mpic_resume(void) |
1761 | { | ||
1762 | struct mpic *mpic = mpics; | ||
1763 | |||
1764 | while (mpic) { | ||
1765 | mpic_resume_one(mpic); | ||
1766 | mpic = mpic->next; | ||
1767 | } | ||
1751 | } | 1768 | } |
1752 | #endif | ||
1753 | 1769 | ||
1754 | static struct sysdev_class mpic_sysclass = { | 1770 | static struct syscore_ops mpic_syscore_ops = { |
1755 | #ifdef CONFIG_PM | ||
1756 | .resume = mpic_resume, | 1771 | .resume = mpic_resume, |
1757 | .suspend = mpic_suspend, | 1772 | .suspend = mpic_suspend, |
1758 | #endif | ||
1759 | .name = "mpic", | ||
1760 | }; | 1773 | }; |
1761 | 1774 | ||
1762 | static int mpic_init_sys(void) | 1775 | static int mpic_init_sys(void) |
1763 | { | 1776 | { |
1764 | struct mpic *mpic = mpics; | 1777 | register_syscore_ops(&mpic_syscore_ops); |
1765 | int error, id = 0; | 1778 | return 0; |
1766 | |||
1767 | error = sysdev_class_register(&mpic_sysclass); | ||
1768 | |||
1769 | while (mpic && !error) { | ||
1770 | mpic->sysdev.cls = &mpic_sysclass; | ||
1771 | mpic->sysdev.id = id++; | ||
1772 | error = sysdev_register(&mpic->sysdev); | ||
1773 | mpic = mpic->next; | ||
1774 | } | ||
1775 | return error; | ||
1776 | } | 1779 | } |
1777 | 1780 | ||
1778 | device_initcall(mpic_init_sys); | 1781 | device_initcall(mpic_init_sys); |
1782 | #endif | ||