Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f9c1ea2 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik
Browse files

libata: clear ering on resume



Error timestamps are in jiffies which doesn't run while suspended and
PHY events during resume isn't too uncommon.  When the two are
combined, it can lead to unnecessary speed downs if the machine is
suspended and resumed repeatedly.  Clear error history on resume.

This was reported and verified in bnc#486803 by Vladimir Botka.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Reported-by: default avatarVladimir Botka <vbotka@novell.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 6ad58b24
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -3507,6 +3507,8 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
 */
 */
static void ata_eh_handle_port_resume(struct ata_port *ap)
static void ata_eh_handle_port_resume(struct ata_port *ap)
{
{
	struct ata_link *link;
	struct ata_device *dev;
	unsigned long flags;
	unsigned long flags;
	int rc = 0;
	int rc = 0;


@@ -3521,6 +3523,17 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)


	WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED));
	WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED));


	/*
	 * Error timestamps are in jiffies which doesn't run while
	 * suspended and PHY events during resume isn't too uncommon.
	 * When the two are combined, it can lead to unnecessary speed
	 * downs if the machine is suspended and resumed repeatedly.
	 * Clear error history.
	 */
	ata_for_each_link(link, ap, HOST_FIRST)
		ata_for_each_dev(dev, link, ALL)
			ata_ering_clear(&dev->ering);

	ata_acpi_set_state(ap, PMSG_ON);
	ata_acpi_set_state(ap, PMSG_ON);


	if (ap->ops->port_resume)
	if (ap->ops->port_resume)