diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-11-04 11:10:51 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2009-12-13 13:21:39 -0500 |
commit | 5a65edbc12b6b34ef912114f1fc8215786f85b25 (patch) | |
tree | ffe43bd1234b52ad1c3774b096a51594aabe49ad /drivers | |
parent | b9f96b5dcb1e2a75d142e481b77805ffdc6ccea6 (diff) |
mfd: Convert wm8350 IRQ handlers to irq_handler_t
This is done as simple code transformation, the semantics of the
IRQ API provided by the core are are still very different to those
of genirq (mainly with regard to masking).
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/wm8350-irq.c | 6 | ||||
-rw-r--r-- | drivers/power/wm8350_power.c | 39 | ||||
-rw-r--r-- | drivers/regulator/wm8350-regulator.c | 7 | ||||
-rw-r--r-- | drivers/rtc/rtc-wm8350.c | 18 |
4 files changed, 45 insertions, 25 deletions
diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c index d9abfc94c685..2ea2b8b4c72a 100644 --- a/drivers/mfd/wm8350-irq.c +++ b/drivers/mfd/wm8350-irq.c | |||
@@ -371,7 +371,7 @@ static void wm8350_irq_call_handler(struct wm8350 *wm8350, int irq) | |||
371 | mutex_lock(&wm8350->irq_mutex); | 371 | mutex_lock(&wm8350->irq_mutex); |
372 | 372 | ||
373 | if (wm8350->irq[irq].handler) | 373 | if (wm8350->irq[irq].handler) |
374 | wm8350->irq[irq].handler(wm8350, irq, wm8350->irq[irq].data); | 374 | wm8350->irq[irq].handler(irq, wm8350->irq[irq].data); |
375 | else { | 375 | else { |
376 | dev_err(wm8350->dev, "irq %d nobody cared. now masked.\n", | 376 | dev_err(wm8350->dev, "irq %d nobody cared. now masked.\n", |
377 | irq); | 377 | irq); |
@@ -431,8 +431,8 @@ static irqreturn_t wm8350_irq(int irq, void *irq_data) | |||
431 | } | 431 | } |
432 | 432 | ||
433 | int wm8350_register_irq(struct wm8350 *wm8350, int irq, | 433 | int wm8350_register_irq(struct wm8350 *wm8350, int irq, |
434 | void (*handler) (struct wm8350 *, int, void *), | 434 | irq_handler_t handler, unsigned long flags, |
435 | void *data) | 435 | const char *name, void *data) |
436 | { | 436 | { |
437 | if (irq < 0 || irq > WM8350_NUM_IRQ || !handler) | 437 | if (irq < 0 || irq > WM8350_NUM_IRQ || !handler) |
438 | return -EINVAL; | 438 | return -EINVAL; |
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c index 28b0299c0043..6e634cf7fc14 100644 --- a/drivers/power/wm8350_power.c +++ b/drivers/power/wm8350_power.c | |||
@@ -184,8 +184,9 @@ static ssize_t charger_state_show(struct device *dev, | |||
184 | 184 | ||
185 | static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL); | 185 | static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL); |
186 | 186 | ||
187 | static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data) | 187 | static irqreturn_t wm8350_charger_handler(int irq, void *data) |
188 | { | 188 | { |
189 | struct wm8350 *wm8350 = data; | ||
189 | struct wm8350_power *power = &wm8350->power; | 190 | struct wm8350_power *power = &wm8350->power; |
190 | struct wm8350_charger_policy *policy = power->policy; | 191 | struct wm8350_charger_policy *policy = power->policy; |
191 | 192 | ||
@@ -238,6 +239,8 @@ static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data) | |||
238 | default: | 239 | default: |
239 | dev_err(wm8350->dev, "Unknown interrupt %d\n", irq); | 240 | dev_err(wm8350->dev, "Unknown interrupt %d\n", irq); |
240 | } | 241 | } |
242 | |||
243 | return IRQ_HANDLED; | ||
241 | } | 244 | } |
242 | 245 | ||
243 | /********************************************************************* | 246 | /********************************************************************* |
@@ -387,45 +390,53 @@ static void wm8350_init_charger(struct wm8350 *wm8350) | |||
387 | { | 390 | { |
388 | /* register our interest in charger events */ | 391 | /* register our interest in charger events */ |
389 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, | 392 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, |
390 | wm8350_charger_handler, NULL); | 393 | wm8350_charger_handler, 0, "Battery hot", wm8350); |
391 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); | 394 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); |
392 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, | 395 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, |
393 | wm8350_charger_handler, NULL); | 396 | wm8350_charger_handler, 0, "Battery cold", wm8350); |
394 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); | 397 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); |
395 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, | 398 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, |
396 | wm8350_charger_handler, NULL); | 399 | wm8350_charger_handler, 0, "Battery fail", wm8350); |
397 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); | 400 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); |
398 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, | 401 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, |
399 | wm8350_charger_handler, NULL); | 402 | wm8350_charger_handler, 0, |
403 | "Charger timeout", wm8350); | ||
400 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO); | 404 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO); |
401 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, | 405 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, |
402 | wm8350_charger_handler, NULL); | 406 | wm8350_charger_handler, 0, |
407 | "Charge end", wm8350); | ||
403 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END); | 408 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END); |
404 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, | 409 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, |
405 | wm8350_charger_handler, NULL); | 410 | wm8350_charger_handler, 0, |
411 | "Charge start", wm8350); | ||
406 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START); | 412 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START); |
407 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, | 413 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, |
408 | wm8350_charger_handler, NULL); | 414 | wm8350_charger_handler, 0, |
415 | "Fast charge ready", wm8350); | ||
409 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY); | 416 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY); |
410 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, | 417 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, |
411 | wm8350_charger_handler, NULL); | 418 | wm8350_charger_handler, 0, |
419 | "Battery <3.9V", wm8350); | ||
412 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); | 420 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); |
413 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, | 421 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, |
414 | wm8350_charger_handler, NULL); | 422 | wm8350_charger_handler, 0, |
423 | "Battery <3.1V", wm8350); | ||
415 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); | 424 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); |
416 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, | 425 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, |
417 | wm8350_charger_handler, NULL); | 426 | wm8350_charger_handler, 0, |
427 | "Battery <2.85V", wm8350); | ||
428 | |||
418 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); | 429 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); |
419 | 430 | ||
420 | /* and supply change events */ | 431 | /* and supply change events */ |
421 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, | 432 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, |
422 | wm8350_charger_handler, NULL); | 433 | wm8350_charger_handler, 0, "USB", wm8350); |
423 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); | 434 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); |
424 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, | 435 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, |
425 | wm8350_charger_handler, NULL); | 436 | wm8350_charger_handler, 0, "Wall", wm8350); |
426 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); | 437 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); |
427 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, | 438 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, |
428 | wm8350_charger_handler, NULL); | 439 | wm8350_charger_handler, 0, "Battery", wm8350); |
429 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); | 440 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); |
430 | } | 441 | } |
431 | 442 | ||
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index 768bd0e5b48b..8c289fd4add2 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -1330,9 +1330,10 @@ static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = { | |||
1330 | }, | 1330 | }, |
1331 | }; | 1331 | }; |
1332 | 1332 | ||
1333 | static void pmic_uv_handler(struct wm8350 *wm8350, int irq, void *data) | 1333 | static irqreturn_t pmic_uv_handler(int irq, void *data) |
1334 | { | 1334 | { |
1335 | struct regulator_dev *rdev = (struct regulator_dev *)data; | 1335 | struct regulator_dev *rdev = (struct regulator_dev *)data; |
1336 | struct wm8350 *wm8350 = rdev_get_drvdata(rdev); | ||
1336 | 1337 | ||
1337 | mutex_lock(&rdev->mutex); | 1338 | mutex_lock(&rdev->mutex); |
1338 | if (irq == WM8350_IRQ_CS1 || irq == WM8350_IRQ_CS2) | 1339 | if (irq == WM8350_IRQ_CS1 || irq == WM8350_IRQ_CS2) |
@@ -1344,6 +1345,8 @@ static void pmic_uv_handler(struct wm8350 *wm8350, int irq, void *data) | |||
1344 | REGULATOR_EVENT_UNDER_VOLTAGE, | 1345 | REGULATOR_EVENT_UNDER_VOLTAGE, |
1345 | wm8350); | 1346 | wm8350); |
1346 | mutex_unlock(&rdev->mutex); | 1347 | mutex_unlock(&rdev->mutex); |
1348 | |||
1349 | return IRQ_HANDLED; | ||
1347 | } | 1350 | } |
1348 | 1351 | ||
1349 | static int wm8350_regulator_probe(struct platform_device *pdev) | 1352 | static int wm8350_regulator_probe(struct platform_device *pdev) |
@@ -1388,7 +1391,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev) | |||
1388 | 1391 | ||
1389 | /* register regulator IRQ */ | 1392 | /* register regulator IRQ */ |
1390 | ret = wm8350_register_irq(wm8350, wm8350_reg[pdev->id].irq, | 1393 | ret = wm8350_register_irq(wm8350, wm8350_reg[pdev->id].irq, |
1391 | pmic_uv_handler, rdev); | 1394 | pmic_uv_handler, 0, "UV", rdev); |
1392 | if (ret < 0) { | 1395 | if (ret < 0) { |
1393 | regulator_unregister(rdev); | 1396 | regulator_unregister(rdev); |
1394 | dev_err(&pdev->dev, "failed to register regulator %s IRQ\n", | 1397 | dev_err(&pdev->dev, "failed to register regulator %s IRQ\n", |
diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c index c91edc572eb6..56e56e552813 100644 --- a/drivers/rtc/rtc-wm8350.c +++ b/drivers/rtc/rtc-wm8350.c | |||
@@ -315,9 +315,9 @@ static int wm8350_rtc_update_irq_enable(struct device *dev, | |||
315 | return 0; | 315 | return 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | static void wm8350_rtc_alarm_handler(struct wm8350 *wm8350, int irq, | 318 | static irqreturn_t wm8350_rtc_alarm_handler(int irq, void *data) |
319 | void *data) | ||
320 | { | 319 | { |
320 | struct wm8350 *wm8350 = data; | ||
321 | struct rtc_device *rtc = wm8350->rtc.rtc; | 321 | struct rtc_device *rtc = wm8350->rtc.rtc; |
322 | int ret; | 322 | int ret; |
323 | 323 | ||
@@ -330,14 +330,18 @@ static void wm8350_rtc_alarm_handler(struct wm8350 *wm8350, int irq, | |||
330 | dev_err(&(wm8350->rtc.pdev->dev), | 330 | dev_err(&(wm8350->rtc.pdev->dev), |
331 | "Failed to disable alarm: %d\n", ret); | 331 | "Failed to disable alarm: %d\n", ret); |
332 | } | 332 | } |
333 | |||
334 | return IRQ_HANDLED; | ||
333 | } | 335 | } |
334 | 336 | ||
335 | static void wm8350_rtc_update_handler(struct wm8350 *wm8350, int irq, | 337 | static irqreturn_t wm8350_rtc_update_handler(int irq, void *data) |
336 | void *data) | ||
337 | { | 338 | { |
339 | struct wm8350 *wm8350 = data; | ||
338 | struct rtc_device *rtc = wm8350->rtc.rtc; | 340 | struct rtc_device *rtc = wm8350->rtc.rtc; |
339 | 341 | ||
340 | rtc_update_irq(rtc, 1, RTC_IRQF | RTC_UF); | 342 | rtc_update_irq(rtc, 1, RTC_IRQF | RTC_UF); |
343 | |||
344 | return IRQ_HANDLED; | ||
341 | } | 345 | } |
342 | 346 | ||
343 | static const struct rtc_class_ops wm8350_rtc_ops = { | 347 | static const struct rtc_class_ops wm8350_rtc_ops = { |
@@ -459,10 +463,12 @@ static int wm8350_rtc_probe(struct platform_device *pdev) | |||
459 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_PER); | 463 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_PER); |
460 | 464 | ||
461 | wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, | 465 | wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, |
462 | wm8350_rtc_update_handler, NULL); | 466 | wm8350_rtc_update_handler, 0, |
467 | "RTC Seconds", wm8350); | ||
463 | 468 | ||
464 | wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, | 469 | wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, |
465 | wm8350_rtc_alarm_handler, NULL); | 470 | wm8350_rtc_alarm_handler, 0, |
471 | "RTC Alarm", wm8350); | ||
466 | wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_ALM); | 472 | wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_ALM); |
467 | 473 | ||
468 | return 0; | 474 | return 0; |