Commit bf1807c6 authored by Damien Le Moal's avatar Damien Le Moal

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: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Fixes: 58157d60 ("ata: libata: Print quirks applied to devices")
Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
parent b4082450
...@@ -160,7 +160,7 @@ MODULE_DESCRIPTION("Library module for ATA devices"); ...@@ -160,7 +160,7 @@ MODULE_DESCRIPTION("Library module for ATA devices");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION); 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; struct ata_eh_context *ehc = &dev->link->eh_context;
...@@ -4025,10 +4025,16 @@ static void ata_dev_print_quirks(const struct ata_device *dev, ...@@ -4025,10 +4025,16 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
const char *model, const char *rev, const char *model, const char *rev,
unsigned int quirks) unsigned int quirks)
{ {
struct ata_eh_context *ehc = &dev->link->eh_context;
int n = 0, i; int n = 0, i;
size_t sz; size_t sz;
char *str; 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) if (!quirks)
return; return;
......
...@@ -378,6 +378,7 @@ enum { ...@@ -378,6 +378,7 @@ enum {
ATA_EHI_PRINTINFO = (1 << 18), /* print configuration info */ ATA_EHI_PRINTINFO = (1 << 18), /* print configuration info */
ATA_EHI_SETMODE = (1 << 19), /* configure transfer mode */ ATA_EHI_SETMODE = (1 << 19), /* configure transfer mode */
ATA_EHI_POST_SETMODE = (1 << 20), /* revalidating after setmode */ ATA_EHI_POST_SETMODE = (1 << 20), /* revalidating after setmode */
ATA_EHI_DID_PRINT_QUIRKS = (1 << 21), /* already printed quirks info */
ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment