public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: rklein <rklein@nvidia.com>
To: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: "olof@lixom.net" <olof@lixom.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] power: bq20z75: add support for charge properties
Date: Fri, 14 Jan 2011 10:32:49 -0800	[thread overview]
Message-ID: <1295029969.30634.0.camel@rklein-linux2> (raw)
In-Reply-To: <20110114152348.GB30831@oksana.dev.rtsoft.ru>

On Fri, 2011-01-14 at 07:23 -0800, Anton Vorontsov wrote:
> On Thu, Jan 13, 2011 at 10:50:13AM -0800, rklein@nvidia.com wrote:
> [...]
> > +#define PROP_NEEDS_AMPS(PSP) \
> > +	((PSP == POWER_SUPPLY_PROP_CHARGE_NOW) || \
> > +	 (PSP == POWER_SUPPLY_PROP_CHARGE_FULL) || \
> > +	 (PSP == POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN))
> > +
> > +#define PROP_NEEDS_WATTS(PSP) \
> > +	((PSP == POWER_SUPPLY_PROP_ENERGY_NOW) || \
> > +	 (PSP == POWER_SUPPLY_PROP_ENERGY_FULL) || \
> > +	 (PSP == POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN))
> 
> Ugh. Please, implement it as a function.
> 
> And maybe place it somewhere into linux/power_supply.h?
> 
> Something like this maybe?
> 
> static inline bool power_supply_is_amp_prop(enum power_supply_property psp)
> {
> 	switch (psp) {
> 	case POWER_SUPPLY_PROP_CHARGE_NOW:
> 	case POWER_SUPPLY_PROP_CHARGE_FULL:
> 	case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
> 	<...>
> 		return 1;
> 	}
> 	return 0;
> }
> 
> Thanks!
> 
Will do, that seems a much smarter idea as this could be reused.

-rhyland


      reply	other threads:[~2011-01-14 18:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 18:50 [PATCH 1/1] power: bq20z75: add support for charge properties rklein
2011-01-14 15:23 ` Anton Vorontsov
2011-01-14 18:32   ` rklein [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=1295029969.30634.0.camel@rklein-linux2 \
    --to=rklein@nvidia.com \
    --cc=cbouatmailru@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    /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