From: Randy Dunlap <rdunlap@infradead.org>
To: Arnd Bergmann <arnd@arndb.de>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Arnd Bergmann <arnd@kernel.org>
Cc: Vincent Shih <vincent.sunplus@gmail.com>,
Alessandro Zummo <a.zummo@towertech.it>,
linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: sunplus: fix format string for printing resource
Date: Tue, 17 Jan 2023 16:56:36 -0800 [thread overview]
Message-ID: <19d40c05-4e97-a739-47b4-689b047841fc@infradead.org> (raw)
In-Reply-To: <589415b2-ddf2-44e5-bca5-5971f8ab9576@app.fastmail.com>
On 1/17/23 11:36, Arnd Bergmann wrote:
> On Tue, Jan 17, 2023, at 19:24, Randy Dunlap wrote:
>> On 1/17/23 09:55, Alexandre Belloni wrote:
>>> On 17/01/2023 18:24:44+0100, Arnd Bergmann wrote:
>>>> From: Arnd Bergmann <arnd@arndb.de>
>>>>
>>>> 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/
>
> Both are equally correct, it's just a preference.
>
>> 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...
>
> Right, I could have equally well picked the %pap version, and just
> went for brevity in the source. It's only pr_debug(), so very few
> users are going to actually see the output.
Alexandre, sounds like you should just go with Arnd's patch.
--
~Randy
next prev parent reply other threads:[~2023-01-18 1:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 17:24 Arnd Bergmann
2023-01-17 17:55 ` Alexandre Belloni
2023-01-17 18:24 ` Randy Dunlap
2023-01-17 19:36 ` Arnd Bergmann
2023-01-18 0:56 ` Randy Dunlap [this message]
2023-01-23 22:34 ` Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19d40c05-4e97-a739-47b4-689b047841fc@infradead.org \
--to=rdunlap@infradead.org \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=vincent.sunplus@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®