From: Damien Le Moal <dlemoal@kernel.org>
To: Heiner Kallweit <hkallweit1@gmail.com>,
Niklas Cassel <cassel@kernel.org>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH] ata: libata-core: Simplify ata_print_version_once
Date: Fri, 11 Apr 2025 09:00:34 +0900 [thread overview]
Message-ID: <95ca32e1-6c90-4a31-8a54-c997a6653a1c@kernel.org> (raw)
In-Reply-To: <f9e7276d-d9f9-47cd-8b9b-5dc85567489a@gmail.com>
On 4/11/25 06:45, Heiner Kallweit wrote:
> Use dev_dbg_once() instead of open-coding the once functionality.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/ata/libata-core.c | 6 +++---
> include/linux/libata.h | 13 +------------
> 2 files changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 773799cfd..e58a22e83 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -6682,11 +6682,11 @@ const struct ata_port_info ata_dummy_port_info = {
> };
> EXPORT_SYMBOL_GPL(ata_dummy_port_info);
>
> -void ata_print_version(const struct device *dev, const char *version)
> +void ata_print_version_once(const struct device *dev, const char *version)
> {
> - dev_printk(KERN_DEBUG, dev, "version %s\n", version);
> + dev_dbg_once(dev, "version %s\n", version);
> }
> -EXPORT_SYMBOL(ata_print_version);
> +EXPORT_SYMBOL(ata_print_version_once);
Overall, looks good, but I really do not see the point of having this as an
exported function. So while at it, can you change it to be inline in libata.h ?
>
> EXPORT_TRACEPOINT_SYMBOL_GPL(ata_tf_load);
> EXPORT_TRACEPOINT_SYMBOL_GPL(ata_exec_command);
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index e5695998a..02c9f621e 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -41,16 +41,7 @@
> */
> #undef ATA_IRQ_TRAP /* define to ack screaming irqs */
>
> -
> -#define ata_print_version_once(dev, version) \
> -({ \
> - static bool __print_once; \
> - \
> - if (!__print_once) { \
> - __print_once = true; \
> - ata_print_version(dev, version); \
> - } \
> -})
> +void ata_print_version_once(const struct device *dev, const char *version);
>
> /* defines only for the constants which don't work well as enums */
> #define ATA_TAG_POISON 0xfafbfcfdU
> @@ -1593,8 +1584,6 @@ do { \
> #define ata_dev_dbg(dev, fmt, ...) \
> ata_dev_printk(debug, dev, fmt, ##__VA_ARGS__)
>
> -void ata_print_version(const struct device *dev, const char *version);
> -
> /*
> * ata_eh_info helpers
> */
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-04-11 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 21:45 [PATCH] ata: libata-core: Simplify ata_print_version_once Heiner Kallweit
2025-04-11 0:00 ` Damien Le Moal [this message]
2025-04-11 5:43 ` Heiner Kallweit
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=95ca32e1-6c90-4a31-8a54-c997a6653a1c@kernel.org \
--to=dlemoal@kernel.org \
--cc=cassel@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=linux-ide@vger.kernel.org \
/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