linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Jean Delvare <khali@linux-fr.org>,
	lm-sensors@lm-sensors.org
Subject: Re: [PATCH v4] linux/kernel.h: Fix DIV_ROUND_CLOSEST to support negative dividends
Date: Sun, 9 Sep 2012 16:57:34 +0200	[thread overview]
Message-ID: <CAMuHMdWT2xKzOY9t05mYTMjmk=-V_XQQ8mZc69eQyrDN99hMuw@mail.gmail.com> (raw)
In-Reply-To: <1346425339-17138-1-git-send-email-linux@roeck-us.net>

On Fri, Aug 31, 2012 at 5:02 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> DIV_ROUND_CLOSEST returns a bad result for negative dividends:
>         DIV_ROUND_CLOSEST(-2, 2) = 0
>
> Most of the time this does not matter. However, in the hardware monitoring
> subsystem, DIV_ROUND_CLOSEST is sometimes used on integers which can be
> negative (such as temperatures).

This seems to cause 3 new warnings in my m68k builds of v3.6-rc5:

drivers/hwmon/mcp3021.c:76: warning: comparison is always true due to
limited range of data type
drivers/ide/ide-cd.c:1158: warning: comparison is always true due to
limited range of data type
drivers/ide/ide-cd.c:1159: warning: comparison is always true due to
limited range of data type

$ m68k-linux-gnu-gcc -v
Using built-in specs.
Target: m68k-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++
--prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/m68k-linux-gnu/include/c++/4.1.2
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --disable-libssp --disable-werror
--enable-checking=release --program-prefix=m68k-linux-gnu-
--includedir=/usr/m68k-linux-gnu/include --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=m68k-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Ubuntu 4.1.1-21)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  parent reply	other threads:[~2012-09-09 14:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-31 15:02 [PATCH v4] linux/kernel.h: Fix DIV_ROUND_CLOSEST to support negative dividends Guenter Roeck
2012-08-31 19:38 ` Andrew Morton
2012-08-31 21:05   ` Guenter Roeck
2012-09-01 17:02   ` Jean Delvare
2012-09-02  2:14     ` Guenter Roeck
2012-09-09 14:57 ` Geert Uytterhoeven [this message]
2012-09-09 16:17   ` Guenter Roeck
2012-09-09 20:38     ` Geert Uytterhoeven
2012-09-09 21:30       ` Guenter Roeck

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='CAMuHMdWT2xKzOY9t05mYTMjmk=-V_XQQ8mZc69eQyrDN99hMuw@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.org \
    --cc=mingo@kernel.org \
    --cc=penberg@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).