Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alistair Popple and committed by
Michael Ellerman
dce143c3 9f0fd049

+22 -17
+22 -17
drivers/char/ipmi/ipmi_powernv.c
··· 15 15 #include <linux/list.h> 16 16 #include <linux/module.h> 17 17 #include <linux/of.h> 18 + #include <linux/of_irq.h> 19 + #include <linux/interrupt.h> 18 20 19 21 #include <asm/opal.h> 20 22 ··· 25 23 u64 interface_id; 26 24 struct ipmi_device_id ipmi_id; 27 25 ipmi_smi_t intf; 28 - u64 event; 29 - struct notifier_block event_nb; 26 + unsigned int irq; 30 27 31 28 /** 32 29 * We assume that there can only be one outstanding request, so ··· 198 197 .poll = ipmi_powernv_poll, 199 198 }; 200 199 201 - static int ipmi_opal_event(struct notifier_block *nb, 202 - unsigned long events, void *change) 200 + static irqreturn_t ipmi_opal_event(int irq, void *data) 203 201 { 204 - struct ipmi_smi_powernv *smi = container_of(nb, 205 - struct ipmi_smi_powernv, event_nb); 202 + struct ipmi_smi_powernv *smi = data; 206 203 207 - if (events & smi->event) 208 - ipmi_powernv_recv(smi); 209 - return 0; 204 + ipmi_powernv_recv(smi); 205 + return IRQ_HANDLED; 210 206 } 211 207 212 208 static int ipmi_powernv_probe(struct platform_device *pdev) ··· 238 240 goto err_free; 239 241 } 240 242 241 - ipmi->event = 1ull << prop; 242 - ipmi->event_nb.notifier_call = ipmi_opal_event; 243 + ipmi->irq = irq_of_parse_and_map(dev->of_node, 0); 244 + if (!ipmi->irq) { 245 + dev_info(dev, "Unable to map irq from device tree\n"); 246 + ipmi->irq = opal_event_request(prop); 247 + } 243 248 244 - rc = opal_notifier_register(&ipmi->event_nb); 245 - if (rc) { 246 - dev_warn(dev, "OPAL notifier registration failed (%d)\n", rc); 247 - goto err_free; 249 + if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH, 250 + "opal-ipmi", ipmi)) { 251 + dev_warn(dev, "Unable to request irq\n"); 252 + goto err_dispose; 248 253 } 249 254 250 255 ipmi->opal_msg = devm_kmalloc(dev, ··· 272 271 err_free_msg: 273 272 devm_kfree(dev, ipmi->opal_msg); 274 273 err_unregister: 275 - opal_notifier_unregister(&ipmi->event_nb); 274 + free_irq(ipmi->irq, ipmi); 275 + err_dispose: 276 + irq_dispose_mapping(ipmi->irq); 276 277 err_free: 277 278 devm_kfree(dev, ipmi); 278 279 return rc; ··· 285 282 struct ipmi_smi_powernv *smi = dev_get_drvdata(&pdev->dev); 286 283 287 284 ipmi_unregister_smi(smi->intf); 288 - opal_notifier_unregister(&smi->event_nb); 285 + free_irq(smi->irq, smi); 286 + irq_dispose_mapping(smi->irq); 287 + 289 288 return 0; 290 289 } 291 290