* [GIT PULL] battery-2.6.35.git
@ 2010-07-27 13:51 Anton Vorontsov
2010-07-27 14:03 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Anton Vorontsov @ 2010-07-27 13:51 UTC (permalink / raw)
To: Linus Torvalds
Cc: Andrew Morton, David Woodhouse, Ben Hutchings, linux-kernel
Hello Linus,
Here is another small fixup for ds2782_battery driver.
At first I thought that this is not 2.6.35 regression, thus
I didn't send it earlier. But, Ben Hutchings convinced me that
this is actually 2.6.35 regression, so now I believe that this
fix should be OK.
It affects only minor platforms though, i.e. sh4, alpha, frv,
microblaze, mn10300. And I doubt that any of those platforms
have DS2782 batteries, so I will understand if you won't pull
it that late.
Thanks,
The following changes since commit 7e27d6e778cd87b6f2415515d7127eba53fe5d02:
Linus Torvalds (1):
Linux 2.6.35-rc3
are available in the git repository at:
git://git.infradead.org/users/cbou/battery-2.6.35.git master
Peter Huewe (1):
ds2782_battery: Rename get_current to fix build failure / name conflict
drivers/power/ds2782_battery.c | 29 ++++++++++++++---------------
1 files changed, 14 insertions(+), 15 deletions(-)
commit eb9650d6d989f24f21232a055d8fd45f1a9dcf99
Author: Peter Huewe <peterhuewe@gmx.de>
Date: Thu May 13 01:54:57 2010 +0200
ds2782_battery: Rename get_current to fix build failure / name conflict
This patch changes the name of get_current function pointer to
get_battery_current to resolve a name conflict with the get_current
macro defined in current.h.
This conflict resulted in a build-failure[1] for the sh4 arch
allyesconfig:
drivers/power/ds2782_battery.c:216:48: error: macro "get_current"
passed 2 arguments, but takes just
This patch fixes the issue. To be consistent the other function pointers
(_voltage,_capacity) were renamed too.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Ryan Mallon <ryan@bluewatersys.com>
Acked-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
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);
};
#define to_ds278x_info(x) container_of(x, struct ds278x_info, battery)
@@ -213,11 +212,11 @@ static int ds278x_get_status(struct ds278x_info *info, int *status)
int current_uA;
int capacity;
- err = info->ops->get_current(info, ¤t_uA);
+ err = info->ops->get_battery_current(info, ¤t_uA);
if (err)
return err;
- err = info->ops->get_capacity(info, &capacity);
+ err = info->ops->get_battery_capacity(info, &capacity);
if (err)
return err;
@@ -246,15 +245,15 @@ static int ds278x_battery_get_property(struct power_supply *psy,
break;
case POWER_SUPPLY_PROP_CAPACITY:
- ret = info->ops->get_capacity(info, &val->intval);
+ ret = info->ops->get_battery_capacity(info, &val->intval);
break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
- ret = info->ops->get_voltage(info, &val->intval);
+ ret = info->ops->get_battery_voltage(info, &val->intval);
break;
case POWER_SUPPLY_PROP_CURRENT_NOW:
- ret = info->ops->get_current(info, &val->intval);
+ ret = info->ops->get_battery_current(info, &val->intval);
break;
case POWER_SUPPLY_PROP_TEMP:
@@ -307,14 +306,14 @@ enum ds278x_num_id {
static struct ds278x_battery_ops ds278x_ops[] = {
[DS2782] = {
- .get_current = ds2782_get_current,
- .get_voltage = ds2782_get_voltage,
- .get_capacity = ds2782_get_capacity,
+ .get_battery_current = ds2782_get_current,
+ .get_battery_voltage = ds2782_get_voltage,
+ .get_battery_capacity = ds2782_get_capacity,
},
[DS2786] = {
- .get_current = ds2786_get_current,
- .get_voltage = ds2786_get_voltage,
- .get_capacity = ds2786_get_capacity,
+ .get_battery_current = ds2786_get_current,
+ .get_battery_voltage = ds2786_get_voltage,
+ .get_battery_capacity = ds2786_get_capacity,
}
};
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [GIT PULL] battery-2.6.35.git
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
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2010-07-27 14:03 UTC (permalink / raw)
To: Anton Vorontsov
Cc: Linus Torvalds, Andrew Morton, David Woodhouse, Ben Hutchings,
linux-kernel
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'?).
So I had a look at the sources, and noticed:
| static int ds2782_get_voltage(struct ds278x_info *info, int *voltage_uA)
| {
| s16 raw;
| int err;
|
| /*
| * Voltage is measured in units of 4.88mV. The voltage is stored as
^^^^
| * a 10-bit number plus sign, in the upper bits of a 16-bit register
| */
| err = ds278x_read_reg16(info, DS278x_REG_VOLT_MSB, &raw);
| if (err)
| return err;
| *voltage_uA = (raw / 32) * 4800;
^^^^
These don't match?
So the voltage_uA unit is 1 mV?
| return 0;
| }
|
| static int ds2786_get_voltage(struct ds278x_info *info, int *voltage_uA)
| {
| s16 raw;
| int err;
|
| /*
| * Voltage is measured in units of 1.22mV. The voltage is stored as
| * a 10-bit number plus sign, in the upper bits of a 16-bit register
| */
| err = ds278x_read_reg16(info, DS278x_REG_VOLT_MSB, &raw);
| if (err)
| return err;
| *voltage_uA = (raw / 8) * 1220;
^
32? Or the comments above are wrong.
| return 0;
| }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [GIT PULL] battery-2.6.35.git
2010-07-27 14:03 ` Geert Uytterhoeven
@ 2010-07-27 14:13 ` Anton Vorontsov
2010-07-27 21:05 ` [PATCH] Fix ds2782 battery driver units (was Re: [GIT PULL] battery-2.6.35.git) Ryan Mallon
0 siblings, 1 reply; 4+ messages in thread
From: Anton Vorontsov @ 2010-07-27 14:13 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linus Torvalds, Andrew Morton, David Woodhouse, Ben Hutchings,
linux-kernel, Ryan Mallon, Yulia Vilensky
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!
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH] Fix ds2782 battery driver units (was Re: [GIT PULL] battery-2.6.35.git)
2010-07-27 14:13 ` Anton Vorontsov
@ 2010-07-27 21:05 ` Ryan Mallon
0 siblings, 0 replies; 4+ messages in thread
From: Ryan Mallon @ 2010-07-27 21:05 UTC (permalink / raw)
To: Anton Vorontsov
Cc: Geert Uytterhoeven, Linus Torvalds, Andrew Morton,
David Woodhouse, Ben Hutchings, linux-kernel, Yulia Vilensky
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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-27 21:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] Fix ds2782 battery driver units (was Re: [GIT PULL] battery-2.6.35.git) Ryan Mallon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox