/* ata_std_prereset - prepare for reset  ATA link to be reset @deadline: deadline jiffies for the operation */
int ata_std_prereset(struct ata_link *link, unsigned long deadline)
/* ata_std_prereset - prepare for reset  ATA link to be reset @deadline: deadline jiffies for the operation */
int ata_std_prereset(struct ata_link *link, unsigned long deadline)
{
	struct ata_port *ap = link->ap;
	struct ata_eh_context *ehc = &link->eh_context;
	const unsigned long *timing = sata_ehc_deb_timing(ehc);
	int rc;
	if (ehc->i.action & ATA_EH_HARDRESET)
		return 0;
	if (ap->flags & ATA_FLAG_SATA) {
		rc = sata_link_resume(link, timing, deadline);
		if (rc && rc != -EOPNOTSUPP)
			ata_link_printk(link, KERN_WARNING, "failed to resume "
					"link for reset (errno=%d)\n", rc);
	}
	if (ata_phys_link_offline(link))
		ehc->i.action &= ~ATA_EH_SOFTRESET;
	return 0;
}