diff options
Diffstat (limited to 'drivers/power/lp8788-charger.c')
-rw-r--r-- | drivers/power/lp8788-charger.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c index 27889088e78e..6d1f452810b8 100644 --- a/drivers/power/lp8788-charger.c +++ b/drivers/power/lp8788-charger.c | |||
@@ -367,7 +367,8 @@ static inline bool lp8788_is_valid_charger_register(u8 addr) | |||
367 | return addr >= LP8788_CHG_START && addr <= LP8788_CHG_END; | 367 | return addr >= LP8788_CHG_START && addr <= LP8788_CHG_END; |
368 | } | 368 | } |
369 | 369 | ||
370 | static int lp8788_update_charger_params(struct lp8788_charger *pchg) | 370 | static int lp8788_update_charger_params(struct platform_device *pdev, |
371 | struct lp8788_charger *pchg) | ||
371 | { | 372 | { |
372 | struct lp8788 *lp = pchg->lp; | 373 | struct lp8788 *lp = pchg->lp; |
373 | struct lp8788_charger_platform_data *pdata = pchg->pdata; | 374 | struct lp8788_charger_platform_data *pdata = pchg->pdata; |
@@ -376,7 +377,7 @@ static int lp8788_update_charger_params(struct lp8788_charger *pchg) | |||
376 | int ret; | 377 | int ret; |
377 | 378 | ||
378 | if (!pdata || !pdata->chg_params) { | 379 | if (!pdata || !pdata->chg_params) { |
379 | dev_info(lp->dev, "skip updating charger parameters\n"); | 380 | dev_info(&pdev->dev, "skip updating charger parameters\n"); |
380 | return 0; | 381 | return 0; |
381 | } | 382 | } |
382 | 383 | ||
@@ -537,7 +538,6 @@ err_free_irq: | |||
537 | static int lp8788_irq_register(struct platform_device *pdev, | 538 | static int lp8788_irq_register(struct platform_device *pdev, |
538 | struct lp8788_charger *pchg) | 539 | struct lp8788_charger *pchg) |
539 | { | 540 | { |
540 | struct lp8788 *lp = pchg->lp; | ||
541 | const char *name[] = { | 541 | const char *name[] = { |
542 | LP8788_CHG_IRQ, LP8788_PRSW_IRQ, LP8788_BATT_IRQ | 542 | LP8788_CHG_IRQ, LP8788_PRSW_IRQ, LP8788_BATT_IRQ |
543 | }; | 543 | }; |
@@ -550,13 +550,13 @@ static int lp8788_irq_register(struct platform_device *pdev, | |||
550 | for (i = 0; i < ARRAY_SIZE(name); i++) { | 550 | for (i = 0; i < ARRAY_SIZE(name); i++) { |
551 | ret = lp8788_set_irqs(pdev, pchg, name[i]); | 551 | ret = lp8788_set_irqs(pdev, pchg, name[i]); |
552 | if (ret) { | 552 | if (ret) { |
553 | dev_warn(lp->dev, "irq setup failed: %s\n", name[i]); | 553 | dev_warn(&pdev->dev, "irq setup failed: %s\n", name[i]); |
554 | return ret; | 554 | return ret; |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | if (pchg->num_irqs > LP8788_MAX_CHG_IRQS) { | 558 | if (pchg->num_irqs > LP8788_MAX_CHG_IRQS) { |
559 | dev_err(lp->dev, "invalid total number of irqs: %d\n", | 559 | dev_err(&pdev->dev, "invalid total number of irqs: %d\n", |
560 | pchg->num_irqs); | 560 | pchg->num_irqs); |
561 | return -EINVAL; | 561 | return -EINVAL; |
562 | } | 562 | } |
@@ -690,9 +690,10 @@ static int lp8788_charger_probe(struct platform_device *pdev) | |||
690 | { | 690 | { |
691 | struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); | 691 | struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); |
692 | struct lp8788_charger *pchg; | 692 | struct lp8788_charger *pchg; |
693 | struct device *dev = &pdev->dev; | ||
693 | int ret; | 694 | int ret; |
694 | 695 | ||
695 | pchg = devm_kzalloc(lp->dev, sizeof(struct lp8788_charger), GFP_KERNEL); | 696 | pchg = devm_kzalloc(dev, sizeof(struct lp8788_charger), GFP_KERNEL); |
696 | if (!pchg) | 697 | if (!pchg) |
697 | return -ENOMEM; | 698 | return -ENOMEM; |
698 | 699 | ||
@@ -700,7 +701,7 @@ static int lp8788_charger_probe(struct platform_device *pdev) | |||
700 | pchg->pdata = lp->pdata ? lp->pdata->chg_pdata : NULL; | 701 | pchg->pdata = lp->pdata ? lp->pdata->chg_pdata : NULL; |
701 | platform_set_drvdata(pdev, pchg); | 702 | platform_set_drvdata(pdev, pchg); |
702 | 703 | ||
703 | ret = lp8788_update_charger_params(pchg); | 704 | ret = lp8788_update_charger_params(pdev, pchg); |
704 | if (ret) | 705 | if (ret) |
705 | return ret; | 706 | return ret; |
706 | 707 | ||
@@ -718,7 +719,7 @@ static int lp8788_charger_probe(struct platform_device *pdev) | |||
718 | 719 | ||
719 | ret = lp8788_irq_register(pdev, pchg); | 720 | ret = lp8788_irq_register(pdev, pchg); |
720 | if (ret) | 721 | if (ret) |
721 | dev_warn(lp->dev, "failed to register charger irq: %d\n", ret); | 722 | dev_warn(dev, "failed to register charger irq: %d\n", ret); |
722 | 723 | ||
723 | return 0; | 724 | return 0; |
724 | } | 725 | } |