lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 14 Jan 2011 10:32:49 -0800
From:	rklein <rklein@...dia.com>
To:	Anton Vorontsov <cbouatmailru@...il.com>
Cc:	"olof@...om.net" <olof@...om.net>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] power: bq20z75: add support for charge properties

On Fri, 2011-01-14 at 07:23 -0800, Anton Vorontsov wrote:
> On Thu, Jan 13, 2011 at 10:50:13AM -0800, rklein@...dia.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ