diff options
Diffstat (limited to 'arch/powerpc/sysdev/pmi.c')
| -rw-r--r-- | arch/powerpc/sysdev/pmi.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c index a5282011d39e..85a7c99c1003 100644 --- a/arch/powerpc/sysdev/pmi.c +++ b/arch/powerpc/sysdev/pmi.c | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | #include <asm/of_platform.h> | 33 | #include <asm/of_platform.h> |
| 34 | #include <asm/io.h> | 34 | #include <asm/io.h> |
| 35 | #include <asm/pmi.h> | 35 | #include <asm/pmi.h> |
| 36 | 36 | #include <asm/prom.h> | |
| 37 | 37 | ||
| 38 | struct pmi_data { | 38 | struct pmi_data { |
| 39 | struct list_head handler; | 39 | struct list_head handler; |
| @@ -49,21 +49,6 @@ struct pmi_data { | |||
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | |||
| 53 | static void __iomem *of_iomap(struct device_node *np) | ||
| 54 | { | ||
| 55 | struct resource res; | ||
| 56 | |||
| 57 | if (of_address_to_resource(np, 0, &res)) | ||
| 58 | return NULL; | ||
| 59 | |||
| 60 | pr_debug("Resource start: 0x%lx\n", res.start); | ||
| 61 | pr_debug("Resource end: 0x%lx\n", res.end); | ||
| 62 | |||
| 63 | return ioremap(res.start, 1 + res.end - res.start); | ||
| 64 | } | ||
| 65 | |||
| 66 | |||
| 67 | static int pmi_irq_handler(int irq, void *dev_id) | 52 | static int pmi_irq_handler(int irq, void *dev_id) |
| 68 | { | 53 | { |
| 69 | struct pmi_data *data; | 54 | struct pmi_data *data; |
| @@ -118,6 +103,7 @@ out: | |||
| 118 | 103 | ||
| 119 | static struct of_device_id pmi_match[] = { | 104 | static struct of_device_id pmi_match[] = { |
| 120 | { .type = "ibm,pmi", .name = "ibm,pmi" }, | 105 | { .type = "ibm,pmi", .name = "ibm,pmi" }, |
| 106 | { .type = "ibm,pmi" }, | ||
| 121 | {}, | 107 | {}, |
| 122 | }; | 108 | }; |
| 123 | 109 | ||
| @@ -153,7 +139,7 @@ static int pmi_of_probe(struct of_device *dev, | |||
| 153 | goto out; | 139 | goto out; |
| 154 | } | 140 | } |
| 155 | 141 | ||
| 156 | data->pmi_reg = of_iomap(np); | 142 | data->pmi_reg = of_iomap(np, 0); |
| 157 | if (!data->pmi_reg) { | 143 | if (!data->pmi_reg) { |
| 158 | printk(KERN_ERR "pmi: invalid register address.\n"); | 144 | printk(KERN_ERR "pmi: invalid register address.\n"); |
| 159 | rc = -EFAULT; | 145 | rc = -EFAULT; |
| @@ -279,6 +265,9 @@ void pmi_register_handler(struct of_device *device, | |||
| 279 | struct pmi_data *data; | 265 | struct pmi_data *data; |
| 280 | data = device->dev.driver_data; | 266 | data = device->dev.driver_data; |
| 281 | 267 | ||
| 268 | if (!data) | ||
| 269 | return; | ||
| 270 | |||
| 282 | spin_lock(&data->handler_spinlock); | 271 | spin_lock(&data->handler_spinlock); |
| 283 | list_add_tail(&handler->node, &data->handler); | 272 | list_add_tail(&handler->node, &data->handler); |
| 284 | spin_unlock(&data->handler_spinlock); | 273 | spin_unlock(&data->handler_spinlock); |
| @@ -289,10 +278,12 @@ void pmi_unregister_handler(struct of_device *device, | |||
| 289 | struct pmi_handler *handler) | 278 | struct pmi_handler *handler) |
| 290 | { | 279 | { |
| 291 | struct pmi_data *data; | 280 | struct pmi_data *data; |
| 281 | data = device->dev.driver_data; | ||
| 292 | 282 | ||
| 293 | pr_debug("pmi: unregistering handler %p\n", handler); | 283 | if (!data) |
| 284 | return; | ||
| 294 | 285 | ||
| 295 | data = device->dev.driver_data; | 286 | pr_debug("pmi: unregistering handler %p\n", handler); |
| 296 | 287 | ||
| 297 | spin_lock(&data->handler_spinlock); | 288 | spin_lock(&data->handler_spinlock); |
| 298 | list_del(&handler->node); | 289 | list_del(&handler->node); |
