[PATCH] libata: implement ATA_EHI_RESUME_LINK

Implement ATA_EHI_RESUME_LINK, which indicates that the link needs to
be resumed. This used to be implied by ATA_EHI_HOTPLUGGED. However,
hotplug isn't the only event which requires link resume and separating
this out allows other places to request link resume. This
differentiation also allows better debounce timing selection.

This patch converts user scan to use ATA_EHI_RESUME_LINK.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by Tejun Heo and committed by Jeff Garzik 28324304 e30349d2

+11 -8
+8 -7
drivers/scsi/libata-core.c
··· 2627 2627 const unsigned long *timing; 2628 2628 int rc; 2629 2629 2630 - /* hotplug? */ 2631 - if (ehc->i.flags & ATA_EHI_HOTPLUGGED) { 2632 - if (ap->flags & ATA_FLAG_HRST_TO_RESUME) 2633 - ehc->i.action |= ATA_EH_HARDRESET; 2634 - if (ap->flags & ATA_FLAG_SKIP_D2H_BSY) 2635 - ata_wait_spinup(ap); 2636 - } 2630 + /* handle link resume & hotplug spinup */ 2631 + if ((ehc->i.flags & ATA_EHI_RESUME_LINK) && 2632 + (ap->flags & ATA_FLAG_HRST_TO_RESUME)) 2633 + ehc->i.action |= ATA_EH_HARDRESET; 2634 + 2635 + if ((ehc->i.flags & ATA_EHI_HOTPLUGGED) && 2636 + (ap->flags & ATA_FLAG_SKIP_D2H_BSY)) 2637 + ata_wait_spinup(ap); 2637 2638 2638 2639 /* if we're about to do hardreset, nothing more to do */ 2639 2640 if (ehc->i.action & ATA_EH_HARDRESET)
+1
drivers/scsi/libata-scsi.c
··· 3011 3011 if (dev) { 3012 3012 ap->eh_info.probe_mask |= 1 << dev->devno; 3013 3013 ap->eh_info.action |= ATA_EH_SOFTRESET; 3014 + ap->eh_info.flags |= ATA_EHI_RESUME_LINK; 3014 3015 } else 3015 3016 rc = -EINVAL; 3016 3017 }
+2 -1
include/linux/libata.h
··· 259 259 260 260 /* ata_eh_info->flags */ 261 261 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 262 + ATA_EHI_RESUME_LINK = (1 << 1), /* need to resume link */ 262 263 263 264 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 264 265 ··· 837 836 if (ehi->flags & ATA_EHI_HOTPLUGGED) 838 837 return; 839 838 840 - ehi->flags |= ATA_EHI_HOTPLUGGED; 839 + ehi->flags |= ATA_EHI_HOTPLUGGED | ATA_EHI_RESUME_LINK; 841 840 ehi->hotplug_timestamp = jiffies; 842 841 843 842 ehi->err_mask |= AC_ERR_ATA_BUS;