From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Daniel Drake <dsd@laptop.org>
Cc: dwmw2@infradead.org, linux-kernel@vger.kernel.org,
richard@laptop.org, dilinger@queued.net
Subject: Re: [PATCH] olpc_battery: Fix endian neutral breakage for s16 values
Date: Fri, 24 Sep 2010 23:37:51 +0400 [thread overview]
Message-ID: <20100924193751.GA16745@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20100924193133.E5C7A9D401B@zog.reactivated.net>
On Fri, Sep 24, 2010 at 08:31:33PM +0100, Daniel Drake wrote:
> From: Richard A. Smith <richard@laptop.org>
>
> When the driver was updated to be endian neutral (8e9c7716c)
> the signed part of the s16 values was lost. This is because be16_to_cpu()
> returns a signed value. This patch casts the values back to a s16 number
> prior to the the cast up to an int.
>
> Signed-off-by: Richard A. Smith <richard@laptop.org>
> Signed-off-by: Daniel Drake <dsd@laptop.org>
Good catch.
[...]
> - val->intval = (int)be16_to_cpu(ec_word) * 9760L / 32;
> + val->intval = (int)((s16)be16_to_cpu(ec_word)) * 9760L / 32;
Do we really need "(int)" then?
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
prev parent reply other threads:[~2010-09-24 19:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-24 19:31 [PATCH] olpc_battery: Fix endian neutral breakage for s16 values Daniel Drake
2010-09-24 19:37 ` Anton Vorontsov [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=20100924193751.GA16745@oksana.dev.rtsoft.ru \
--to=cbouatmailru@gmail.com \
--cc=dilinger@queued.net \
--cc=dsd@laptop.org \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@laptop.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 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.