public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <cbou@mail.ru>
To: linux-kernel@vger.kernel.org
Cc: kernel-discuss@handhelds.org, dwmw2@infradead.org,
	Greg KH <greg@kroah.com>, Randy Dunlap <randy.dunlap@oracle.com>,
	Shem Multinymous <multinymous@gmail.com>,
	Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
	Matthew Garrett <mjg59@srcf.ucam.org>
Subject: Re: [PATCH 3/7] [RFC] Battery monitoring class
Date: Sun, 15 Apr 2007 04:43:54 +0400	[thread overview]
Message-ID: <20070415004354.GA23559@zarina> (raw)
In-Reply-To: <20070413134939.GA20618@zarina>

On Fri, Apr 13, 2007 at 05:49:39PM +0400, Anton Vorontsov wrote:
> I'll convert mXh to uXh a bit later, if there will no further objections
> against uXh. Also I'd like to hear if there any objections on
> mA/mV -> uA/uV conversion. I think we'd better keep all units at the
> same order/precision.

Okay, would it make sense to use "long" instead of "int" after "milli" to
"micro" conversion? On 32 bit machines int gives +-2147483648 limit. So
2147 volts/amperes/...

Though 2147 amperes is unrealistic for batteries, but if used in
calculations it could be dangerous.

For example:
di->life_sec = -((di->accum_current_uAh - di->empty_uAh) *
                 3600) / di->current_uA;

It can be also solved (and I voting for it) by typecasting to long
in the driver itself.

Would it also make sense to use int64_t instead of long? And how should
it passed to printk in portable way? I guess printk (vsprintf) does not
support PRIx notation as defined in /usr/include/inttypes.h ?

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.org/bd2

  reply	other threads:[~2007-04-15  0:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-11 23:25 [PATCH 3/7] [RFC] Battery monitoring class Anton Vorontsov
2007-04-12  2:53 ` Randy Dunlap
2007-04-12 16:51   ` Anton Vorontsov
2007-04-12  3:43 ` Greg KH
2007-04-12 12:25   ` Henrique de Moraes Holschuh
2007-04-12 13:43   ` Anton Vorontsov
2007-04-12 13:08 ` Matthew Garrett
2007-04-12 14:15   ` Anton Vorontsov
2007-04-12 14:24     ` Matthew Garrett
2007-04-12 14:36       ` [Kernel-discuss] " Paul Sokolovsky
2007-04-12 18:56         ` Henrique de Moraes Holschuh
2007-04-12 20:44           ` Anton Vorontsov
2007-04-13  0:51             ` Henrique de Moraes Holschuh
2007-04-13  2:15               ` Anton Vorontsov
2007-04-24 19:36                 ` Pavel Machek
2007-04-13  2:34               ` Shem Multinymous
2007-04-13  2:36                 ` Anton Vorontsov
2007-04-13 13:51                   ` Henrique de Moraes Holschuh
2007-04-12 15:00 ` Shem Multinymous
2007-04-12 15:18   ` Anton Vorontsov
2007-04-12 17:23     ` Shem Multinymous
2007-04-13 13:49 ` Anton Vorontsov
2007-04-15  0:43   ` Anton Vorontsov [this message]
2007-05-04  9:59     ` Pavel Machek
2007-04-15 19:56 ` Pavel Machek
2007-04-15 22:10   ` [Kernel-discuss] " Anton Vorontsov
2007-04-15 22:08 ` Ondrej Zajicek
2007-04-15 22:50   ` Anton Vorontsov
2007-04-16  0:57     ` Henrique de Moraes Holschuh
2007-04-16  1:57       ` Anton Vorontsov
2007-04-16 14:34         ` Henrique de Moraes Holschuh
2007-04-16  2:32       ` [Kernel-discuss] " ian
2007-04-16  3:12         ` Anton Vorontsov
2007-04-16  8:28           ` ian

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=20070415004354.GA23559@zarina \
    --to=cbou@mail.ru \
    --cc=dwmw2@infradead.org \
    --cc=greg@kroah.com \
    --cc=hmh@hmh.eng.br \
    --cc=kernel-discuss@handhelds.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=multinymous@gmail.com \
    --cc=randy.dunlap@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox