diff options
author | Gabriele Mazzotta <gabriele.mzt@gmail.com> | 2015-04-25 19:52:36 +0200 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2015-05-28 09:59:57 +0100 |
commit | 9a47bdd057fa2c1c677d0208ce5c693be4169084 (patch) | |
tree | 9ae27ed40cece9bd043e572c02970b3efa4400df /drivers/ata | |
parent | 784414120d345df93a3fc3989a23a45f9ec84dad (diff) | |
download | linux-stable-9a47bdd057fa2c1c677d0208ce5c693be4169084.tar.gz linux-stable-9a47bdd057fa2c1c677d0208ce5c693be4169084.tar.bz2 linux-stable-9a47bdd057fa2c1c677d0208ce5c693be4169084.zip |
libata: Add helper to determine when PHY events should be ignored
commit 8393b811f38acdf7fd8da2028708edad3e68ce1f upstream.
This is a preparation commit that will allow to add other criteria
according to which PHY events should be dropped.
Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libahci.c | 3 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 19 |
2 files changed, 20 insertions, 2 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index d72ce0470309..86c3c24b835f 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -1712,8 +1712,7 @@ static void ahci_handle_port_interrupt(struct ata_port *ap, if (unlikely(resetting)) status &= ~PORT_IRQ_BAD_PMP; - /* if LPM is enabled, PHYRDY doesn't mean anything */ - if (ap->link.lpm_policy > ATA_LPM_MAX_POWER) { + if (sata_lpm_ignore_phy_events(&ap->link)) { status &= ~PORT_IRQ_PHYRDY; ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); } diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e1ad6e53073d..c89f10fbf169 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6813,6 +6813,25 @@ u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, return tmp; } +/** + * sata_lpm_ignore_phy_events - test if PHY event should be ignored + * @link: Link receiving the event + * + * Test whether the received PHY event has to be ignored or not. + * + * LOCKING: + * None: + * + * RETURNS: + * True if the event has to be ignored. + */ +bool sata_lpm_ignore_phy_events(struct ata_link *link) +{ + /* if LPM is enabled, PHYRDY doesn't mean anything */ + return !!(link->lpm_policy > ATA_LPM_MAX_POWER); +} +EXPORT_SYMBOL_GPL(sata_lpm_ignore_phy_events); + /* * Dummy port_ops */ |