From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>
Cc: linux-ide@vger.kernel.org, xxjack12xx@gmail.com
Subject: Re: [PATCH 1/3] ata: libata: Move quirk flags to their own enum
Date: Tue, 25 Nov 2025 13:29:36 +0900 [thread overview]
Message-ID: <78445daf-ed42-4f40-bb14-8373d7c1ab1e@kernel.org> (raw)
In-Reply-To: <20251124134414.3057512-6-cassel@kernel.org>
On 11/24/25 10:44 PM, Niklas Cassel wrote:
> The anonymous enum in include/linux/libata.h that is used to store various
> global constants can currently be backed by type int.
> (It contains both negative and positive constants.)
>
> __ATA_QUIRK_MAX is currently 31.
> The quirk flags in the various global constants enum are defined as
> "1U << quirk_flag_bit".
>
> Thus if we simply add an additional quirk, the quirk flag will be 1 << 31,
> which is a value that is too large to be represented by a signed int.
> The various global constants enum will thus therefore be backed by type
> long.
>
> This will lead to error prints like e.g.:
> ata_port_err(ap, "EH pending after %d tries, giving up\n",
> ATA_EH_MAX_TRIES);
>
> now failing to build, with build error:
> error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Werror=format=]
>
> This is because all other constants in the various global constants enum
> now has to be printed as a long.
>
> Move the quirk flags to a separate enum, so that we don't need to change
> the printf specifier for all other constants in the "various global
> constants" enum when adding an additional quirk.
>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-11-25 4:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 13:44 [PATCH 0/3] ata: libata: Quirk DELLBOSS VD MV.R00-0 max_sectors Niklas Cassel
2025-11-24 13:44 ` [PATCH 1/3] ata: libata: Move quirk flags to their own enum Niklas Cassel
2025-11-25 4:29 ` Damien Le Moal [this message]
2025-11-24 13:44 ` [PATCH 2/3] ata: libata-core: Quirk DELLBOSS VD MV.R00-0 max_sectors Niklas Cassel
2025-11-24 14:09 ` Niklas Cassel
2025-11-24 20:51 ` Jack L.
2025-11-25 0:00 ` Jack L.
2025-11-25 0:20 ` Damien Le Moal
2025-11-24 13:44 ` [PATCH 3/3] ata: libata: Allow more quirks Niklas Cassel
2025-11-25 4:30 ` Damien Le Moal
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=78445daf-ed42-4f40-bb14-8373d7c1ab1e@kernel.org \
--to=dlemoal@kernel.org \
--cc=cassel@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=xxjack12xx@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