diff options
author | Damien Le Moal <dlemoal@kernel.org> | 2024-08-01 18:04:22 +0900 |
---|---|---|
committer | Damien Le Moal <dlemoal@kernel.org> | 2024-08-02 09:29:55 +0900 |
commit | bf1807c6ee1f66608c7835f6f9d9139c9c477942 (patch) | |
tree | 18162cb5508fe55efe223a58af25b77e13f43545 /drivers/ata | |
parent | b40824500eaa77668026b6d1ade6924901a680f9 (diff) | |
download | linux-stable-bf1807c6ee1f66608c7835f6f9d9139c9c477942.tar.gz linux-stable-bf1807c6ee1f66608c7835f6f9d9139c9c477942.tar.bz2 linux-stable-bf1807c6ee1f66608c7835f6f9d9139c9c477942.zip |
ata: libata: Print device quirks only once
In ata_dev_print_quirks(), return early if ata_dev_print_info() returns
false or if we already printed quirk information. This is to avoid
printing a device quirks multiple times (that is, each time
ata_dev_revalidate() is called).
To remember if ata_dev_print_quirks() was already executed, define the
EH context flag ATA_EHI_DID_PRINT_QUIRKS and set this flag in
ata_dev_print_quirks().
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: 58157d607aec ("ata: libata: Print quirks applied to devices")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b4fdb78579c8..e4023fc288ac 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -160,7 +160,7 @@ MODULE_DESCRIPTION("Library module for ATA devices"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); -static inline bool ata_dev_print_info(struct ata_device *dev) +static inline bool ata_dev_print_info(const struct ata_device *dev) { struct ata_eh_context *ehc = &dev->link->eh_context; @@ -4025,10 +4025,16 @@ static void ata_dev_print_quirks(const struct ata_device *dev, const char *model, const char *rev, unsigned int quirks) { + struct ata_eh_context *ehc = &dev->link->eh_context; int n = 0, i; size_t sz; char *str; + if (!ata_dev_print_info(dev) || ehc->i.flags & ATA_EHI_DID_PRINT_QUIRKS) + return; + + ehc->i.flags |= ATA_EHI_DID_PRINT_QUIRKS; + if (!quirks) return; |