@@ -631,7 +631,7 @@ static int bq2415x_set_charge_current(struct bq2415x_device *bq, int mA)
631
631
int val ;
632
632
633
633
if (bq -> init_data .resistor_sense <= 0 )
634
- return - ENOSYS ;
634
+ return - EINVAL ;
635
635
636
636
val = (mA * bq -> init_data .resistor_sense - 37400 ) / 6800 ;
637
637
if (val < 0 )
@@ -650,7 +650,7 @@ static int bq2415x_get_charge_current(struct bq2415x_device *bq)
650
650
int ret ;
651
651
652
652
if (bq -> init_data .resistor_sense <= 0 )
653
- return - ENOSYS ;
653
+ return - EINVAL ;
654
654
655
655
ret = bq2415x_i2c_read_mask (bq , BQ2415X_REG_CURRENT ,
656
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
665
int val ;
666
666
667
667
if (bq -> init_data .resistor_sense <= 0 )
668
- return - ENOSYS ;
668
+ return - EINVAL ;
669
669
670
670
val = (mA * bq -> init_data .resistor_sense - 3400 ) / 3400 ;
671
671
if (val < 0 )
@@ -684,7 +684,7 @@ static int bq2415x_get_termination_current(struct bq2415x_device *bq)
684
684
int ret ;
685
685
686
686
if (bq -> init_data .resistor_sense <= 0 )
687
- return - ENOSYS ;
687
+ return - EINVAL ;
688
688
689
689
ret = bq2415x_i2c_read_mask (bq , BQ2415X_REG_CURRENT ,
690
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
1167
if (strncmp (buf , "auto" , 4 ) == 0 ) {
1168
1168
if (bq -> automode < 0 )
1169
- return - ENOSYS ;
1169
+ return - EINVAL ;
1170
1170
bq -> automode = 1 ;
1171
1171
mode = bq -> reported_mode ;
1172
1172
} else if (strncmp (buf , "off" , 3 ) == 0 ) {
@@ -1556,28 +1556,28 @@ static int bq2415x_probe(struct i2c_client *client,
1556
1556
1557
1557
bq = devm_kzalloc (& client -> dev , sizeof (* bq ), GFP_KERNEL );
1558
1558
if (!bq ) {
1559
- dev_err (& client -> dev , "failed to allocate device data\n" );
1560
1559
ret = - ENOMEM ;
1561
1560
goto error_2 ;
1562
1561
}
1563
1562
1564
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
1567
if (IS_ERR (bq -> notify_psy )) {
1568
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
1570
PTR_ERR (bq -> notify_psy ));
1571
1571
bq -> notify_psy = NULL ;
1572
1572
} else if (!bq -> notify_psy ) {
1573
1573
ret = - EPROBE_DEFER ;
1574
1574
goto error_2 ;
1575
1575
}
1576
- }
1577
- else if (pdata -> notify_device )
1576
+ } else if (pdata -> notify_device ) {
1578
1577
bq -> notify_psy = power_supply_get_by_name (pdata -> notify_device );
1579
- else
1578
+ } else {
1580
1579
bq -> notify_psy = NULL ;
1580
+ }
1581
1581
1582
1582
i2c_set_clientdata (client , bq );
1583
1583
@@ -1592,27 +1592,27 @@ static int bq2415x_probe(struct i2c_client *client,
1592
1592
1593
1593
if (np ) {
1594
1594
ret = of_property_read_u32 (np , "ti,current-limit" ,
1595
- & bq -> init_data .current_limit );
1595
+ & bq -> init_data .current_limit );
1596
1596
if (ret )
1597
1597
goto error_3 ;
1598
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
1600
if (ret )
1601
1601
goto error_3 ;
1602
1602
ret = of_property_read_u32 (np , "ti,battery-regulation-voltage" ,
1603
1603
& bq -> init_data .battery_regulation_voltage );
1604
1604
if (ret )
1605
1605
goto error_3 ;
1606
1606
ret = of_property_read_u32 (np , "ti,charge-current" ,
1607
- & bq -> init_data .charge_current );
1607
+ & bq -> init_data .charge_current );
1608
1608
if (ret )
1609
1609
goto error_3 ;
1610
1610
ret = of_property_read_u32 (np , "ti,termination-current" ,
1611
- & bq -> init_data .termination_current );
1611
+ & bq -> init_data .termination_current );
1612
1612
if (ret )
1613
1613
goto error_3 ;
1614
1614
ret = of_property_read_u32 (np , "ti,resistor-sense" ,
1615
- & bq -> init_data .resistor_sense );
1615
+ & bq -> init_data .resistor_sense );
1616
1616
if (ret )
1617
1617
goto error_3 ;
1618
1618
} else {
@@ -1648,7 +1648,8 @@ static int bq2415x_probe(struct i2c_client *client,
1648
1648
}
1649
1649
1650
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
1653
bq2415x_set_mode (bq , bq -> reported_mode );
1653
1654
1654
1655
bq -> automode = 1 ;
0 commit comments