diff options
author | Ramakrishna Pallala <ramakrishna.pallala@intel.com> | 2012-05-04 17:38:37 -0400 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-05-05 02:42:56 -0400 |
commit | 243e3527ffbda96434429e618324f80ca0d98902 (patch) | |
tree | 2605526fe5555735bbf9e3009b671064a4b38fdc /drivers | |
parent | 0d4ed4e27a4cb180af395fa3d7aa98d79f3d3015 (diff) |
max17042_battery: Fix power supply and irq registration ordering
IRQ registration should happen only after power supply object usable.
This patch fixes the ordering of power supply and irq registration
calls.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/max17042_battery.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c index 42c4be9a664b..b4c8af016278 100644 --- a/drivers/power/max17042_battery.c +++ b/drivers/power/max17042_battery.c | |||
@@ -690,6 +690,12 @@ static int __devinit max17042_probe(struct i2c_client *client, | |||
690 | max17042_write_reg(client, MAX17042_LearnCFG, 0x0007); | 690 | max17042_write_reg(client, MAX17042_LearnCFG, 0x0007); |
691 | } | 691 | } |
692 | 692 | ||
693 | ret = power_supply_register(&client->dev, &chip->battery); | ||
694 | if (ret) { | ||
695 | dev_err(&client->dev, "failed: power supply register\n"); | ||
696 | return ret; | ||
697 | } | ||
698 | |||
693 | if (client->irq) { | 699 | if (client->irq) { |
694 | ret = request_threaded_irq(client->irq, NULL, | 700 | ret = request_threaded_irq(client->irq, NULL, |
695 | max17042_thread_handler, | 701 | max17042_thread_handler, |
@@ -706,7 +712,6 @@ static int __devinit max17042_probe(struct i2c_client *client, | |||
706 | } | 712 | } |
707 | 713 | ||
708 | reg = max17042_read_reg(chip->client, MAX17042_STATUS); | 714 | reg = max17042_read_reg(chip->client, MAX17042_STATUS); |
709 | |||
710 | if (reg & STATUS_POR_BIT) { | 715 | if (reg & STATUS_POR_BIT) { |
711 | INIT_WORK(&chip->work, max17042_init_worker); | 716 | INIT_WORK(&chip->work, max17042_init_worker); |
712 | schedule_work(&chip->work); | 717 | schedule_work(&chip->work); |
@@ -714,10 +719,7 @@ static int __devinit max17042_probe(struct i2c_client *client, | |||
714 | chip->init_complete = 1; | 719 | chip->init_complete = 1; |
715 | } | 720 | } |
716 | 721 | ||
717 | ret = power_supply_register(&client->dev, &chip->battery); | 722 | return 0; |
718 | if (ret) | ||
719 | dev_err(&client->dev, "failed: power supply register\n"); | ||
720 | return ret; | ||
721 | } | 723 | } |
722 | 724 | ||
723 | static int __devexit max17042_remove(struct i2c_client *client) | 725 | static int __devexit max17042_remove(struct i2c_client *client) |