diff options
author | Niklas Cassel <niklas.cassel@wdc.com> | 2022-10-07 16:23:38 +0300 |
---|---|---|
committer | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-10-18 07:53:27 +0300 |
commit | 4cb7c6f1ef9642cd2c8580b495fde47ffbaddef7 (patch) | |
tree | 86895369e211cbf8def44a05346e994adfe1d43d /drivers/ata/libata-eh.c | |
parent | fddb1a6424787d8089a9032bd5d21c428670f854 (diff) | |
download | linux-4cb7c6f1ef9642cd2c8580b495fde47ffbaddef7.tar.xz |
ata: make use of ata_port_is_frozen() helper
Clean up the code by making use of the newly introduced
ata_port_is_frozen() helper function.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index b08d02afce86..bde15f855f70 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -1406,7 +1406,7 @@ static void ata_eh_request_sense(struct ata_queued_cmd *qc) struct ata_taskfile tf; unsigned int err_mask; - if (qc->ap->pflags & ATA_PFLAG_FROZEN) { + if (ata_port_is_frozen(qc->ap)) { ata_dev_warn(dev, "sense data available but port frozen\n"); return; } @@ -1596,7 +1596,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc) break; case ATA_DEV_ATAPI: - if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { + if (!ata_port_is_frozen(qc->ap)) { tmp = atapi_eh_request_sense(qc->dev, qc->scsicmd->sense_buffer, qc->result_tf.error >> 4); @@ -2003,7 +2003,7 @@ static void ata_eh_link_autopsy(struct ata_link *link) ehc->i.flags |= ATA_EHI_QUIET; /* enforce default EH actions */ - if (ap->pflags & ATA_PFLAG_FROZEN || + if (ata_port_is_frozen(ap) || all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) ehc->i.action |= ATA_EH_RESET; else if (((eflags & ATA_EFLAG_IS_IO) && all_err_mask) || @@ -2246,7 +2246,7 @@ static void ata_eh_link_report(struct ata_link *link) return; frozen = ""; - if (ap->pflags & ATA_PFLAG_FROZEN) + if (ata_port_is_frozen(ap)) frozen = " frozen"; if (ap->eh_tries < ATA_EH_MAX_TRIES) @@ -2567,8 +2567,7 @@ int ata_eh_reset(struct ata_link *link, int classify, if (reset && !(ehc->i.action & ATA_EH_RESET)) { ata_for_each_dev(dev, link, ALL) classes[dev->devno] = ATA_DEV_NONE; - if ((ap->pflags & ATA_PFLAG_FROZEN) && - ata_is_host_link(link)) + if (ata_port_is_frozen(ap) && ata_is_host_link(link)) ata_eh_thaw_port(ap); rc = 0; goto out; @@ -2726,7 +2725,7 @@ int ata_eh_reset(struct ata_link *link, int classify, ap->pflags &= ~ATA_PFLAG_EH_PENDING; spin_unlock_irqrestore(link->ap->lock, flags); - if (ap->pflags & ATA_PFLAG_FROZEN) + if (ata_port_is_frozen(ap)) ata_eh_thaw_port(ap); /* @@ -3233,7 +3232,7 @@ static int ata_eh_maybe_retry_flush(struct ata_device *dev) if (err_mask & AC_ERR_DEV) { qc->err_mask |= AC_ERR_DEV; qc->result_tf = tf; - if (!(ap->pflags & ATA_PFLAG_FROZEN)) + if (!ata_port_is_frozen(ap)) rc = 0; } } @@ -3410,7 +3409,7 @@ static int ata_eh_skip_recovery(struct ata_link *link) return 1; /* thaw frozen port and recover failed devices */ - if ((ap->pflags & ATA_PFLAG_FROZEN) || ata_link_nr_enabled(link)) + if (ata_port_is_frozen(ap) || ata_link_nr_enabled(link)) return 0; /* reset at least once if reset is requested */ @@ -3765,7 +3764,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, if (dev) ata_eh_handle_dev_fail(dev, rc); - if (ap->pflags & ATA_PFLAG_FROZEN) { + if (ata_port_is_frozen(ap)) { /* PMP reset requires working host port. * Can't retry if it's frozen. */ @@ -3939,7 +3938,7 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap) ap->pflags &= ~ATA_PFLAG_PM_PENDING; if (rc == 0) ap->pflags |= ATA_PFLAG_SUSPENDED; - else if (ap->pflags & ATA_PFLAG_FROZEN) + else if (ata_port_is_frozen(ap)) ata_port_schedule_eh(ap); spin_unlock_irqrestore(ap->lock, flags); |