aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-24 13:04:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-24 13:04:05 -0400
commit4d4fcae1d4a10c6cf3c8ca2ec61d2d3270f1225e (patch)
treefb09c210f8402cb7201b6ae4797343adcf4b73ac
parentb4a41ed24c858d75985c7dcba685715fdf2e6114 (diff)
parentb15ed691667f59867c9c130b8d84feda4050be04 (diff)
Merge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: sh: Fix build alloc_thread_info_node function sh: Fix ptrace hw_breakpoint handling sh: Fix ptrace fpu state initialisation sh: Re-enable GENERIC_HARDIRQS_NO_DEPRECATED. sh: pmb: Use struct syscore_ops instead of sysdevs sh: Use struct syscore_ops instead of sysdevs sh: Conver to asm-generic/sizes.h. sh: wire up sys_syncfs.
-rw-r--r--arch/sh/Kconfig3
-rw-r--r--arch/sh/boards/board-edosk7760.c2
-rw-r--r--arch/sh/include/asm/sizes.h63
-rw-r--r--arch/sh/include/asm/unistd_32.h3
-rw-r--r--arch/sh/include/asm/unistd_64.h3
-rw-r--r--arch/sh/kernel/process.c4
-rw-r--r--arch/sh/kernel/ptrace_32.c8
-rw-r--r--arch/sh/kernel/ptrace_64.c6
-rw-r--r--arch/sh/kernel/syscalls_32.S1
-rw-r--r--arch/sh/kernel/syscalls_64.S1
-rw-r--r--arch/sh/mm/pmb.c43
-rw-r--r--drivers/sh/clk/core.c68
-rw-r--r--drivers/sh/intc/core.c95
-rw-r--r--drivers/sh/intc/internals.h1
14 files changed, 104 insertions, 197 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 1fbf0c7583d0..9af3c8d0776b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -23,8 +23,7 @@ config SUPERH
23 select HAVE_SPARSE_IRQ 23 select HAVE_SPARSE_IRQ
24 select RTC_LIB 24 select RTC_LIB
25 select GENERIC_ATOMIC64 25 select GENERIC_ATOMIC64
26 # Support the deprecated APIs until MFD and GPIOLIB catch up. 26 select GENERIC_HARDIRQS_NO_DEPRECATED
27 select GENERIC_HARDIRQS_NO_DEPRECATED if !MFD_SUPPORT && !GPIOLIB
28 select GENERIC_IRQ_SHOW 27 select GENERIC_IRQ_SHOW
29 help 28 help
30 The SuperH is a RISC processor targeted for use in embedded systems 29 The SuperH is a RISC processor targeted for use in embedded systems
diff --git a/arch/sh/boards/board-edosk7760.c b/arch/sh/boards/board-edosk7760.c
index f47ac82da876..e9656a2cc4cc 100644
--- a/arch/sh/boards/board-edosk7760.c
+++ b/arch/sh/boards/board-edosk7760.c
@@ -56,7 +56,7 @@ static struct mtd_partition edosk7760_nor_flash_partitions[] = {
56 }, { 56 }, {
57 .name = "fs", 57 .name = "fs",
58 .offset = MTDPART_OFS_APPEND, 58 .offset = MTDPART_OFS_APPEND,
59 .size = SZ_26M, 59 .size = (26 << 20),
60 }, { 60 }, {
61 .name = "other", 61 .name = "other",
62 .offset = MTDPART_OFS_APPEND, 62 .offset = MTDPART_OFS_APPEND,
diff --git a/arch/sh/include/asm/sizes.h b/arch/sh/include/asm/sizes.h
index 0b9fe2d5c36d..dd248c2e1085 100644
--- a/arch/sh/include/asm/sizes.h
+++ b/arch/sh/include/asm/sizes.h
@@ -1,62 +1 @@
1/* #include <asm-generic/sizes.h>
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */
16/* DO NOT EDIT!! - this file automatically generated
17 * from .s file by awk -f s2h.awk
18 */
19/* Size definitions
20 * Copyright (C) ARM Limited 1998. All rights reserved.
21 */
22
23#ifndef __sizes_h
24#define __sizes_h 1
25
26/* handy sizes */
27#define SZ_16 0x00000010
28#define SZ_32 0x00000020
29#define SZ_64 0x00000040
30#define SZ_128 0x00000080
31#define SZ_256 0x00000100
32#define SZ_512 0x00000200
33
34#define SZ_1K 0x00000400
35#define SZ_2K 0x00000800
36#define SZ_4K 0x00001000
37#define SZ_8K 0x00002000
38#define SZ_16K 0x00004000
39#define SZ_32K 0x00008000
40#define SZ_64K 0x00010000
41#define SZ_128K 0x00020000
42#define SZ_256K 0x00040000
43#define SZ_512K 0x00080000
44
45#define SZ_1M 0x00100000
46#define SZ_2M 0x00200000
47#define SZ_4M 0x00400000
48#define SZ_8M 0x00800000
49#define SZ_16M 0x01000000
50#define SZ_26M 0x01a00000
51#define SZ_32M 0x02000000
52#define SZ_64M 0x04000000
53#define SZ_128M 0x08000000
54#define SZ_256M 0x10000000
55#define SZ_512M 0x20000000
56
57#define SZ_1G 0x40000000
58#define SZ_2G 0x80000000
59
60#endif
61
62/* END */
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index b5a74e88028d..ca7765e5f967 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -372,8 +372,9 @@
372#define __NR_name_to_handle_at 359 372#define __NR_name_to_handle_at 359
373#define __NR_open_by_handle_at 360 373#define __NR_open_by_handle_at 360
374#define __NR_clock_adjtime 361 374#define __NR_clock_adjtime 361
375#define __NR_syncfs 362
375 376
376#define NR_syscalls 362 377#define NR_syscalls 363
377 378
378#ifdef __KERNEL__ 379#ifdef __KERNEL__
379 380
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index 953da4a52199..a694009bb816 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -393,10 +393,11 @@
393#define __NR_name_to_handle_at 370 393#define __NR_name_to_handle_at 370
394#define __NR_open_by_handle_at 371 394#define __NR_open_by_handle_at 371
395#define __NR_clock_adjtime 372 395#define __NR_clock_adjtime 372
396#define __NR_syncfs 373
396 397
397#ifdef __KERNEL__ 398#ifdef __KERNEL__
398 399
399#define NR_syscalls 373 400#define NR_syscalls 374
400 401
401#define __ARCH_WANT_IPC_PARSE_VERSION 402#define __ARCH_WANT_IPC_PARSE_VERSION
402#define __ARCH_WANT_OLD_READDIR 403#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index f39ad57296b7..325f98b1736d 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -32,7 +32,7 @@ void free_thread_xstate(struct task_struct *tsk)
32#if THREAD_SHIFT < PAGE_SHIFT 32#if THREAD_SHIFT < PAGE_SHIFT
33static struct kmem_cache *thread_info_cache; 33static struct kmem_cache *thread_info_cache;
34 34
35struct thread_info *alloc_thread_info(struct task_struct *tsk, int node) 35struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
36{ 36{
37 struct thread_info *ti; 37 struct thread_info *ti;
38#ifdef CONFIG_DEBUG_STACK_USAGE 38#ifdef CONFIG_DEBUG_STACK_USAGE
@@ -57,7 +57,7 @@ void thread_info_cache_init(void)
57 THREAD_SIZE, SLAB_PANIC, NULL); 57 THREAD_SIZE, SLAB_PANIC, NULL);
58} 58}
59#else 59#else
60struct thread_info *alloc_thread_info(struct task_struct *tsk) 60struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
61{ 61{
62#ifdef CONFIG_DEBUG_STACK_USAGE 62#ifdef CONFIG_DEBUG_STACK_USAGE
63 gfp_t mask = GFP_KERNEL | __GFP_ZERO; 63 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 90a15d29feeb..2130ca674e9b 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -101,6 +101,8 @@ static int set_single_step(struct task_struct *tsk, unsigned long addr)
101 101
102 attr = bp->attr; 102 attr = bp->attr;
103 attr.bp_addr = addr; 103 attr.bp_addr = addr;
104 /* reenable breakpoint */
105 attr.disabled = false;
104 err = modify_user_hw_breakpoint(bp, &attr); 106 err = modify_user_hw_breakpoint(bp, &attr);
105 if (unlikely(err)) 107 if (unlikely(err))
106 return err; 108 return err;
@@ -392,6 +394,9 @@ long arch_ptrace(struct task_struct *child, long request,
392 tmp = 0; 394 tmp = 0;
393 } else { 395 } else {
394 unsigned long index; 396 unsigned long index;
397 ret = init_fpu(child);
398 if (ret)
399 break;
395 index = addr - offsetof(struct user, fpu); 400 index = addr - offsetof(struct user, fpu);
396 tmp = ((unsigned long *)child->thread.xstate) 401 tmp = ((unsigned long *)child->thread.xstate)
397 [index >> 2]; 402 [index >> 2];
@@ -423,6 +428,9 @@ long arch_ptrace(struct task_struct *child, long request,
423 else if (addr >= offsetof(struct user, fpu) && 428 else if (addr >= offsetof(struct user, fpu) &&
424 addr < offsetof(struct user, u_fpvalid)) { 429 addr < offsetof(struct user, u_fpvalid)) {
425 unsigned long index; 430 unsigned long index;
431 ret = init_fpu(child);
432 if (ret)
433 break;
426 index = addr - offsetof(struct user, fpu); 434 index = addr - offsetof(struct user, fpu);
427 set_stopped_child_used_math(child); 435 set_stopped_child_used_math(child);
428 ((unsigned long *)child->thread.xstate) 436 ((unsigned long *)child->thread.xstate)
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index 4436eacddb15..c8f97649f354 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -403,6 +403,9 @@ long arch_ptrace(struct task_struct *child, long request,
403 else if ((addr >= offsetof(struct user, fpu)) && 403 else if ((addr >= offsetof(struct user, fpu)) &&
404 (addr < offsetof(struct user, u_fpvalid))) { 404 (addr < offsetof(struct user, u_fpvalid))) {
405 unsigned long index; 405 unsigned long index;
406 ret = init_fpu(child);
407 if (ret)
408 break;
406 index = addr - offsetof(struct user, fpu); 409 index = addr - offsetof(struct user, fpu);
407 tmp = get_fpu_long(child, index); 410 tmp = get_fpu_long(child, index);
408 } else if (addr == offsetof(struct user, u_fpvalid)) { 411 } else if (addr == offsetof(struct user, u_fpvalid)) {
@@ -442,6 +445,9 @@ long arch_ptrace(struct task_struct *child, long request,
442 else if ((addr >= offsetof(struct user, fpu)) && 445 else if ((addr >= offsetof(struct user, fpu)) &&
443 (addr < offsetof(struct user, u_fpvalid))) { 446 (addr < offsetof(struct user, u_fpvalid))) {
444 unsigned long index; 447 unsigned long index;
448 ret = init_fpu(child);
449 if (ret)
450 break;
445 index = addr - offsetof(struct user, fpu); 451 index = addr - offsetof(struct user, fpu);
446 ret = put_fpu_long(child, index, data); 452 ret = put_fpu_long(child, index, data);
447 } 453 }
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index 768fb33fdd35..030966a9305c 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -379,3 +379,4 @@ ENTRY(sys_call_table)
379 .long sys_name_to_handle_at 379 .long sys_name_to_handle_at
380 .long sys_open_by_handle_at /* 360 */ 380 .long sys_open_by_handle_at /* 360 */
381 .long sys_clock_adjtime 381 .long sys_clock_adjtime
382 .long sys_syncfs
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 44e7b00c8067..ca0a6142ab63 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -399,3 +399,4 @@ sys_call_table:
399 .long sys_name_to_handle_at /* 370 */ 399 .long sys_name_to_handle_at /* 370 */
400 .long sys_open_by_handle_at 400 .long sys_open_by_handle_at
401 .long sys_clock_adjtime 401 .long sys_clock_adjtime
402 .long sys_syncfs
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index b20b1b3eee4b..fad52f1f6812 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Privileged Space Mapping Buffer (PMB) Support. 4 * Privileged Space Mapping Buffer (PMB) Support.
5 * 5 *
6 * Copyright (C) 2005 - 2010 Paul Mundt 6 * Copyright (C) 2005 - 2011 Paul Mundt
7 * Copyright (C) 2010 Matt Fleming 7 * Copyright (C) 2010 Matt Fleming
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sysdev.h> 15#include <linux/syscore_ops.h>
16#include <linux/cpu.h> 16#include <linux/cpu.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
@@ -874,46 +874,31 @@ static int __init pmb_debugfs_init(void)
874subsys_initcall(pmb_debugfs_init); 874subsys_initcall(pmb_debugfs_init);
875 875
876#ifdef CONFIG_PM 876#ifdef CONFIG_PM
877static int pmb_sysdev_suspend(struct sys_device *dev, pm_message_t state) 877static void pmb_syscore_resume(void)
878{ 878{
879 static pm_message_t prev_state; 879 struct pmb_entry *pmbe;
880 int i; 880 int i;
881 881
882 /* Restore the PMB after a resume from hibernation */ 882 read_lock(&pmb_rwlock);
883 if (state.event == PM_EVENT_ON &&
884 prev_state.event == PM_EVENT_FREEZE) {
885 struct pmb_entry *pmbe;
886
887 read_lock(&pmb_rwlock);
888 883
889 for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) { 884 for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
890 if (test_bit(i, pmb_map)) { 885 if (test_bit(i, pmb_map)) {
891 pmbe = &pmb_entry_list[i]; 886 pmbe = &pmb_entry_list[i];
892 set_pmb_entry(pmbe); 887 set_pmb_entry(pmbe);
893 }
894 } 888 }
895
896 read_unlock(&pmb_rwlock);
897 } 889 }
898 890
899 prev_state = state; 891 read_unlock(&pmb_rwlock);
900
901 return 0;
902}
903
904static int pmb_sysdev_resume(struct sys_device *dev)
905{
906 return pmb_sysdev_suspend(dev, PMSG_ON);
907} 892}
908 893
909static struct sysdev_driver pmb_sysdev_driver = { 894static struct syscore_ops pmb_syscore_ops = {
910 .suspend = pmb_sysdev_suspend, 895 .resume = pmb_syscore_resume,
911 .resume = pmb_sysdev_resume,
912}; 896};
913 897
914static int __init pmb_sysdev_init(void) 898static int __init pmb_sysdev_init(void)
915{ 899{
916 return sysdev_driver_register(&cpu_sysdev_class, &pmb_sysdev_driver); 900 register_syscore_ops(&pmb_syscore_ops);
901 return 0;
917} 902}
918subsys_initcall(pmb_sysdev_init); 903subsys_initcall(pmb_sysdev_init);
919#endif 904#endif
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
index 5f63c3b83828..4f64183b27fa 100644
--- a/drivers/sh/clk/core.c
+++ b/drivers/sh/clk/core.c
@@ -21,7 +21,7 @@
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/sysdev.h> 24#include <linux/syscore_ops.h>
25#include <linux/seq_file.h> 25#include <linux/seq_file.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/io.h> 27#include <linux/io.h>
@@ -630,68 +630,36 @@ long clk_round_parent(struct clk *clk, unsigned long target,
630EXPORT_SYMBOL_GPL(clk_round_parent); 630EXPORT_SYMBOL_GPL(clk_round_parent);
631 631
632#ifdef CONFIG_PM 632#ifdef CONFIG_PM
633static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state) 633static void clks_core_resume(void)
634{ 634{
635 static pm_message_t prev_state;
636 struct clk *clkp; 635 struct clk *clkp;
637 636
638 switch (state.event) { 637 list_for_each_entry(clkp, &clock_list, node) {
639 case PM_EVENT_ON: 638 if (likely(clkp->ops)) {
640 /* Resumeing from hibernation */ 639 unsigned long rate = clkp->rate;
641 if (prev_state.event != PM_EVENT_FREEZE) 640
642 break; 641 if (likely(clkp->ops->set_parent))
643 642 clkp->ops->set_parent(clkp,
644 list_for_each_entry(clkp, &clock_list, node) { 643 clkp->parent);
645 if (likely(clkp->ops)) { 644 if (likely(clkp->ops->set_rate))
646 unsigned long rate = clkp->rate; 645 clkp->ops->set_rate(clkp, rate);
647 646 else if (likely(clkp->ops->recalc))
648 if (likely(clkp->ops->set_parent)) 647 clkp->rate = clkp->ops->recalc(clkp);
649 clkp->ops->set_parent(clkp,
650 clkp->parent);
651 if (likely(clkp->ops->set_rate))
652 clkp->ops->set_rate(clkp, rate);
653 else if (likely(clkp->ops->recalc))
654 clkp->rate = clkp->ops->recalc(clkp);
655 }
656 } 648 }
657 break;
658 case PM_EVENT_FREEZE:
659 break;
660 case PM_EVENT_SUSPEND:
661 break;
662 } 649 }
663
664 prev_state = state;
665 return 0;
666}
667
668static int clks_sysdev_resume(struct sys_device *dev)
669{
670 return clks_sysdev_suspend(dev, PMSG_ON);
671} 650}
672 651
673static struct sysdev_class clks_sysdev_class = { 652static struct syscore_ops clks_syscore_ops = {
674 .name = "clks", 653 .resume = clks_core_resume,
675};
676
677static struct sysdev_driver clks_sysdev_driver = {
678 .suspend = clks_sysdev_suspend,
679 .resume = clks_sysdev_resume,
680};
681
682static struct sys_device clks_sysdev_dev = {
683 .cls = &clks_sysdev_class,
684}; 654};
685 655
686static int __init clk_sysdev_init(void) 656static int __init clk_syscore_init(void)
687{ 657{
688 sysdev_class_register(&clks_sysdev_class); 658 register_syscore_ops(&clks_syscore_ops);
689 sysdev_driver_register(&clks_sysdev_class, &clks_sysdev_driver);
690 sysdev_register(&clks_sysdev_dev);
691 659
692 return 0; 660 return 0;
693} 661}
694subsys_initcall(clk_sysdev_init); 662subsys_initcall(clk_syscore_init);
695#endif 663#endif
696 664
697/* 665/*
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 9739431092d1..5833afbf08d7 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/sh_intc.h> 26#include <linux/sh_intc.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/syscore_ops.h>
28#include <linux/list.h> 29#include <linux/list.h>
29#include <linux/spinlock.h> 30#include <linux/spinlock.h>
30#include <linux/radix-tree.h> 31#include <linux/radix-tree.h>
@@ -376,91 +377,89 @@ err0:
376 return -ENOMEM; 377 return -ENOMEM;
377} 378}
378 379
379static ssize_t 380static int intc_suspend(void)
380show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
381{ 381{
382 struct intc_desc_int *d; 382 struct intc_desc_int *d;
383 383
384 d = container_of(dev, struct intc_desc_int, sysdev); 384 list_for_each_entry(d, &intc_list, list) {
385 int irq;
385 386
386 return sprintf(buf, "%s\n", d->chip.name); 387 /* enable wakeup irqs belonging to this intc controller */
387} 388 for_each_active_irq(irq) {
389 struct irq_data *data;
390 struct irq_desc *desc;
391 struct irq_chip *chip;
388 392
389static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL); 393 data = irq_get_irq_data(irq);
394 chip = irq_data_get_irq_chip(data);
395 if (chip != &d->chip)
396 continue;
397 desc = irq_to_desc(irq);
398 if ((desc->status & IRQ_WAKEUP))
399 chip->irq_enable(data);
400 }
401 }
402
403 return 0;
404}
390 405
391static int intc_suspend(struct sys_device *dev, pm_message_t state) 406static void intc_resume(void)
392{ 407{
393 struct intc_desc_int *d; 408 struct intc_desc_int *d;
394 struct irq_data *data;
395 struct irq_desc *desc;
396 struct irq_chip *chip;
397 int irq;
398
399 /* get intc controller associated with this sysdev */
400 d = container_of(dev, struct intc_desc_int, sysdev);
401 409
402 switch (state.event) { 410 list_for_each_entry(d, &intc_list, list) {
403 case PM_EVENT_ON: 411 int irq;
404 if (d->state.event != PM_EVENT_FREEZE)
405 break;
406 412
407 for_each_active_irq(irq) { 413 for_each_active_irq(irq) {
408 desc = irq_to_desc(irq); 414 struct irq_data *data;
415 struct irq_desc *desc;
416 struct irq_chip *chip;
417
409 data = irq_get_irq_data(irq); 418 data = irq_get_irq_data(irq);
410 chip = irq_data_get_irq_chip(data); 419 chip = irq_data_get_irq_chip(data);
411
412 /* 420 /*
413 * This will catch the redirect and VIRQ cases 421 * This will catch the redirect and VIRQ cases
414 * due to the dummy_irq_chip being inserted. 422 * due to the dummy_irq_chip being inserted.
415 */ 423 */
416 if (chip != &d->chip) 424 if (chip != &d->chip)
417 continue; 425 continue;
426 desc = irq_to_desc(irq);
418 if (desc->status & IRQ_DISABLED) 427 if (desc->status & IRQ_DISABLED)
419 chip->irq_disable(data); 428 chip->irq_disable(data);
420 else 429 else
421 chip->irq_enable(data); 430 chip->irq_enable(data);
422 } 431 }
423 break;
424 case PM_EVENT_FREEZE:
425 /* nothing has to be done */
426 break;
427 case PM_EVENT_SUSPEND:
428 /* enable wakeup irqs belonging to this intc controller */
429 for_each_active_irq(irq) {
430 desc = irq_to_desc(irq);
431 data = irq_get_irq_data(irq);
432 chip = irq_data_get_irq_chip(data);
433
434 if (chip != &d->chip)
435 continue;
436 if ((desc->status & IRQ_WAKEUP))
437 chip->irq_enable(data);
438 }
439 break;
440 } 432 }
441
442 d->state = state;
443
444 return 0;
445} 433}
446 434
447static int intc_resume(struct sys_device *dev) 435struct syscore_ops intc_syscore_ops = {
448{ 436 .suspend = intc_suspend,
449 return intc_suspend(dev, PMSG_ON); 437 .resume = intc_resume,
450} 438};
451 439
452struct sysdev_class intc_sysdev_class = { 440struct sysdev_class intc_sysdev_class = {
453 .name = "intc", 441 .name = "intc",
454 .suspend = intc_suspend,
455 .resume = intc_resume,
456}; 442};
457 443
458/* register this intc as sysdev to allow suspend/resume */ 444static ssize_t
445show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
446{
447 struct intc_desc_int *d;
448
449 d = container_of(dev, struct intc_desc_int, sysdev);
450
451 return sprintf(buf, "%s\n", d->chip.name);
452}
453
454static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL);
455
459static int __init register_intc_sysdevs(void) 456static int __init register_intc_sysdevs(void)
460{ 457{
461 struct intc_desc_int *d; 458 struct intc_desc_int *d;
462 int error; 459 int error;
463 460
461 register_syscore_ops(&intc_syscore_ops);
462
464 error = sysdev_class_register(&intc_sysdev_class); 463 error = sysdev_class_register(&intc_sysdev_class);
465 if (!error) { 464 if (!error) {
466 list_for_each_entry(d, &intc_list, list) { 465 list_for_each_entry(d, &intc_list, list) {
diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
index 0cf8260971d4..df36a421e675 100644
--- a/drivers/sh/intc/internals.h
+++ b/drivers/sh/intc/internals.h
@@ -53,7 +53,6 @@ struct intc_desc_int {
53 struct list_head list; 53 struct list_head list;
54 struct sys_device sysdev; 54 struct sys_device sysdev;
55 struct radix_tree_root tree; 55 struct radix_tree_root tree;
56 pm_message_t state;
57 raw_spinlock_t lock; 56 raw_spinlock_t lock;
58 unsigned int index; 57 unsigned int index;
59 unsigned long *reg; 58 unsigned long *reg;