Skip to content

Commit f6d8b77

Browse files
andanicolaesre
authored andcommitted
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 <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 3236672 commit f6d8b77

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

drivers/power/bq2415x_charger.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ static int bq2415x_set_charge_current(struct bq2415x_device *bq, int mA)
631631
int val;
632632

633633
if (bq->init_data.resistor_sense <= 0)
634-
return -ENOSYS;
634+
return -EINVAL;
635635

636636
val = (mA * bq->init_data.resistor_sense - 37400) / 6800;
637637
if (val < 0)
@@ -650,7 +650,7 @@ static int bq2415x_get_charge_current(struct bq2415x_device *bq)
650650
int ret;
651651

652652
if (bq->init_data.resistor_sense <= 0)
653-
return -ENOSYS;
653+
return -EINVAL;
654654

655655
ret = bq2415x_i2c_read_mask(bq, BQ2415X_REG_CURRENT,
656656
BQ2415X_MASK_VI_CHRG, BQ2415X_SHIFT_VI_CHRG);
@@ -665,7 +665,7 @@ static int bq2415x_set_termination_current(struct bq2415x_device *bq, int mA)
665665
int val;
666666

667667
if (bq->init_data.resistor_sense <= 0)
668-
return -ENOSYS;
668+
return -EINVAL;
669669

670670
val = (mA * bq->init_data.resistor_sense - 3400) / 3400;
671671
if (val < 0)
@@ -684,7 +684,7 @@ static int bq2415x_get_termination_current(struct bq2415x_device *bq)
684684
int ret;
685685

686686
if (bq->init_data.resistor_sense <= 0)
687-
return -ENOSYS;
687+
return -EINVAL;
688688

689689
ret = bq2415x_i2c_read_mask(bq, BQ2415X_REG_CURRENT,
690690
BQ2415X_MASK_VI_TERM, BQ2415X_SHIFT_VI_TERM);
@@ -1166,7 +1166,7 @@ static ssize_t bq2415x_sysfs_set_mode(struct device *dev,
11661166

11671167
if (strncmp(buf, "auto", 4) == 0) {
11681168
if (bq->automode < 0)
1169-
return -ENOSYS;
1169+
return -EINVAL;
11701170
bq->automode = 1;
11711171
mode = bq->reported_mode;
11721172
} else if (strncmp(buf, "off", 3) == 0) {
@@ -1556,28 +1556,28 @@ static int bq2415x_probe(struct i2c_client *client,
15561556

15571557
bq = devm_kzalloc(&client->dev, sizeof(*bq), GFP_KERNEL);
15581558
if (!bq) {
1559-
dev_err(&client->dev, "failed to allocate device data\n");
15601559
ret = -ENOMEM;
15611560
goto error_2;
15621561
}
15631562

15641563
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");
15661566

15671567
if (IS_ERR(bq->notify_psy)) {
15681568
dev_info(&client->dev,
1569-
"no 'ti,usb-charger-detection' property (err=%ld)\n",
1569+
"no 'ti,usb-charger-detection' property (err=%ld)\n",
15701570
PTR_ERR(bq->notify_psy));
15711571
bq->notify_psy = NULL;
15721572
} else if (!bq->notify_psy) {
15731573
ret = -EPROBE_DEFER;
15741574
goto error_2;
15751575
}
1576-
}
1577-
else if (pdata->notify_device)
1576+
} else if (pdata->notify_device) {
15781577
bq->notify_psy = power_supply_get_by_name(pdata->notify_device);
1579-
else
1578+
} else {
15801579
bq->notify_psy = NULL;
1580+
}
15811581

15821582
i2c_set_clientdata(client, bq);
15831583

@@ -1592,27 +1592,27 @@ static int bq2415x_probe(struct i2c_client *client,
15921592

15931593
if (np) {
15941594
ret = of_property_read_u32(np, "ti,current-limit",
1595-
&bq->init_data.current_limit);
1595+
&bq->init_data.current_limit);
15961596
if (ret)
15971597
goto error_3;
15981598
ret = of_property_read_u32(np, "ti,weak-battery-voltage",
1599-
&bq->init_data.weak_battery_voltage);
1599+
&bq->init_data.weak_battery_voltage);
16001600
if (ret)
16011601
goto error_3;
16021602
ret = of_property_read_u32(np, "ti,battery-regulation-voltage",
16031603
&bq->init_data.battery_regulation_voltage);
16041604
if (ret)
16051605
goto error_3;
16061606
ret = of_property_read_u32(np, "ti,charge-current",
1607-
&bq->init_data.charge_current);
1607+
&bq->init_data.charge_current);
16081608
if (ret)
16091609
goto error_3;
16101610
ret = of_property_read_u32(np, "ti,termination-current",
1611-
&bq->init_data.termination_current);
1611+
&bq->init_data.termination_current);
16121612
if (ret)
16131613
goto error_3;
16141614
ret = of_property_read_u32(np, "ti,resistor-sense",
1615-
&bq->init_data.resistor_sense);
1615+
&bq->init_data.resistor_sense);
16161616
if (ret)
16171617
goto error_3;
16181618
} else {
@@ -1648,7 +1648,8 @@ static int bq2415x_probe(struct i2c_client *client,
16481648
}
16491649

16501650
/* 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);
16521653
bq2415x_set_mode(bq, bq->reported_mode);
16531654

16541655
bq->automode = 1;

0 commit comments

Comments
 (0)