From: Pavel Machek <pavel@ucw.cz>
To: pali.rohar@gmail.com, sre@debian.org, sre@ring0.de,
kernel list <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-omap@vger.kernel.org, tony@atomide.com, khilman@kernel.org,
aaro.koskinen@iki.fi, ivo.g.dimitrov.75@gmail.com,
patrikbachan@gmail.com, serge@hallyn.com
Cc: a.hajda@samsung.com, afd@ti.com, giometti@linux.it
Subject: Re: /sys/class/power_supply/bq27200-0/capacity changed meaning between 4.1 and 4.4?
Date: Sun, 10 Jan 2016 09:06:34 +0100 [thread overview]
Message-ID: <20160110080621.GA3929@amd> (raw)
In-Reply-To: <20160109230709.GA30551@amd>
Hi!
> Did /sys/class/power_supply/bq27200-0/capacity change meaning between
> 4.1 and 4.4?
>
> It used to report battery capacity remaining in percent.
>
> Not sure what it reports now, but ain't in percent....
> The patch does not compile, but I should be sleeping, not trying to
> understand crazy code. Whoever wrote it, please fix it. Maybe you can
> just do
...and more crazy code :-(.
cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag);
if ((cache.flags & 0xff) == 0xff)
cache.flags = -1; /* read error */
/* WTF? bq27xxx returns -ERRNO
on error, we mask some bits off it, and then make it -1... */
...and one crazy optimalization...
if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)
di->cache = cache;
...are we playing obfuscated C code contest, yet?
case POWER_SUPPLY_PROP_PRESENT:
val->intval = di->cache.flags < 0 ? 0 : 1;
...to decidegree C?
if (ret == 0)
pval->intval -= 2731; /* convert decidegree k to c */
as read takes enum, make it enum like this?
static inline int bq27xxx_read(struct bq27xxx_device_info *di, enum bq27xxx_reg_index reg_index,
bool single)
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
WARNING: multiple messages have this Message-ID (diff)
From: pavel@ucw.cz (Pavel Machek)
To: linux-arm-kernel@lists.infradead.org
Subject: /sys/class/power_supply/bq27200-0/capacity changed meaning between 4.1 and 4.4?
Date: Sun, 10 Jan 2016 09:06:34 +0100 [thread overview]
Message-ID: <20160110080621.GA3929@amd> (raw)
In-Reply-To: <20160109230709.GA30551@amd>
Hi!
> Did /sys/class/power_supply/bq27200-0/capacity change meaning between
> 4.1 and 4.4?
>
> It used to report battery capacity remaining in percent.
>
> Not sure what it reports now, but ain't in percent....
> The patch does not compile, but I should be sleeping, not trying to
> understand crazy code. Whoever wrote it, please fix it. Maybe you can
> just do
...and more crazy code :-(.
cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag);
if ((cache.flags & 0xff) == 0xff)
cache.flags = -1; /* read error */
/* WTF? bq27xxx returns -ERRNO
on error, we mask some bits off it, and then make it -1... */
...and one crazy optimalization...
if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)
di->cache = cache;
...are we playing obfuscated C code contest, yet?
case POWER_SUPPLY_PROP_PRESENT:
val->intval = di->cache.flags < 0 ? 0 : 1;
...to decidegree C?
if (ret == 0)
pval->intval -= 2731; /* convert decidegree k to c */
as read takes enum, make it enum like this?
static inline int bq27xxx_read(struct bq27xxx_device_info *di, enum bq27xxx_reg_index reg_index,
bool single)
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2016-01-10 8:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-09 23:07 /sys/class/power_supply/bq27200-0/capacity changed meaning between 4.1 and 4.4? Pavel Machek
2016-01-09 23:07 ` Pavel Machek
2016-01-10 8:06 ` Pavel Machek [this message]
2016-01-10 8:06 ` Pavel Machek
2016-01-11 14:44 ` Andrew F. Davis
2016-01-11 14:44 ` Andrew F. Davis
2016-01-11 14:44 ` Andrew F. Davis
2016-01-11 14:25 ` Andrew F. Davis
2016-01-11 14:25 ` Andrew F. Davis
2016-01-11 14:25 ` Andrew F. Davis
2016-01-11 21:42 ` Pavel Machek
2016-01-11 21:42 ` Pavel Machek
2016-01-11 21:48 ` Andrew F. Davis
2016-01-11 21:48 ` Andrew F. Davis
2016-01-11 21:48 ` Andrew F. Davis
2016-01-12 15:22 ` Andrew F. Davis
2016-01-12 15:22 ` Andrew F. Davis
2016-01-12 15:22 ` Andrew F. Davis
2016-01-12 21:53 ` Pavel Machek
2016-01-12 21:53 ` Pavel Machek
2016-01-13 8:44 ` Pali Rohár
2016-01-13 8:44 ` Pali Rohár
2016-01-13 10:26 ` Sebastian Reichel
2016-01-13 10:26 ` Sebastian Reichel
2016-01-13 10:26 ` Sebastian Reichel
2016-01-13 10:32 ` Pali Rohár
2016-01-13 10:32 ` Pali Rohár
2016-01-13 11:01 ` Pavel Machek
2016-01-13 11:01 ` Pavel Machek
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=20160110080621.GA3929@amd \
--to=pavel@ucw.cz \
--cc=a.hajda@samsung.com \
--cc=aaro.koskinen@iki.fi \
--cc=afd@ti.com \
--cc=giometti@linux.it \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=pali.rohar@gmail.com \
--cc=patrikbachan@gmail.com \
--cc=serge@hallyn.com \
--cc=sre@debian.org \
--cc=sre@ring0.de \
--cc=tony@atomide.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.