diff options
author | Benoit Cousson <b-cousson@ti.com> | 2012-03-02 05:11:26 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-03-22 08:05:34 -0400 |
commit | ec1a07b3440cc28946a77a974c21570bbef6ffa1 (patch) | |
tree | fc238f2f59f991678c67e15ad4d87ff0ed389d88 /drivers/mfd/twl6030-irq.c | |
parent | 5a903090e7aa561901b7f052eb744b480d6126d4 (diff) |
mfd: Replace twl-* pr_ macros by the dev_ equivalent and do various cleanups
Since a structure device is available now, use the dev_ macros instead
of the pr_ ones.
Clean some badly formatted comments.
Remove some unused variables.
Move some variable to the place they belong.
Clean some badly wrapped lines.
Align variable definition
Add missing braces in if-then-else block.
Add blank line for better readability.
Move stuff here and there...
Conflicts:
drivers/mfd/twl-core.c
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/twl6030-irq.c')
-rw-r--r-- | drivers/mfd/twl6030-irq.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 86c4082fa411..b76902f1e44a 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c | |||
@@ -53,7 +53,6 @@ | |||
53 | * | 53 | * |
54 | * We set up IRQs starting at a platform-specified base. An interrupt map table, | 54 | * We set up IRQs starting at a platform-specified base. An interrupt map table, |
55 | * specifies mapping between interrupt number and the associated module. | 55 | * specifies mapping between interrupt number and the associated module. |
56 | * | ||
57 | */ | 56 | */ |
58 | #define TWL6030_NR_IRQS 20 | 57 | #define TWL6030_NR_IRQS 20 |
59 | 58 | ||
@@ -352,14 +351,11 @@ int twl6030_init_irq(struct device *dev, int irq_num) | |||
352 | { | 351 | { |
353 | struct device_node *node = dev->of_node; | 352 | struct device_node *node = dev->of_node; |
354 | int nr_irqs, irq_base, irq_end; | 353 | int nr_irqs, irq_base, irq_end; |
355 | |||
356 | int status = 0; | ||
357 | int i; | ||
358 | struct task_struct *task; | 354 | struct task_struct *task; |
359 | int ret; | 355 | static struct irq_chip twl6030_irq_chip; |
360 | u8 mask[4]; | 356 | int status = 0; |
361 | 357 | int i; | |
362 | static struct irq_chip twl6030_irq_chip; | 358 | u8 mask[4]; |
363 | 359 | ||
364 | nr_irqs = TWL6030_NR_IRQS; | 360 | nr_irqs = TWL6030_NR_IRQS; |
365 | 361 | ||
@@ -377,16 +373,18 @@ int twl6030_init_irq(struct device *dev, int irq_num) | |||
377 | mask[1] = 0xFF; | 373 | mask[1] = 0xFF; |
378 | mask[2] = 0xFF; | 374 | mask[2] = 0xFF; |
379 | mask[3] = 0xFF; | 375 | mask[3] = 0xFF; |
380 | ret = twl_i2c_write(TWL_MODULE_PIH, &mask[0], | 376 | |
381 | REG_INT_MSK_LINE_A, 3); /* MASK ALL INT LINES */ | 377 | /* mask all int lines */ |
382 | ret = twl_i2c_write(TWL_MODULE_PIH, &mask[0], | 378 | twl_i2c_write(TWL_MODULE_PIH, &mask[0], REG_INT_MSK_LINE_A, 3); |
383 | REG_INT_MSK_STS_A, 3); /* MASK ALL INT STS */ | 379 | /* mask all int sts */ |
384 | ret = twl_i2c_write(TWL_MODULE_PIH, &mask[0], | 380 | twl_i2c_write(TWL_MODULE_PIH, &mask[0], REG_INT_MSK_STS_A, 3); |
385 | REG_INT_STS_A, 3); /* clear INT_STS_A,B,C */ | 381 | /* clear INT_STS_A,B,C */ |
382 | twl_i2c_write(TWL_MODULE_PIH, &mask[0], REG_INT_STS_A, 3); | ||
386 | 383 | ||
387 | twl6030_irq_base = irq_base; | 384 | twl6030_irq_base = irq_base; |
388 | 385 | ||
389 | /* install an irq handler for each of the modules; | 386 | /* |
387 | * install an irq handler for each of the modules; | ||
390 | * clone dummy irq_chip since PIH can't *do* anything | 388 | * clone dummy irq_chip since PIH can't *do* anything |
391 | */ | 389 | */ |
392 | twl6030_irq_chip = dummy_irq_chip; | 390 | twl6030_irq_chip = dummy_irq_chip; |
@@ -401,22 +399,22 @@ int twl6030_init_irq(struct device *dev, int irq_num) | |||
401 | activate_irq(i); | 399 | activate_irq(i); |
402 | } | 400 | } |
403 | 401 | ||
404 | pr_info("twl6030: %s (irq %d) chaining IRQs %d..%d\n", "PIH", | 402 | dev_info(dev, "PIH (irq %d) chaining IRQs %d..%d\n", |
405 | irq_num, irq_base, irq_end); | 403 | irq_num, irq_base, irq_end); |
406 | 404 | ||
407 | /* install an irq handler to demultiplex the TWL6030 interrupt */ | 405 | /* install an irq handler to demultiplex the TWL6030 interrupt */ |
408 | init_completion(&irq_event); | 406 | init_completion(&irq_event); |
409 | 407 | ||
410 | status = request_irq(irq_num, handle_twl6030_pih, 0, | 408 | status = request_irq(irq_num, handle_twl6030_pih, 0, "TWL6030-PIH", |
411 | "TWL6030-PIH", &irq_event); | 409 | &irq_event); |
412 | if (status < 0) { | 410 | if (status < 0) { |
413 | pr_err("twl6030: could not claim irq%d: %d\n", irq_num, status); | 411 | dev_err(dev, "could not claim irq %d: %d\n", irq_num, status); |
414 | goto fail_irq; | 412 | goto fail_irq; |
415 | } | 413 | } |
416 | 414 | ||
417 | task = kthread_run(twl6030_irq_thread, (void *)irq_num, "twl6030-irq"); | 415 | task = kthread_run(twl6030_irq_thread, (void *)irq_num, "twl6030-irq"); |
418 | if (IS_ERR(task)) { | 416 | if (IS_ERR(task)) { |
419 | pr_err("twl6030: could not create irq %d thread!\n", irq_num); | 417 | dev_err(dev, "could not create irq %d thread!\n", irq_num); |
420 | status = PTR_ERR(task); | 418 | status = PTR_ERR(task); |
421 | goto fail_kthread; | 419 | goto fail_kthread; |
422 | } | 420 | } |
@@ -431,6 +429,7 @@ fail_kthread: | |||
431 | fail_irq: | 429 | fail_irq: |
432 | for (i = irq_base; i < irq_end; i++) | 430 | for (i = irq_base; i < irq_end; i++) |
433 | irq_set_chip_and_handler(i, NULL, NULL); | 431 | irq_set_chip_and_handler(i, NULL, NULL); |
432 | |||
434 | return status; | 433 | return status; |
435 | } | 434 | } |
436 | 435 | ||