From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Landley Subject: Re: [PATCH v2] lib: vsprintf: Add %pa format specifier for phys_addr_t types Date: Wed, 06 Feb 2013 22:39:39 -0600 Message-ID: <1360211979.12062.20@driftwood> References: <1358900093-16412-1-git-send-email-stepanm@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Transfer-Encoding: 8BIT Return-path: Received: from mail-ie0-f182.google.com ([209.85.223.182]:62611 "EHLO mail-ie0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751846Ab3BGEjq convert rfc822-to-8bit (ORCPT ); Wed, 6 Feb 2013 23:39:46 -0500 Received: by mail-ie0-f182.google.com with SMTP id k14so2960784iea.41 for ; Wed, 06 Feb 2013 20:39:45 -0800 (PST) In-Reply-To: <1358900093-16412-1-git-send-email-stepanm@codeaurora.org> (from stepanm@codeaurora.org on Tue Jan 22 18:14:53 2013) Content-Disposition: inline Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org Cc: Andrew Morton , George Spelvin , Andy Shevchenko , Stephen Boyd , Andrei Emeltchenko , mingo@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stepan Moskovchenko On 01/22/2013 06:14:53 PM, Stepan Moskovchenko wrote: > Add the %pa format specifier for printing a phys_addr_t > type and its derivative types (such as resource_size_t), > since the physical address size on some platforms can vary > based on build options, regardless of the native integer > type. > > Signed-off-by: Stepan Moskovchenko Ok, I know I'm late to the party, but doesn't LP64 apply here? Are we really capable of building on a target where "long" and "pointer" are different sizes? Last I checked the kernel was full of that assumption because there was an actual standard and we demanded that the compiler building us comply with it, just like MacOS X and the BSDs do: Standard: http://www.unix.org/whitepapers/64bit.html Rationale: http://www.unix.org/version2/whatsnew/lp64_wp.html Insane legacy reasons Windows decided to be "special": http://blogs.msdn.com/oldnewthing/archive/2005/01/31/363790.aspx Thus "unsigned long" should by definition be big enough. Using unsigned long long means you're doing 64 bit math on 32 bit targets for no apparent reason. What did I miss? Rob From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757698Ab3BGEjs (ORCPT ); Wed, 6 Feb 2013 23:39:48 -0500 Received: from mail-ia0-f178.google.com ([209.85.210.178]:46910 "EHLO mail-ia0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751472Ab3BGEjq convert rfc822-to-8bit (ORCPT ); Wed, 6 Feb 2013 23:39:46 -0500 Date: Wed, 06 Feb 2013 22:39:39 -0600 From: Rob Landley Subject: Re: [PATCH v2] lib: vsprintf: Add %pa format specifier for phys_addr_t types To: Stepan Moskovchenko Cc: Andrew Morton , George Spelvin , Andy Shevchenko , Stephen Boyd , Andrei Emeltchenko , mingo@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stepan Moskovchenko In-Reply-To: <1358900093-16412-1-git-send-email-stepanm@codeaurora.org> (from stepanm@codeaurora.org on Tue Jan 22 18:14:53 2013) X-Mailer: Balsa 2.4.11 Message-Id: <1360211979.12062.20@driftwood> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/22/2013 06:14:53 PM, Stepan Moskovchenko wrote: > Add the %pa format specifier for printing a phys_addr_t > type and its derivative types (such as resource_size_t), > since the physical address size on some platforms can vary > based on build options, regardless of the native integer > type. > > Signed-off-by: Stepan Moskovchenko Ok, I know I'm late to the party, but doesn't LP64 apply here? Are we really capable of building on a target where "long" and "pointer" are different sizes? Last I checked the kernel was full of that assumption because there was an actual standard and we demanded that the compiler building us comply with it, just like MacOS X and the BSDs do: Standard: http://www.unix.org/whitepapers/64bit.html Rationale: http://www.unix.org/version2/whatsnew/lp64_wp.html Insane legacy reasons Windows decided to be "special": http://blogs.msdn.com/oldnewthing/archive/2005/01/31/363790.aspx Thus "unsigned long" should by definition be big enough. Using unsigned long long means you're doing 64 bit math on 32 bit targets for no apparent reason. What did I miss? Rob