public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>,
	LenBrown <lenb@kernel.org>,
	Linux-acpi@vger.kernel.org
Subject: Re: [RFC][PATCH] ACPI: battery: add power_{now, avg} properties to power_class
Date: Tue, 16 Dec 2008 16:19:44 +0100	[thread overview]
Message-ID: <200812161619.45073.rjw@sisk.pl> (raw)
In-Reply-To: <20081216141845.GB13379@khazad-dum.debian.net>

On Tuesday, 16 of December 2008, Henrique de Moraes Holschuh wrote:
> On Tue, 16 Dec 2008, Alexey Starikovskiy wrote:
> > Henrique de Moraes Holschuh wrote:
> >> On Tue, 16 Dec 2008, Alexey Starikovskiy wrote:
> >>> @@ -224,10 +224,12 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy,
> >>>  				acpi_battery_vscale(battery) * 1000;
> >>>  		break;
> >>>  	case POWER_SUPPLY_PROP_CURRENT_NOW:
> >>> +	case POWER_SUPPLY_PROP_POWER_NOW:
> >>>  		val->intval = abs(battery->current_now) *
> >>>  				acpi_battery_ipscale(battery) * 1000;
> >>>  		break;
> >>>  	case POWER_SUPPLY_PROP_CURRENT_AVG:
> >>> +	case POWER_SUPPLY_PROP_POWER_AVG:
> >>>  		val->intval = abs(battery->current_avg) *
> >>>  				acpi_battery_ipscale(battery) * 1000;
> >>>  		break;
> >>
> >> Excuse me if I am talking nonsense (I have looked over just the patch,
> >> not the entire file), but how can that be correct?  It is either power
> >> or current, it cannot be both, so the CURRENT case should be dropped.
> > file name under /sys depends on property, so if we want some variable to
> > be named as current_now, it should be returned by case POWER_SUPPLY_PROP_CURRENT_NOW.
> > Then we register with power_supply, we say which set of properties (either charge or energy) we support,
> > so for one battery we will receive request for either CURRENT_AVG or POWER_AVG, not both.
> >> And if it is power, why have fields named current_now... or is
> >> ipscale() a voltage, and not a scaling factor?
> > ipscale stands for I/P scaling, as opposed to V scaling -- it depends on units returned by actual battery.
> > All energy/charge fields are reused, so battery->current_now contains either power_now or current_now from battery.
> 
> I see.  But that's a loaded-spring trap waiting for the unaware.  Can it be
> called something else that is neutral re. power or current, pretty please?
> even "current_or_power_now" would be less confusing...

As I said in my recent reply to Alex, I'd prefer it if there were separate
fields called 'power_now' and 'power_avg' under 'battery'.

Then, there won't be any confustion and people reading the source will clearly
understand what is what.

Thanks,
Rafael

  reply	other threads:[~2008-12-16 15:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 21:38 [RFC][PATCH] ACPI: battery: add power_{now, avg} properties to power_class Alexey Starikovskiy
2008-12-16  1:22 ` Henrique de Moraes Holschuh
2008-12-16  8:53   ` Alexey Starikovskiy
2008-12-16 14:18     ` Henrique de Moraes Holschuh
2008-12-16 15:19       ` Rafael J. Wysocki [this message]
2008-12-16 15:17 ` Rafael J. Wysocki
2008-12-16 15:28   ` Alexey Starikovskiy
2008-12-16 15:51     ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2008-12-16 16:27 Alexey Starikovskiy
2008-12-16 17:41 ` Len Brown
2008-12-16 20:49   ` Rafael J. Wysocki

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=200812161619.45073.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=Linux-acpi@vger.kernel.org \
    --cc=astarikovskiy@suse.de \
    --cc=hmh@hmh.eng.br \
    --cc=lenb@kernel.org \
    /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