diff options
author | Alistair Popple <alistair@popple.id.au> | 2015-05-15 00:06:38 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-05-22 01:14:37 -0400 |
commit | dce143c3381c355ef73be3dd97cf3ca1b15359b8 (patch) | |
tree | 4ec32ccbbb59505699b2a983d9667cb5645c15d7 | |
parent | 9f0fd0499d30dbd61632463f293e2e826fa363b1 (diff) |
ipmi/powernv: Convert to irq event interface
Convert the opal ipmi driver to use the new irq interface for events.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Acked-by: Corey Minyard <cminyard@mvista.com>
Cc: Corey Minyard <minyard@acm.org>
Cc: openipmi-developer@lists.sourceforge.net
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | drivers/char/ipmi/ipmi_powernv.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c index 8753b0f6a317..9b409c0f14f7 100644 --- a/drivers/char/ipmi/ipmi_powernv.c +++ b/drivers/char/ipmi/ipmi_powernv.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/of.h> | 17 | #include <linux/of.h> |
18 | #include <linux/of_irq.h> | ||
19 | #include <linux/interrupt.h> | ||
18 | 20 | ||
19 | #include <asm/opal.h> | 21 | #include <asm/opal.h> |
20 | 22 | ||
@@ -23,8 +25,7 @@ struct ipmi_smi_powernv { | |||
23 | u64 interface_id; | 25 | u64 interface_id; |
24 | struct ipmi_device_id ipmi_id; | 26 | struct ipmi_device_id ipmi_id; |
25 | ipmi_smi_t intf; | 27 | ipmi_smi_t intf; |
26 | u64 event; | 28 | unsigned int irq; |
27 | struct notifier_block event_nb; | ||
28 | 29 | ||
29 | /** | 30 | /** |
30 | * We assume that there can only be one outstanding request, so | 31 | * We assume that there can only be one outstanding request, so |
@@ -197,15 +198,12 @@ static struct ipmi_smi_handlers ipmi_powernv_smi_handlers = { | |||
197 | .poll = ipmi_powernv_poll, | 198 | .poll = ipmi_powernv_poll, |
198 | }; | 199 | }; |
199 | 200 | ||
200 | static int ipmi_opal_event(struct notifier_block *nb, | 201 | static irqreturn_t ipmi_opal_event(int irq, void *data) |
201 | unsigned long events, void *change) | ||
202 | { | 202 | { |
203 | struct ipmi_smi_powernv *smi = container_of(nb, | 203 | struct ipmi_smi_powernv *smi = data; |
204 | struct ipmi_smi_powernv, event_nb); | ||
205 | 204 | ||
206 | if (events & smi->event) | 205 | ipmi_powernv_recv(smi); |
207 | ipmi_powernv_recv(smi); | 206 | return IRQ_HANDLED; |
208 | return 0; | ||
209 | } | 207 | } |
210 | 208 | ||
211 | static int ipmi_powernv_probe(struct platform_device *pdev) | 209 | static int ipmi_powernv_probe(struct platform_device *pdev) |
@@ -240,13 +238,16 @@ static int ipmi_powernv_probe(struct platform_device *pdev) | |||
240 | goto err_free; | 238 | goto err_free; |
241 | } | 239 | } |
242 | 240 | ||
243 | ipmi->event = 1ull << prop; | 241 | ipmi->irq = irq_of_parse_and_map(dev->of_node, 0); |
244 | ipmi->event_nb.notifier_call = ipmi_opal_event; | 242 | if (!ipmi->irq) { |
243 | dev_info(dev, "Unable to map irq from device tree\n"); | ||
244 | ipmi->irq = opal_event_request(prop); | ||
245 | } | ||
245 | 246 | ||
246 | rc = opal_notifier_register(&ipmi->event_nb); | 247 | if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH, |
247 | if (rc) { | 248 | "opal-ipmi", ipmi)) { |
248 | dev_warn(dev, "OPAL notifier registration failed (%d)\n", rc); | 249 | dev_warn(dev, "Unable to request irq\n"); |
249 | goto err_free; | 250 | goto err_dispose; |
250 | } | 251 | } |
251 | 252 | ||
252 | ipmi->opal_msg = devm_kmalloc(dev, | 253 | ipmi->opal_msg = devm_kmalloc(dev, |
@@ -271,7 +272,9 @@ static int ipmi_powernv_probe(struct platform_device *pdev) | |||
271 | err_free_msg: | 272 | err_free_msg: |
272 | devm_kfree(dev, ipmi->opal_msg); | 273 | devm_kfree(dev, ipmi->opal_msg); |
273 | err_unregister: | 274 | err_unregister: |
274 | opal_notifier_unregister(&ipmi->event_nb); | 275 | free_irq(ipmi->irq, ipmi); |
276 | err_dispose: | ||
277 | irq_dispose_mapping(ipmi->irq); | ||
275 | err_free: | 278 | err_free: |
276 | devm_kfree(dev, ipmi); | 279 | devm_kfree(dev, ipmi); |
277 | return rc; | 280 | return rc; |
@@ -282,7 +285,9 @@ static int ipmi_powernv_remove(struct platform_device *pdev) | |||
282 | struct ipmi_smi_powernv *smi = dev_get_drvdata(&pdev->dev); | 285 | struct ipmi_smi_powernv *smi = dev_get_drvdata(&pdev->dev); |
283 | 286 | ||
284 | ipmi_unregister_smi(smi->intf); | 287 | ipmi_unregister_smi(smi->intf); |
285 | opal_notifier_unregister(&smi->event_nb); | 288 | free_irq(smi->irq, smi); |
289 | irq_dispose_mapping(smi->irq); | ||
290 | |||
286 | return 0; | 291 | return 0; |
287 | } | 292 | } |
288 | 293 | ||