diff mbox series

[v4,8/8] power: supply: fix wrong interpretation of register value

Message ID 20221024132757.3345400-9-sravanhome@gmail.com
State Superseded
Headers show
Series Add support for mp2733 battery charger | expand

Commit Message

Saravanan Sekar Oct. 24, 2022, 1:27 p.m. UTC
fix wrong interpretation of bitwise as hex

Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
---
 drivers/power/supply/mp2629_charger.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko Oct. 24, 2022, 1:50 p.m. UTC | #1
On Mon, Oct 24, 2022 at 4:28 PM Saravanan Sekar <sravanhome@gmail.com> wrote:
>
> fix wrong interpretation of bitwise as hex

Respect English grammar and punctuation.
Andy Shevchenko Oct. 24, 2022, 1:50 p.m. UTC | #2
On Mon, Oct 24, 2022 at 4:50 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Oct 24, 2022 at 4:28 PM Saravanan Sekar <sravanhome@gmail.com> wrote:
> >
> > fix wrong interpretation of bitwise as hex

Maybe you can replace 0x with 0b instead?
Saravanan Sekar Oct. 24, 2022, 2:07 p.m. UTC | #3
On 24/10/22 15:50, Andy Shevchenko wrote:
> On Mon, Oct 24, 2022 at 4:50 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>> On Mon, Oct 24, 2022 at 4:28 PM Saravanan Sekar <sravanhome@gmail.com> wrote:
>>>
>>> fix wrong interpretation of bitwise as hex
> 
> Maybe you can replace 0x with 0b instead?
> 

Ok, I consider to changes as "fix the register value interpretation as 
0x instead of 0b" does it fits !!

Thanks,
Saravanan
Andy Shevchenko Oct. 24, 2022, 2:18 p.m. UTC | #4
On Mon, Oct 24, 2022 at 5:07 PM saravanan sekar <sravanhome@gmail.com> wrote:
>
> On 24/10/22 15:50, Andy Shevchenko wrote:
> > On Mon, Oct 24, 2022 at 4:50 PM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> >> On Mon, Oct 24, 2022 at 4:28 PM Saravanan Sekar <sravanhome@gmail.com> wrote:
> >>>
> >>> fix wrong interpretation of bitwise as hex
> >
> > Maybe you can replace 0x with 0b instead?
> >
>
> Ok, I consider to changes as "fix the register value interpretation as
> 0x instead of 0b" does it fits !!

No, it doesn't because there is no evidence of 0b in use. I suggested
to use 0b in the code (as the part of your change) instead of
switching to hex.
Saravanan Sekar Oct. 24, 2022, 2:37 p.m. UTC | #5
On 24/10/22 16:18, Andy Shevchenko wrote:
> On Mon, Oct 24, 2022 at 5:07 PM saravanan sekar <sravanhome@gmail.com> wrote:
>>
>> On 24/10/22 15:50, Andy Shevchenko wrote:
>>> On Mon, Oct 24, 2022 at 4:50 PM Andy Shevchenko
>>> <andy.shevchenko@gmail.com> wrote:
>>>> On Mon, Oct 24, 2022 at 4:28 PM Saravanan Sekar <sravanhome@gmail.com> wrote:
>>>>>
>>>>> fix wrong interpretation of bitwise as hex
>>>
>>> Maybe you can replace 0x with 0b instead?
>>>
>>
>> Ok, I consider to changes as "fix the register value interpretation as
>> 0x instead of 0b" does it fits !!
> 
> No, it doesn't because there is no evidence of 0b in use. I suggested
> to use 0b in the code (as the part of your change) instead of
> switching to hex.
> 

Ok, I guess re-phrase of commit message shall solve the conflict. I feel 
use of 0x in code is fine.

I will edit the commit message as "fix the switch case to match the 
register values"


Thanks,
Saravanan
diff mbox series

Patch

diff --git a/drivers/power/supply/mp2629_charger.c b/drivers/power/supply/mp2629_charger.c
index 9e4111aace4b..2ff3729afc48 100644
--- a/drivers/power/supply/mp2629_charger.c
+++ b/drivers/power/supply/mp2629_charger.c
@@ -328,10 +328,10 @@  static int mp2629_charger_battery_get_prop(struct power_supply *psy,
 			val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
 			break;
 		case 0x01:
-		case 0x10:
+		case 0x02:
 			val->intval = POWER_SUPPLY_STATUS_CHARGING;
 			break;
-		case 0x11:
+		case 0x03:
 			val->intval = POWER_SUPPLY_STATUS_FULL;
 		}
 		break;
@@ -349,7 +349,7 @@  static int mp2629_charger_battery_get_prop(struct power_supply *psy,
 		case 0x01:
 			val->intval = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
 			break;
-		case 0x10:
+		case 0x02:
 			val->intval = POWER_SUPPLY_CHARGE_TYPE_STANDARD;
 			break;
 		default: