public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ryan Mallon <ryan@bluewatersys.com>
To: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Ben Hutchings <ben@decadent.org.uk>,
	linux-kernel@vger.kernel.org,
	Yulia Vilensky <vilensky@compulab.co.il>
Subject: [PATCH] Fix ds2782 battery driver units (was Re: [GIT PULL] battery-2.6.35.git)
Date: Wed, 28 Jul 2010 09:05:16 +1200	[thread overview]
Message-ID: <4C4F4A0C.7010807@bluewatersys.com> (raw)
In-Reply-To: <20100727141331.GA5394@oksana.dev.rtsoft.ru>

On 07/28/2010 02:13 AM, Anton Vorontsov wrote:
> On Tue, Jul 27, 2010 at 04:03:14PM +0200, Geert Uytterhoeven wrote:
>   
>> On Tue, Jul 27, 2010 at 15:51, Anton Vorontsov <cbouatmailru@gmail.com> wrote:
>>     
>>> diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
>>> index d762a0c..9b3b4b7 100644
>>> --- a/drivers/power/ds2782_battery.c
>>> +++ b/drivers/power/ds2782_battery.c
>>> @@ -43,10 +43,9 @@
>>>  struct ds278x_info;
>>>
>>>  struct ds278x_battery_ops {
>>> -       int     (*get_current)(struct ds278x_info *info, int *current_uA);
>>> -       int     (*get_voltage)(struct ds278x_info *info, int *voltage_uA);
>>> -       int     (*get_capacity)(struct ds278x_info *info, int *capacity_uA);
>>> -
>>> +       int (*get_battery_current)(struct ds278x_info *info, int *current_uA);
>>> +       int (*get_battery_voltage)(struct ds278x_info *info, int *voltage_uA);
>>> +       int (*get_battery_capacity)(struct ds278x_info *info, int *capacity_uA);
>>>       
>> What's the meaning of these `uA' namings? At first I thought `micro Ampère', but
>> that can't be correct for voltage (`uV'?) and capacity (`uAh'?).
>>     
> Yeah, the names aren't quite right. But they were wrong before
> that patch too, so a patch on top to fix these issues will work.
>
> Cc'ing driver authors.
>
> Thanks Geert!
>   

Thanks for pointing this out. The following untested patch fixes the
units in the variable names.

~Ryan

---
Correct the unit names in the ds2782 battery driver. Changes voltage_uA
to voltage_uV and capacity_uA to capacity.

Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
---

diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
index 9b3b4b7..d9a3b59 100644
--- a/drivers/power/ds2782_battery.c
+++ b/drivers/power/ds2782_battery.c
@@ -44,8 +44,8 @@ struct ds278x_info;
 
 struct ds278x_battery_ops {
 	int (*get_battery_current)(struct ds278x_info *info, int *current_uA);
-	int (*get_battery_voltage)(struct ds278x_info *info, int *voltage_uA);
-	int (*get_battery_capacity)(struct ds278x_info *info, int *capacity_uA);
+	int (*get_battery_voltage)(struct ds278x_info *info, int *voltage_uV);
+	int (*get_battery_capacity)(struct ds278x_info *info, int *capacity);
 };
 
 #define to_ds278x_info(x) container_of(x, struct ds278x_info, battery)
@@ -137,7 +137,7 @@ static int ds2782_get_current(struct ds278x_info *info, int *current_uA)
 	return 0;
 }
 
-static int ds2782_get_voltage(struct ds278x_info *info, int *voltage_uA)
+static int ds2782_get_voltage(struct ds278x_info *info, int *voltage_uV)
 {
 	s16 raw;
 	int err;
@@ -149,7 +149,7 @@ static int ds2782_get_voltage(struct ds278x_info *info, int *voltage_uA)
 	err = ds278x_read_reg16(info, DS278x_REG_VOLT_MSB, &raw);
 	if (err)
 		return err;
-	*voltage_uA = (raw / 32) * 4800;
+	*voltage_uV = (raw / 32) * 4800;
 	return 0;
 }
 
@@ -177,7 +177,7 @@ static int ds2786_get_current(struct ds278x_info *info, int *current_uA)
 	return 0;
 }
 
-static int ds2786_get_voltage(struct ds278x_info *info, int *voltage_uA)
+static int ds2786_get_voltage(struct ds278x_info *info, int *voltage_uV)
 {
 	s16 raw;
 	int err;
@@ -189,7 +189,7 @@ static int ds2786_get_voltage(struct ds278x_info *info, int *voltage_uA)
 	err = ds278x_read_reg16(info, DS278x_REG_VOLT_MSB, &raw);
 	if (err)
 		return err;
-	*voltage_uA = (raw / 8) * 1220;
+	*voltage_uV = (raw / 8) * 1220;
 	return 0;
 }
 


      reply	other threads:[~2010-07-27 21:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27 13:51 [GIT PULL] battery-2.6.35.git Anton Vorontsov
2010-07-27 14:03 ` Geert Uytterhoeven
2010-07-27 14:13   ` Anton Vorontsov
2010-07-27 21:05     ` Ryan Mallon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C4F4A0C.7010807@bluewatersys.com \
    --to=ryan@bluewatersys.com \
    --cc=akpm@linux-foundation.org \
    --cc=ben@decadent.org.uk \
    --cc=cbouatmailru@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vilensky@compulab.co.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox