From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752481AbbJGKpZ (ORCPT ); Wed, 7 Oct 2015 06:45:25 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:45029 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750967AbbJGKpY (ORCPT ); Wed, 7 Oct 2015 06:45:24 -0400 Date: Wed, 7 Oct 2015 11:45:02 +0100 From: Russell King - ARM Linux To: Arnd Bergmann Cc: Dave Airlie , Gerd Hoffmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH] drm/virtio: use %llu format string form atomic64_t Message-ID: <20151007104502.GH21513@n2100.arm.linux.org.uk> References: <5082760.FgB9zHNfte@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5082760.FgB9zHNfte@wuerfel> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 07, 2015 at 12:41:21PM +0200, Arnd Bergmann wrote: > The virtgpu driver prints the last_seq variable using the %ld or > %lu format string, which does not work correctly on all architectures > and causes this compiler warning on ARM: > > drivers/gpu/drm/virtio/virtgpu_fence.c: In function 'virtio_timeline_value_str': > drivers/gpu/drm/virtio/virtgpu_fence.c:64:22: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'long long int' [-Wformat=] > snprintf(str, size, "%lu", atomic64_read(&fence->drv->last_seq)); > ^ > drivers/gpu/drm/virtio/virtgpu_debugfs.c: In function 'virtio_gpu_debugfs_irq_info': > drivers/gpu/drm/virtio/virtgpu_debugfs.c:37:16: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'long long int' [-Wformat=] > seq_printf(m, "fence %ld %lld\n", > ^ > > In order to avoid the warnings, this changes the format strings to %llu > and adds a cast to u64, which makes it work the same way everywhere. You have to wonder why atomic64_* functions do not use u64 types. If they're not reliant on manipulating 64-bit quantities, then what's the point of calling them atomic _64_. -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.