diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-09-16 14:07:32 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2009-09-17 09:48:18 -0400 |
commit | 37bce07077b0c335d8747f1ddb27ad585434a47e (patch) | |
tree | baf697dc80a83a22261520661b57bd0ba9777bec /drivers/mfd | |
parent | 3860e6c4b93d6a1c2428f0f45c77e083197da2d4 (diff) |
mfd: Convert WM8350 to use request_threaded_irq()
Instead of hand rolling our own variant.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/wm8350-core.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index 9d662a576a41..ba27c9dc1ad3 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c | |||
@@ -353,15 +353,15 @@ static void wm8350_irq_call_handler(struct wm8350 *wm8350, int irq) | |||
353 | } | 353 | } |
354 | 354 | ||
355 | /* | 355 | /* |
356 | * wm8350_irq_worker actually handles the interrupts. Since all | 356 | * This is a threaded IRQ handler so can access I2C/SPI. Since all |
357 | * interrupts are clear on read the IRQ line will be reasserted and | 357 | * interrupts are clear on read the IRQ line will be reasserted and |
358 | * the physical IRQ will be handled again if another interrupt is | 358 | * the physical IRQ will be handled again if another interrupt is |
359 | * asserted while we run - in the normal course of events this is a | 359 | * asserted while we run - in the normal course of events this is a |
360 | * rare occurrence so we save I2C/SPI reads. | 360 | * rare occurrence so we save I2C/SPI reads. |
361 | */ | 361 | */ |
362 | static void wm8350_irq_worker(struct work_struct *work) | 362 | static irqreturn_t wm8350_irq(int irq, void *data) |
363 | { | 363 | { |
364 | struct wm8350 *wm8350 = container_of(work, struct wm8350, irq_work); | 364 | struct wm8350 *wm8350 = data; |
365 | u16 level_one, status1, status2, comp; | 365 | u16 level_one, status1, status2, comp; |
366 | 366 | ||
367 | /* TODO: Use block reads to improve performance? */ | 367 | /* TODO: Use block reads to improve performance? */ |
@@ -552,16 +552,6 @@ static void wm8350_irq_worker(struct work_struct *work) | |||
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | enable_irq(wm8350->chip_irq); | ||
556 | } | ||
557 | |||
558 | static irqreturn_t wm8350_irq(int irq, void *data) | ||
559 | { | ||
560 | struct wm8350 *wm8350 = data; | ||
561 | |||
562 | disable_irq_nosync(irq); | ||
563 | schedule_work(&wm8350->irq_work); | ||
564 | |||
565 | return IRQ_HANDLED; | 555 | return IRQ_HANDLED; |
566 | } | 556 | } |
567 | 557 | ||
@@ -1428,9 +1418,8 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, | |||
1428 | 1418 | ||
1429 | mutex_init(&wm8350->auxadc_mutex); | 1419 | mutex_init(&wm8350->auxadc_mutex); |
1430 | mutex_init(&wm8350->irq_mutex); | 1420 | mutex_init(&wm8350->irq_mutex); |
1431 | INIT_WORK(&wm8350->irq_work, wm8350_irq_worker); | ||
1432 | if (irq) { | 1421 | if (irq) { |
1433 | int flags = 0; | 1422 | int flags = IRQF_ONESHOT; |
1434 | 1423 | ||
1435 | if (pdata && pdata->irq_high) { | 1424 | if (pdata && pdata->irq_high) { |
1436 | flags |= IRQF_TRIGGER_HIGH; | 1425 | flags |= IRQF_TRIGGER_HIGH; |
@@ -1444,8 +1433,8 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, | |||
1444 | WM8350_IRQ_POL); | 1433 | WM8350_IRQ_POL); |
1445 | } | 1434 | } |
1446 | 1435 | ||
1447 | ret = request_irq(irq, wm8350_irq, flags, | 1436 | ret = request_threaded_irq(irq, NULL, wm8350_irq, flags, |
1448 | "wm8350", wm8350); | 1437 | "wm8350", wm8350); |
1449 | if (ret != 0) { | 1438 | if (ret != 0) { |
1450 | dev_err(wm8350->dev, "Failed to request IRQ: %d\n", | 1439 | dev_err(wm8350->dev, "Failed to request IRQ: %d\n", |
1451 | ret); | 1440 | ret); |
@@ -1505,7 +1494,6 @@ void wm8350_device_exit(struct wm8350 *wm8350) | |||
1505 | platform_device_unregister(wm8350->codec.pdev); | 1494 | platform_device_unregister(wm8350->codec.pdev); |
1506 | 1495 | ||
1507 | free_irq(wm8350->chip_irq, wm8350); | 1496 | free_irq(wm8350->chip_irq, wm8350); |
1508 | flush_work(&wm8350->irq_work); | ||
1509 | kfree(wm8350->reg_cache); | 1497 | kfree(wm8350->reg_cache); |
1510 | } | 1498 | } |
1511 | EXPORT_SYMBOL_GPL(wm8350_device_exit); | 1499 | EXPORT_SYMBOL_GPL(wm8350_device_exit); |