From patchwork Fri Nov 19 23:04:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 343481 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAJN4Ycp002091 for ; Fri, 19 Nov 2010 23:04:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757333Ab0KSXEc (ORCPT ); Fri, 19 Nov 2010 18:04:32 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:49721 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757006Ab0KSXEc (ORCPT ); Fri, 19 Nov 2010 18:04:32 -0500 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.14.2/Debian-2build1) with ESMTP id oAJN4BB0028444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 19 Nov 2010 15:04:11 -0800 Received: from akpm.mtv.corp.google.com (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with SMTP id oAJN4BYP008924; Fri, 19 Nov 2010 15:04:11 -0800 Date: Fri, 19 Nov 2010 15:04:11 -0800 From: Andrew Morton To: michalj@gmail.com Cc: Geert Uytterhoeven , Rolf Eike Beer , linux-kernel@vger.kernel.org, Linux Fbdev development list Subject: Re: abs() vs. abs64() (was: Re: [PATCH] fbdev: fix nearest mode search) Message-Id: <20101119150411.81092e94.akpm@linux-foundation.org> In-Reply-To: <20101119222823.GA28797@quadria> References: <20101119140721.33576c61.akpm@linux-foundation.org> <20101119222823.GA28797@quadria> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Spam-Status: No, hits=-4.49 required=5 tests=AWL, BAYES_00, PATCH_SUBJECT_OSDL X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 19 Nov 2010 23:04:34 +0000 (UTC) --- a/include/linux/kernel.h~include-linux-kernelh-abs-fix-handling-of-32-bit-unsigneds-on-64-bit-fix +++ a/include/linux/kernel.h @@ -143,6 +143,13 @@ extern int _cond_resched(void); #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) +/* + * abs() handles unsigned and signed longs, ints, shorts and chars. For long + * types it returns a signed long. For int, short and char types it returns a + * signed int. + * abs() should not be used for 64-bit types (s64, u64, long long) - use abs64() + * for those. + */ #define abs(x) ({ \ long ret; \ if (sizeof(x) == sizeof(long)) { \