aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorAnda-Maria Nicolae <anda-maria.nicolae@intel.com>2015-05-12 05:11:32 -0400
committerSebastian Reichel <sre@kernel.org>2015-05-23 14:02:59 -0400
commitf6d8b7744f692def009b9b354a39daf503bc9e00 (patch)
treec52650d9692e220c0405803fdaa8d4e0973e69da /drivers/power
parent323667209223368b50e16994e0fa8cf833940ce6 (diff)
power_supply: bq2415x_charger: Fix coding style issues
This patch fixes the following issues reported by checkpatch.pl: - use -EINVAL instead of -ENOSYS, to fix warning message: "ENOSYS means 'invalid syscall nr' and nothing else" - remove unnecessary log message - split lines whose length is greater than 80 characters - if an arm statement uses braces, add braces to the other arms of the respective statement, too - match alignment with open parenthesis Signed-off-by: Anda-Maria Nicolae <anda-maria.nicolae@intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/bq2415x_charger.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index 6c534dcbc19c..2cf8ec747fc2 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -631,7 +631,7 @@ static int bq2415x_set_charge_current(struct bq2415x_device *bq, int mA)
631 int val; 631 int val;
632 632
633 if (bq->init_data.resistor_sense <= 0) 633 if (bq->init_data.resistor_sense <= 0)
634 return -ENOSYS; 634 return -EINVAL;
635 635
636 val = (mA * bq->init_data.resistor_sense - 37400) / 6800; 636 val = (mA * bq->init_data.resistor_sense - 37400) / 6800;
637 if (val < 0) 637 if (val < 0)
@@ -650,7 +650,7 @@ static int bq2415x_get_charge_current(struct bq2415x_device *bq)
650 int ret; 650 int ret;
651 651
652 if (bq->init_data.resistor_sense <= 0) 652 if (bq->init_data.resistor_sense <= 0)
653 return -ENOSYS; 653 return -EINVAL;
654 654
655 ret = bq2415x_i2c_read_mask(bq, BQ2415X_REG_CURRENT, 655 ret = bq2415x_i2c_read_mask(bq, BQ2415X_REG_CURRENT,
656 BQ2415X_MASK_VI_CHRG, BQ2415X_SHIFT_VI_CHRG); 656 BQ2415X_MASK_VI_CHRG, BQ2415X_SHIFT_VI_CHRG);
@@ -665,7 +665,7 @@ static int bq2415x_set_termination_current(struct bq2415x_device *bq, int mA)
665 int val; 665 int val;
666 666
667 if (bq->init_data.resistor_sense <= 0) 667 if (bq->init_data.resistor_sense <= 0)
668 return -ENOSYS; 668 return -EINVAL;
669 669
670 val = (mA * bq->init_data.resistor_sense - 3400) / 3400; 670 val = (mA * bq->init_data.resistor_sense - 3400) / 3400;
671 if (val < 0) 671 if (val < 0)
@@ -684,7 +684,7 @@ static int bq2415x_get_termination_current(struct bq2415x_device *bq)
684 int ret; 684 int ret;
685 685
686 if (bq->init_data.resistor_sense <= 0) 686 if (bq->init_data.resistor_sense <= 0)
687 return -ENOSYS; 687 return -EINVAL;
688 688
689 ret = bq2415x_i2c_read_mask(bq, BQ2415X_REG_CURRENT, 689 ret = bq2415x_i2c_read_mask(bq, BQ2415X_REG_CURRENT,
690 BQ2415X_MASK_VI_TERM, BQ2415X_SHIFT_VI_TERM); 690 BQ2415X_MASK_VI_TERM, BQ2415X_SHIFT_VI_TERM);
@@ -1166,7 +1166,7 @@ static ssize_t bq2415x_sysfs_set_mode(struct device *dev,
1166 1166
1167 if (strncmp(buf, "auto", 4) == 0) { 1167 if (strncmp(buf, "auto", 4) == 0) {
1168 if (bq->automode < 0) 1168 if (bq->automode < 0)
1169 return -ENOSYS; 1169 return -EINVAL;
1170 bq->automode = 1; 1170 bq->automode = 1;
1171 mode = bq->reported_mode; 1171 mode = bq->reported_mode;
1172 } else if (strncmp(buf, "off", 3) == 0) { 1172 } else if (strncmp(buf, "off", 3) == 0) {
@@ -1556,28 +1556,28 @@ static int bq2415x_probe(struct i2c_client *client,
1556 1556
1557 bq = devm_kzalloc(&client->dev, sizeof(*bq), GFP_KERNEL); 1557 bq = devm_kzalloc(&client->dev, sizeof(*bq), GFP_KERNEL);
1558 if (!bq) { 1558 if (!bq) {
1559 dev_err(&client->dev, "failed to allocate device data\n");
1560 ret = -ENOMEM; 1559 ret = -ENOMEM;
1561 goto error_2; 1560 goto error_2;
1562 } 1561 }
1563 1562
1564 if (np) { 1563 if (np) {
1565 bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); 1564 bq->notify_psy = power_supply_get_by_phandle(np,
1565 "ti,usb-charger-detection");
1566 1566
1567 if (IS_ERR(bq->notify_psy)) { 1567 if (IS_ERR(bq->notify_psy)) {
1568 dev_info(&client->dev, 1568 dev_info(&client->dev,
1569 "no 'ti,usb-charger-detection' property (err=%ld)\n", 1569 "no 'ti,usb-charger-detection' property (err=%ld)\n",
1570 PTR_ERR(bq->notify_psy)); 1570 PTR_ERR(bq->notify_psy));
1571 bq->notify_psy = NULL; 1571 bq->notify_psy = NULL;
1572 } else if (!bq->notify_psy) { 1572 } else if (!bq->notify_psy) {
1573 ret = -EPROBE_DEFER; 1573 ret = -EPROBE_DEFER;
1574 goto error_2; 1574 goto error_2;
1575 } 1575 }
1576 } 1576 } else if (pdata->notify_device) {
1577 else if (pdata->notify_device)
1578 bq->notify_psy = power_supply_get_by_name(pdata->notify_device); 1577 bq->notify_psy = power_supply_get_by_name(pdata->notify_device);
1579 else 1578 } else {
1580 bq->notify_psy = NULL; 1579 bq->notify_psy = NULL;
1580 }
1581 1581
1582 i2c_set_clientdata(client, bq); 1582 i2c_set_clientdata(client, bq);
1583 1583
@@ -1592,11 +1592,11 @@ static int bq2415x_probe(struct i2c_client *client,
1592 1592
1593 if (np) { 1593 if (np) {
1594 ret = of_property_read_u32(np, "ti,current-limit", 1594 ret = of_property_read_u32(np, "ti,current-limit",
1595 &bq->init_data.current_limit); 1595 &bq->init_data.current_limit);
1596 if (ret) 1596 if (ret)
1597 goto error_3; 1597 goto error_3;
1598 ret = of_property_read_u32(np, "ti,weak-battery-voltage", 1598 ret = of_property_read_u32(np, "ti,weak-battery-voltage",
1599 &bq->init_data.weak_battery_voltage); 1599 &bq->init_data.weak_battery_voltage);
1600 if (ret) 1600 if (ret)
1601 goto error_3; 1601 goto error_3;
1602 ret = of_property_read_u32(np, "ti,battery-regulation-voltage", 1602 ret = of_property_read_u32(np, "ti,battery-regulation-voltage",
@@ -1604,15 +1604,15 @@ static int bq2415x_probe(struct i2c_client *client,
1604 if (ret) 1604 if (ret)
1605 goto error_3; 1605 goto error_3;
1606 ret = of_property_read_u32(np, "ti,charge-current", 1606 ret = of_property_read_u32(np, "ti,charge-current",
1607 &bq->init_data.charge_current); 1607 &bq->init_data.charge_current);
1608 if (ret) 1608 if (ret)
1609 goto error_3; 1609 goto error_3;
1610 ret = of_property_read_u32(np, "ti,termination-current", 1610 ret = of_property_read_u32(np, "ti,termination-current",
1611 &bq->init_data.termination_current); 1611 &bq->init_data.termination_current);
1612 if (ret) 1612 if (ret)
1613 goto error_3; 1613 goto error_3;
1614 ret = of_property_read_u32(np, "ti,resistor-sense", 1614 ret = of_property_read_u32(np, "ti,resistor-sense",
1615 &bq->init_data.resistor_sense); 1615 &bq->init_data.resistor_sense);
1616 if (ret) 1616 if (ret)
1617 goto error_3; 1617 goto error_3;
1618 } else { 1618 } else {
@@ -1648,7 +1648,8 @@ static int bq2415x_probe(struct i2c_client *client,
1648 } 1648 }
1649 1649
1650 /* Query for initial reported_mode and set it */ 1650 /* Query for initial reported_mode and set it */
1651 bq2415x_notifier_call(&bq->nb, PSY_EVENT_PROP_CHANGED, bq->notify_psy); 1651 bq2415x_notifier_call(&bq->nb, PSY_EVENT_PROP_CHANGED,
1652 bq->notify_psy);
1652 bq2415x_set_mode(bq, bq->reported_mode); 1653 bq2415x_set_mode(bq, bq->reported_mode);
1653 1654
1654 bq->automode = 1; 1655 bq->automode = 1;