Skip to content

Commit dce143c

Browse files
apopplempe
authored andcommitted
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 <[email protected]> Acked-by: Corey Minyard <[email protected]> Cc: Corey Minyard <[email protected]> Cc: [email protected] Signed-off-by: Michael Ellerman <[email protected]>
1 parent 9f0fd04 commit dce143c

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

drivers/char/ipmi/ipmi_powernv.c

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <linux/list.h>
1616
#include <linux/module.h>
1717
#include <linux/of.h>
18+
#include <linux/of_irq.h>
19+
#include <linux/interrupt.h>
1820

1921
#include <asm/opal.h>
2022

@@ -23,8 +25,7 @@ struct ipmi_smi_powernv {
2325
u64 interface_id;
2426
struct ipmi_device_id ipmi_id;
2527
ipmi_smi_t intf;
26-
u64 event;
27-
struct notifier_block event_nb;
28+
unsigned int irq;
2829

2930
/**
3031
* We assume that there can only be one outstanding request, so
@@ -197,15 +198,12 @@ static struct ipmi_smi_handlers ipmi_powernv_smi_handlers = {
197198
.poll = ipmi_powernv_poll,
198199
};
199200

200-
static int ipmi_opal_event(struct notifier_block *nb,
201-
unsigned long events, void *change)
201+
static irqreturn_t ipmi_opal_event(int irq, void *data)
202202
{
203-
struct ipmi_smi_powernv *smi = container_of(nb,
204-
struct ipmi_smi_powernv, event_nb);
203+
struct ipmi_smi_powernv *smi = data;
205204

206-
if (events & smi->event)
207-
ipmi_powernv_recv(smi);
208-
return 0;
205+
ipmi_powernv_recv(smi);
206+
return IRQ_HANDLED;
209207
}
210208

211209
static int ipmi_powernv_probe(struct platform_device *pdev)
@@ -240,13 +238,16 @@ static int ipmi_powernv_probe(struct platform_device *pdev)
240238
goto err_free;
241239
}
242240

243-
ipmi->event = 1ull << prop;
244-
ipmi->event_nb.notifier_call = ipmi_opal_event;
241+
ipmi->irq = irq_of_parse_and_map(dev->of_node, 0);
242+
if (!ipmi->irq) {
243+
dev_info(dev, "Unable to map irq from device tree\n");
244+
ipmi->irq = opal_event_request(prop);
245+
}
245246

246-
rc = opal_notifier_register(&ipmi->event_nb);
247-
if (rc) {
248-
dev_warn(dev, "OPAL notifier registration failed (%d)\n", rc);
249-
goto err_free;
247+
if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
248+
"opal-ipmi", ipmi)) {
249+
dev_warn(dev, "Unable to request irq\n");
250+
goto err_dispose;
250251
}
251252

252253
ipmi->opal_msg = devm_kmalloc(dev,
@@ -271,7 +272,9 @@ static int ipmi_powernv_probe(struct platform_device *pdev)
271272
err_free_msg:
272273
devm_kfree(dev, ipmi->opal_msg);
273274
err_unregister:
274-
opal_notifier_unregister(&ipmi->event_nb);
275+
free_irq(ipmi->irq, ipmi);
276+
err_dispose:
277+
irq_dispose_mapping(ipmi->irq);
275278
err_free:
276279
devm_kfree(dev, ipmi);
277280
return rc;
@@ -282,7 +285,9 @@ static int ipmi_powernv_remove(struct platform_device *pdev)
282285
struct ipmi_smi_powernv *smi = dev_get_drvdata(&pdev->dev);
283286

284287
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+
286291
return 0;
287292
}
288293

0 commit comments

Comments
 (0)