From patchwork Fri Nov 19 23:19:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 343551 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 oAJNKDKi010415 for ; Fri, 19 Nov 2010 23:20:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932381Ab0KSXUM (ORCPT ); Fri, 19 Nov 2010 18:20:12 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:51644 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932372Ab0KSXUL (ORCPT ); Fri, 19 Nov 2010 18:20:11 -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 oAJNJnCD030213 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 19 Nov 2010 15:19:49 -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 oAJNJnEF009922; Fri, 19 Nov 2010 15:19:49 -0800 Date: Fri, 19 Nov 2010 15:19:49 -0800 From: Andrew Morton To: michalj@gmail.com, 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: <20101119151949.b7e514f7.akpm@linux-foundation.org> In-Reply-To: <20101119150411.81092e94.akpm@linux-foundation.org> References: <20101119140721.33576c61.akpm@linux-foundation.org> <20101119222823.GA28797@quadria> <20101119150411.81092e94.akpm@linux-foundation.org> 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:20:14 +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,12 @@ 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 all + * input types abs() returns a signed long. + * 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)) { \