aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/mpic.h3
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c28
-rw-r--r--arch/powerpc/platforms/powermac/pic.c42
-rw-r--r--arch/powerpc/sysdev/ipic.c36
-rw-r--r--arch/powerpc/sysdev/mpic.c48
5 files changed, 64 insertions, 93 deletions
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index 7005ee0b074..49baddcdd14 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -3,7 +3,6 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/irq.h> 5#include <linux/irq.h>
6#include <linux/sysdev.h>
7#include <asm/dcr.h> 6#include <asm/dcr.h>
8#include <asm/msi_bitmap.h> 7#include <asm/msi_bitmap.h>
9 8
@@ -320,8 +319,6 @@ struct mpic
320 /* link */ 319 /* link */
321 struct mpic *next; 320 struct mpic *next;
322 321
323 struct sys_device sysdev;
324
325#ifdef CONFIG_PM 322#ifdef CONFIG_PM
326 struct mpic_irq_save *save_data; 323 struct mpic_irq_save *save_data;
327#endif 324#endif
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index acfaccea5f4..3675da73623 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -32,6 +32,7 @@
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/mutex.h> 33#include <linux/mutex.h>
34#include <linux/linux_logo.h> 34#include <linux/linux_logo.h>
35#include <linux/syscore_ops.h>
35#include <asm/spu.h> 36#include <asm/spu.h>
36#include <asm/spu_priv1.h> 37#include <asm/spu_priv1.h>
37#include <asm/spu_csa.h> 38#include <asm/spu_csa.h>
@@ -521,18 +522,8 @@ void spu_init_channels(struct spu *spu)
521} 522}
522EXPORT_SYMBOL_GPL(spu_init_channels); 523EXPORT_SYMBOL_GPL(spu_init_channels);
523 524
524static int spu_shutdown(struct sys_device *sysdev)
525{
526 struct spu *spu = container_of(sysdev, struct spu, sysdev);
527
528 spu_free_irqs(spu);
529 spu_destroy_spu(spu);
530 return 0;
531}
532
533static struct sysdev_class spu_sysdev_class = { 525static struct sysdev_class spu_sysdev_class = {
534 .name = "spu", 526 .name = "spu",
535 .shutdown = spu_shutdown,
536}; 527};
537 528
538int spu_add_sysdev_attr(struct sysdev_attribute *attr) 529int spu_add_sysdev_attr(struct sysdev_attribute *attr)
@@ -797,6 +788,22 @@ static inline void crash_register_spus(struct list_head *list)
797} 788}
798#endif 789#endif
799 790
791static void spu_shutdown(void)
792{
793 struct spu *spu;
794
795 mutex_lock(&spu_full_list_mutex);
796 list_for_each_entry(spu, &spu_full_list, full_list) {
797 spu_free_irqs(spu);
798 spu_destroy_spu(spu);
799 }
800 mutex_unlock(&spu_full_list_mutex);
801}
802
803static struct syscore_ops spu_syscore_ops = {
804 .shutdown = spu_shutdown,
805};
806
800static int __init init_spu_base(void) 807static int __init init_spu_base(void)
801{ 808{
802 int i, ret = 0; 809 int i, ret = 0;
@@ -830,6 +837,7 @@ static int __init init_spu_base(void)
830 crash_register_spus(&spu_full_list); 837 crash_register_spus(&spu_full_list);
831 mutex_unlock(&spu_full_list_mutex); 838 mutex_unlock(&spu_full_list_mutex);
832 spu_add_sysdev_attr(&attr_stat); 839 spu_add_sysdev_attr(&attr_stat);
840 register_syscore_ops(&spu_syscore_ops);
833 841
834 spu_init_affinity(); 842 spu_init_affinity();
835 843
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 023f24086a0..7c18a1607d1 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -21,7 +21,7 @@
21#include <linux/signal.h> 21#include <linux/signal.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/sysdev.h> 24#include <linux/syscore_ops.h>
25#include <linux/adb.h> 25#include <linux/adb.h>
26#include <linux/pmu.h> 26#include <linux/pmu.h>
27#include <linux/module.h> 27#include <linux/module.h>
@@ -677,7 +677,7 @@ not_found:
677 return viaint; 677 return viaint;
678} 678}
679 679
680static int pmacpic_suspend(struct sys_device *sysdev, pm_message_t state) 680static int pmacpic_suspend(void)
681{ 681{
682 int viaint = pmacpic_find_viaint(); 682 int viaint = pmacpic_find_viaint();
683 683
@@ -698,7 +698,7 @@ static int pmacpic_suspend(struct sys_device *sysdev, pm_message_t state)
698 return 0; 698 return 0;
699} 699}
700 700
701static int pmacpic_resume(struct sys_device *sysdev) 701static void pmacpic_resume(void)
702{ 702{
703 int i; 703 int i;
704 704
@@ -709,39 +709,19 @@ static int pmacpic_resume(struct sys_device *sysdev)
709 for (i = 0; i < max_real_irqs; ++i) 709 for (i = 0; i < max_real_irqs; ++i)
710 if (test_bit(i, sleep_save_mask)) 710 if (test_bit(i, sleep_save_mask))
711 pmac_unmask_irq(irq_get_irq_data(i)); 711 pmac_unmask_irq(irq_get_irq_data(i));
712
713 return 0;
714} 712}
715 713
716#endif /* CONFIG_PM && CONFIG_PPC32 */ 714static struct syscore_ops pmacpic_syscore_ops = {
717 715 .suspend = pmacpic_suspend,
718static struct sysdev_class pmacpic_sysclass = { 716 .resume = pmacpic_resume,
719 .name = "pmac_pic",
720}; 717};
721 718
722static struct sys_device device_pmacpic = { 719static int __init init_pmacpic_syscore(void)
723 .id = 0,
724 .cls = &pmacpic_sysclass,
725};
726
727static struct sysdev_driver driver_pmacpic = {
728#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
729 .suspend = &pmacpic_suspend,
730 .resume = &pmacpic_resume,
731#endif /* CONFIG_PM && CONFIG_PPC32 */
732};
733
734static int __init init_pmacpic_sysfs(void)
735{ 720{
736#ifdef CONFIG_PPC32 721 register_syscore_ops(&pmacpic_syscore_ops);
737 if (max_irqs == 0)
738 return -ENODEV;
739#endif
740 printk(KERN_DEBUG "Registering pmac pic with sysfs...\n");
741 sysdev_class_register(&pmacpic_sysclass);
742 sysdev_register(&device_pmacpic);
743 sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic);
744 return 0; 722 return 0;
745} 723}
746machine_subsys_initcall(powermac, init_pmacpic_sysfs);
747 724
725machine_subsys_initcall(powermac, init_pmacpic_syscore);
726
727#endif /* CONFIG_PM && CONFIG_PPC32 */
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index fa438be962b..596554a8725 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -18,7 +18,7 @@
18#include <linux/stddef.h> 18#include <linux/stddef.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/signal.h> 20#include <linux/signal.h>
21#include <linux/sysdev.h> 21#include <linux/syscore_ops.h>
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
@@ -902,7 +902,7 @@ static struct {
902 u32 sercr; 902 u32 sercr;
903} ipic_saved_state; 903} ipic_saved_state;
904 904
905static int ipic_suspend(struct sys_device *sdev, pm_message_t state) 905static int ipic_suspend(void)
906{ 906{
907 struct ipic *ipic = primary_ipic; 907 struct ipic *ipic = primary_ipic;
908 908
@@ -933,7 +933,7 @@ static int ipic_suspend(struct sys_device *sdev, pm_message_t state)
933 return 0; 933 return 0;
934} 934}
935 935
936static int ipic_resume(struct sys_device *sdev) 936static void ipic_resume(void)
937{ 937{
938 struct ipic *ipic = primary_ipic; 938 struct ipic *ipic = primary_ipic;
939 939
@@ -949,44 +949,26 @@ static int ipic_resume(struct sys_device *sdev)
949 ipic_write(ipic->regs, IPIC_SECNR, ipic_saved_state.secnr); 949 ipic_write(ipic->regs, IPIC_SECNR, ipic_saved_state.secnr);
950 ipic_write(ipic->regs, IPIC_SERMR, ipic_saved_state.sermr); 950 ipic_write(ipic->regs, IPIC_SERMR, ipic_saved_state.sermr);
951 ipic_write(ipic->regs, IPIC_SERCR, ipic_saved_state.sercr); 951 ipic_write(ipic->regs, IPIC_SERCR, ipic_saved_state.sercr);
952
953 return 0;
954} 952}
955#else 953#else
956#define ipic_suspend NULL 954#define ipic_suspend NULL
957#define ipic_resume NULL 955#define ipic_resume NULL
958#endif 956#endif
959 957
960static struct sysdev_class ipic_sysclass = { 958static struct syscore_ops ipic_syscore_ops = {
961 .name = "ipic",
962 .suspend = ipic_suspend, 959 .suspend = ipic_suspend,
963 .resume = ipic_resume, 960 .resume = ipic_resume,
964}; 961};
965 962
966static struct sys_device device_ipic = { 963static int __init init_ipic_syscore(void)
967 .id = 0,
968 .cls = &ipic_sysclass,
969};
970
971static int __init init_ipic_sysfs(void)
972{ 964{
973 int rc;
974
975 if (!primary_ipic || !primary_ipic->regs) 965 if (!primary_ipic || !primary_ipic->regs)
976 return -ENODEV; 966 return -ENODEV;
977 printk(KERN_DEBUG "Registering ipic with sysfs...\n");
978 967
979 rc = sysdev_class_register(&ipic_sysclass); 968 printk(KERN_DEBUG "Registering ipic system core operations\n");
980 if (rc) { 969 register_syscore_ops(&ipic_syscore_ops);
981 printk(KERN_ERR "Failed registering ipic sys class\n"); 970
982 return -ENODEV;
983 }
984 rc = sysdev_register(&device_ipic);
985 if (rc) {
986 printk(KERN_ERR "Failed registering ipic sys device\n");
987 return -ENODEV;
988 }
989 return 0; 971 return 0;
990} 972}
991 973
992subsys_initcall(init_ipic_sysfs); 974subsys_initcall(init_ipic_syscore);
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index f91c065bed5..7e5dc8f4984 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
1705static int mpic_suspend(struct sys_device *dev, pm_message_t state) 1706static 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
1718static 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
1720static int mpic_resume(struct sys_device *dev) 1730static 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; 1760static 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
1754static struct sysdev_class mpic_sysclass = { 1770static 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
1762static int mpic_init_sys(void) 1775static 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
1778device_initcall(mpic_init_sys); 1781device_initcall(mpic_init_sys);
1782#endif