Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5368148rwb; Tue, 17 Jan 2023 12:46:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXuCmsv8U180YGuoQoIOp3y1FTK6Dd3trmSawP7iAEpfztNe6kLGxtWqpJF6Lu3EdW7gHGdW X-Received: by 2002:a17:907:6d0e:b0:871:7b6f:9c53 with SMTP id sa14-20020a1709076d0e00b008717b6f9c53mr5662115ejc.30.1673988382671; Tue, 17 Jan 2023 12:46:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673988382; cv=none; d=google.com; s=arc-20160816; b=rlve2nMk1LaPLU7kre6VGWfUdTb4yyJ0DdRyCDPO080kShSNWSzRyLSR0qFkxQ/P13 xbC2IWCGUyIdvvjYgDBQZ/Doecm5r7C4+dIJjvQQ4nZGUdhUFRDf4Ssj5IyXW9FdObrh MgvrzsIgH6bdLcXYHTB+kRXdIVDEToPQ9hYRDAkgbF7U0OYeXYBNjcp9pWxis7Bx+y+W cwT9XhsJywOQVVJDy+920PiwgbW0XPQ2lRouqECQr0O/Xc4vl16ECspd/0pgPYNqZbLh efojoSjE0KkI7woNNWT+EOSpWJ/zMcSMWuLBPjcou4BeG+R2U3Jlaky6dSpYT51hyXIA Dzdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Fw8ToiXtlXOF2nBnzsWFVHyxc/MXeE65vU/PQZripck=; b=v7OD3JRl8ke3ecigG+Hj0rLOUxhFdJabkLz0AzejvEpXXz1xrf7BNsawuLRopaefco WzWPM++KbXq5rUXC+6Sbo70+0wHWpoNbJxPj47/fObBq+P1YMn8HI/rWpdpWjCpdPRak zAB27p3cWYa+/NHjfhQdVQfxyyQlRfx2S9vXhlMblgKXqLakriaUjcO5xmFh6kXrCzZi U5MctxGnMrQIYvaMuW2OeIdwmoEjZBLHqXLMkosZgoJKaA+JBt7wuvkdcIOMeVSmJ68m wTOl2MpFijKIo+nz/I+EjbBalQaIIhW4qIGuldvYmreDOI2LuNM+n8tm6rcTmnWFfO0j kaNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=S+5wJzzZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a1709064fc300b007ae76a4e35fsi3301711ejw.5.2023.01.17.12.46.11; Tue, 17 Jan 2023 12:46:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=S+5wJzzZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233686AbjAQTSK (ORCPT + 47 others); Tue, 17 Jan 2023 14:18:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232575AbjAQTLD (ORCPT ); Tue, 17 Jan 2023 14:11:03 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC17E37B55; Tue, 17 Jan 2023 10:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=Fw8ToiXtlXOF2nBnzsWFVHyxc/MXeE65vU/PQZripck=; b=S+5wJzzZMBzIqx8qubJw7UJ7ri kcgS9JLFhwlxnYroTEQZrM2zugGlhdGdhGSmDgYMTebYMYdrha0PX78AvF0t3YVvgaU9qcAlk3Gs8 V0nk641gnA+KaYcK31R6HDyOy1t54OhnVurSJzYLR+ffAghX6xNqgOCydlJFzs3CDrfV1S+56keaK gNhVIzFCQ7pAzo2aXblOpFEU6r1F0IIkVVf+4MyWad+XNTuMUOF7zj7krUpO+gLB3O9+ugtm/QzEn jt9geOtAsj0YFRs6EyZvFwrSvO8GC5bvPLxHiOL5z36Q+SgRIx57ybFYH9UBvwQrCFoL8QVUEtGSo sW9UtLYA==; Received: from [2601:1c2:d80:3110::9307] by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHqdf-00FQbU-15; Tue, 17 Jan 2023 18:24:51 +0000 Message-ID: <54f13745-bec5-8777-4212-6f093947f146@infradead.org> Date: Tue, 17 Jan 2023 10:24:49 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] rtc: sunplus: fix format string for printing resource Content-Language: en-US To: Alexandre Belloni , Arnd Bergmann Cc: Vincent Shih , Alessandro Zummo , Arnd Bergmann , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230117172450.2938962-1-arnd@kernel.org> From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/17/23 09:55, Alexandre Belloni wrote: > On 17/01/2023 18:24:44+0100, Arnd Bergmann wrote: >> From: Arnd Bergmann >> >> On 32-bit architectures with 64-bit resource_size_t, sp_rtc_probe() >> causes a compiler warning: >> >> drivers/rtc/rtc-sunplus.c: In function 'sp_rtc_probe': >> drivers/rtc/rtc-sunplus.c:243:33: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=] >> 243 | dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 0x%lx\n", >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> The best way to print a resource is the special %pR format string, >> and similarly to print a pointer we can use %p and avoid the cast. >> > > I got this one this morning, which one is more correct? :) > https://lore.kernel.org/all/20230117054232.24023-1-rdunlap@infradead.org/ I prefer my handling of res->start and Arnd's no-cast handling of reg_base. IMO using "%pR" prints too much info, but that's more up to the file's author or maintainer... How's that? :) >> Fixes: fad6cbe9b2b4 ("rtc: Add driver for RTC in Sunplus SP7021") >> Signed-off-by: Arnd Bergmann >> --- >> drivers/rtc/rtc-sunplus.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/rtc/rtc-sunplus.c b/drivers/rtc/rtc-sunplus.c >> index e8e2ab1103fc..4b578e4d44f6 100644 >> --- a/drivers/rtc/rtc-sunplus.c >> +++ b/drivers/rtc/rtc-sunplus.c >> @@ -240,8 +240,8 @@ static int sp_rtc_probe(struct platform_device *plat_dev) >> if (IS_ERR(sp_rtc->reg_base)) >> return dev_err_probe(&plat_dev->dev, PTR_ERR(sp_rtc->reg_base), >> "%s devm_ioremap_resource fail\n", RTC_REG_NAME); >> - dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 0x%lx\n", >> - sp_rtc->res->start, (unsigned long)sp_rtc->reg_base); >> + dev_dbg(&plat_dev->dev, "res = %pR, reg_base = %p\n", >> + sp_rtc->res, sp_rtc->reg_base); >> >> sp_rtc->irq = platform_get_irq(plat_dev, 0); >> if (sp_rtc->irq < 0) >> -- >> 2.39.0 >> > -- ~Randy