Commit f869b87c authored by Patrick Mochel's avatar Patrick Mochel

[sa1100 irq] Convert to new system device API.

parent 3db29faf
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/device.h> #include <linux/sysdev.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
...@@ -211,25 +211,16 @@ static struct resource irq_resource = { ...@@ -211,25 +211,16 @@ static struct resource irq_resource = {
.end = 0x9005ffff, .end = 0x9005ffff,
}; };
struct sa1100irq_state { static struct {
unsigned int saved; unsigned int saved;
unsigned int icmr; unsigned int icmr;
unsigned int iclr; unsigned int iclr;
unsigned int iccr; unsigned int iccr;
}; } sa1100irq_state;
static int sa1100irq_suspend(struct device *dev, u32 state, u32 level) static int sa1100irq_suspend(struct device *dev, u32 state, u32 level)
{ {
struct sa1100irq_state *st; struct sa1100irq_state *st = &sa1100irq_state;
if (!dev->saved_state && level == SUSPEND_NOTIFY)
dev->saved_state = kmalloc(sizeof(struct sa1100irq_state),
GFP_KERNEL);
if (!dev->saved_state)
return -ENOMEM;
if (level == SUSPEND_POWER_DOWN) {
st = (struct sa1100irq_state *)dev->saved_state;
st->saved = 1; st->saved = 1;
st->icmr = ICMR; st->icmr = ICMR;
...@@ -253,17 +244,13 @@ static int sa1100irq_suspend(struct device *dev, u32 state, u32 level) ...@@ -253,17 +244,13 @@ static int sa1100irq_suspend(struct device *dev, u32 state, u32 level)
* Clear any pending GPIO interrupts. * Clear any pending GPIO interrupts.
*/ */
GEDR = GEDR; GEDR = GEDR;
}
return 0; return 0;
} }
static int sa1100irq_resume(struct device *dev, u32 level) static int sa1100irq_resume(struct sys_device *dev)
{ {
struct sa1100irq_state *st; struct sa1100irq_state *st = &sa1100irq_state;
if (level == RESUME_POWER_ON) {
st = (struct sa1100irq_state *)dev->saved_state;
dev->saved_state = NULL;
if (st->saved) { if (st->saved) {
ICCR = st->iccr; ICCR = st->iccr;
...@@ -274,31 +261,23 @@ static int sa1100irq_resume(struct device *dev, u32 level) ...@@ -274,31 +261,23 @@ static int sa1100irq_resume(struct device *dev, u32 level)
ICMR = st->icmr; ICMR = st->icmr;
} }
kfree(st);
}
return 0; return 0;
} }
static struct device_driver sa1100irq_driver = { static struct sysdev_class sa1100irq_sysclass = {
.name = "sa11x0-irq", set_kset_name("sa11x0-irq"),
.bus = &system_bus_type,
.suspend = sa1100irq_suspend, .suspend = sa1100irq_suspend,
.resume = sa1100irq_resume, .resume = sa1100irq_resume,
}; };
static struct sys_device sa1100irq_device = { static struct sys_device sa1100irq_device = {
.name = "irq",
.id = 0, .id = 0,
.dev = { .cls = &sa1100irq_sysclass,
.name = "Intel SA11x0 [Interrupt Controller]",
.driver = &sa1100irq_driver,
},
}; };
static int __init sa1100irq_init_devicefs(void) static int __init sa1100irq_init_devicefs(void)
{ {
driver_register(&sa1100irq_driver); sysdev_class_register(&sa1100irq_sysclass);
return sys_device_register(&sa1100irq_device); return sys_device_register(&sa1100irq_device);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment