Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245357
b: refs/heads/master
c: f25f4f5
h: refs/heads/master
i:
  245355: 1211e5a
v: v3
  • Loading branch information
Rafael J. Wysocki committed May 11, 2011
1 parent c513657 commit d44cb75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 67f9cbf9affe39f67cd3f1d2e2a2a43089d9ab3a
refs/heads/master: f25f4f522a9d2e18595da9df0bf1b6f282040e08
38 changes: 12 additions & 26 deletions trunk/arch/avr32/mach-at32ap/intc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <linux/sysdev.h>
#include <linux/syscore_ops.h>

#include <asm/io.h>

Expand All @@ -21,7 +21,6 @@
struct intc {
void __iomem *regs;
struct irq_chip chip;
struct sys_device sysdev;
#ifdef CONFIG_PM
unsigned long suspend_ipr;
unsigned long saved_ipr[64];
Expand Down Expand Up @@ -146,38 +145,34 @@ void intc_set_suspend_handler(unsigned long offset)
intc0.suspend_ipr = offset;
}

static int intc_suspend(struct sys_device *sdev, pm_message_t state)
static int intc_suspend(void)
{
struct intc *intc = container_of(sdev, struct intc, sysdev);
int i;

if (unlikely(!irqs_disabled())) {
pr_err("intc_suspend: called with interrupts enabled\n");
return -EINVAL;
}

if (unlikely(!intc->suspend_ipr)) {
if (unlikely(!intc0.suspend_ipr)) {
pr_err("intc_suspend: suspend_ipr not initialized\n");
return -EINVAL;
}

for (i = 0; i < 64; i++) {
intc->saved_ipr[i] = intc_readl(intc, INTPR0 + 4 * i);
intc_writel(intc, INTPR0 + 4 * i, intc->suspend_ipr);
intc0.saved_ipr[i] = intc_readl(&intc0, INTPR0 + 4 * i);
intc_writel(&intc0, INTPR0 + 4 * i, intc0.suspend_ipr);
}

return 0;
}

static int intc_resume(struct sys_device *sdev)
static int intc_resume(void)
{
struct intc *intc = container_of(sdev, struct intc, sysdev);
int i;

WARN_ON(!irqs_disabled());

for (i = 0; i < 64; i++)
intc_writel(intc, INTPR0 + 4 * i, intc->saved_ipr[i]);
intc_writel(&intc0, INTPR0 + 4 * i, intc0.saved_ipr[i]);

return 0;
}
Expand All @@ -186,27 +181,18 @@ static int intc_resume(struct sys_device *sdev)
#define intc_resume NULL
#endif

static struct sysdev_class intc_class = {
.name = "intc",
static struct syscore_ops intc_syscore_ops = {
.suspend = intc_suspend,
.resume = intc_resume,
};

static int __init intc_init_sysdev(void)
static int __init intc_init_syscore(void)
{
int ret;

ret = sysdev_class_register(&intc_class);
if (ret)
return ret;
register_syscore_ops(&intc_syscore_ops);

intc0.sysdev.id = 0;
intc0.sysdev.cls = &intc_class;
ret = sysdev_register(&intc0.sysdev);

return ret;
return 0;
}
device_initcall(intc_init_sysdev);
device_initcall(intc_init_syscore);

unsigned long intc_get_pending(unsigned int group)
{
Expand Down

0 comments on commit d44cb75

Please sign in to comment.