diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 16:57:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 16:57:13 -0500 |
commit | 7ed214ac2095f561a94335ca672b6c42a1ea40ff (patch) | |
tree | da41901bff1d0d8d61170bf362384fdc61deb3ab /drivers/w1/masters/ds1wm.c | |
parent | 21eaab6d19ed43e82ed39c8deb7f192134fb4a0e (diff) | |
parent | 29e5507ae4ab34397f538f06b7070c81a4e4a2bf (diff) |
Merge tag 'char-misc-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver patches from Greg Kroah-Hartman:
"Here's the big char/misc driver patches for 3.9-rc1.
Nothing major here, just lots of different driver updates (mei,
hyperv, ipack, extcon, vmci, etc.).
All of these have been in the linux-next tree for a while."
* tag 'char-misc-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (209 commits)
w1: w1_therm: Add force-pullup option for "broken" sensors
w1: ds2482: Added 1-Wire pull-up support to the driver
vme: add missing put_device() after device_register() fails
extcon: max8997: Use workqueue to check cable state after completing boot of platform
extcon: max8997: Set default UART/USB path on probe
extcon: max8997: Consolidate duplicate code for checking ADC/CHG cable type
extcon: max8997: Set default of ADC debounce time during initialization
extcon: max8997: Remove duplicate code related to set H/W line path
extcon: max8997: Move defined constant to header file
extcon: max77693: Make max77693_extcon_cable static
extcon: max8997: Remove unreachable code
extcon: max8997: Make max8997_extcon_cable static
extcon: max77693: Remove unnecessary goto statement to improve readability
extcon: max77693: Convert to devm_input_allocate_device()
extcon: gpio: Rename filename of extcon-gpio.c according to kernel naming style
CREDITS: update email and address of Harald Hoyer
extcon: arizona: Use MICDET for final microphone identification
extcon: arizona: Always take the first HPDET reading as the final one
extcon: arizona: Clear _trig_sts bits after jack detection
extcon: arizona: Don't HPDET magic when headphones are enabled
...
Diffstat (limited to 'drivers/w1/masters/ds1wm.c')
-rw-r--r-- | drivers/w1/masters/ds1wm.c | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c index 7c294f4dc0ed..96cab6ac2b4e 100644 --- a/drivers/w1/masters/ds1wm.c +++ b/drivers/w1/masters/ds1wm.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | #include <linux/io.h> | ||
16 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
17 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
@@ -459,43 +460,34 @@ static int ds1wm_probe(struct platform_device *pdev) | |||
459 | if (!pdev) | 460 | if (!pdev) |
460 | return -ENODEV; | 461 | return -ENODEV; |
461 | 462 | ||
462 | ds1wm_data = kzalloc(sizeof(*ds1wm_data), GFP_KERNEL); | 463 | ds1wm_data = devm_kzalloc(&pdev->dev, sizeof(*ds1wm_data), GFP_KERNEL); |
463 | if (!ds1wm_data) | 464 | if (!ds1wm_data) |
464 | return -ENOMEM; | 465 | return -ENOMEM; |
465 | 466 | ||
466 | platform_set_drvdata(pdev, ds1wm_data); | 467 | platform_set_drvdata(pdev, ds1wm_data); |
467 | 468 | ||
468 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 469 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
469 | if (!res) { | 470 | if (!res) |
470 | ret = -ENXIO; | 471 | return -ENXIO; |
471 | goto err0; | 472 | ds1wm_data->map = devm_ioremap(&pdev->dev, res->start, |
472 | } | 473 | resource_size(res)); |
473 | ds1wm_data->map = ioremap(res->start, resource_size(res)); | 474 | if (!ds1wm_data->map) |
474 | if (!ds1wm_data->map) { | 475 | return -ENOMEM; |
475 | ret = -ENOMEM; | ||
476 | goto err0; | ||
477 | } | ||
478 | 476 | ||
479 | /* calculate bus shift from mem resource */ | 477 | /* calculate bus shift from mem resource */ |
480 | ds1wm_data->bus_shift = resource_size(res) >> 3; | 478 | ds1wm_data->bus_shift = resource_size(res) >> 3; |
481 | 479 | ||
482 | ds1wm_data->pdev = pdev; | 480 | ds1wm_data->pdev = pdev; |
483 | ds1wm_data->cell = mfd_get_cell(pdev); | 481 | ds1wm_data->cell = mfd_get_cell(pdev); |
484 | if (!ds1wm_data->cell) { | 482 | if (!ds1wm_data->cell) |
485 | ret = -ENODEV; | 483 | return -ENODEV; |
486 | goto err1; | ||
487 | } | ||
488 | plat = pdev->dev.platform_data; | 484 | plat = pdev->dev.platform_data; |
489 | if (!plat) { | 485 | if (!plat) |
490 | ret = -ENODEV; | 486 | return -ENODEV; |
491 | goto err1; | ||
492 | } | ||
493 | 487 | ||
494 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 488 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
495 | if (!res) { | 489 | if (!res) |
496 | ret = -ENXIO; | 490 | return -ENXIO; |
497 | goto err1; | ||
498 | } | ||
499 | ds1wm_data->irq = res->start; | 491 | ds1wm_data->irq = res->start; |
500 | ds1wm_data->int_en_reg_none = (plat->active_high ? DS1WM_INTEN_IAS : 0); | 492 | ds1wm_data->int_en_reg_none = (plat->active_high ? DS1WM_INTEN_IAS : 0); |
501 | ds1wm_data->reset_recover_delay = plat->reset_recover_delay; | 493 | ds1wm_data->reset_recover_delay = plat->reset_recover_delay; |
@@ -505,10 +497,10 @@ static int ds1wm_probe(struct platform_device *pdev) | |||
505 | if (res->flags & IORESOURCE_IRQ_LOWEDGE) | 497 | if (res->flags & IORESOURCE_IRQ_LOWEDGE) |
506 | irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_FALLING); | 498 | irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_FALLING); |
507 | 499 | ||
508 | ret = request_irq(ds1wm_data->irq, ds1wm_isr, | 500 | ret = devm_request_irq(&pdev->dev, ds1wm_data->irq, ds1wm_isr, |
509 | IRQF_DISABLED | IRQF_SHARED, "ds1wm", ds1wm_data); | 501 | IRQF_DISABLED | IRQF_SHARED, "ds1wm", ds1wm_data); |
510 | if (ret) | 502 | if (ret) |
511 | goto err1; | 503 | return ret; |
512 | 504 | ||
513 | ds1wm_up(ds1wm_data); | 505 | ds1wm_up(ds1wm_data); |
514 | 506 | ||
@@ -516,17 +508,12 @@ static int ds1wm_probe(struct platform_device *pdev) | |||
516 | 508 | ||
517 | ret = w1_add_master_device(&ds1wm_master); | 509 | ret = w1_add_master_device(&ds1wm_master); |
518 | if (ret) | 510 | if (ret) |
519 | goto err2; | 511 | goto err; |
520 | 512 | ||
521 | return 0; | 513 | return 0; |
522 | 514 | ||
523 | err2: | 515 | err: |
524 | ds1wm_down(ds1wm_data); | 516 | ds1wm_down(ds1wm_data); |
525 | free_irq(ds1wm_data->irq, ds1wm_data); | ||
526 | err1: | ||
527 | iounmap(ds1wm_data->map); | ||
528 | err0: | ||
529 | kfree(ds1wm_data); | ||
530 | 517 | ||
531 | return ret; | 518 | return ret; |
532 | } | 519 | } |
@@ -560,9 +547,6 @@ static int ds1wm_remove(struct platform_device *pdev) | |||
560 | 547 | ||
561 | w1_remove_master_device(&ds1wm_master); | 548 | w1_remove_master_device(&ds1wm_master); |
562 | ds1wm_down(ds1wm_data); | 549 | ds1wm_down(ds1wm_data); |
563 | free_irq(ds1wm_data->irq, ds1wm_data); | ||
564 | iounmap(ds1wm_data->map); | ||
565 | kfree(ds1wm_data); | ||
566 | 550 | ||
567 | return 0; | 551 | return 0; |
568 | } | 552 | } |