diff options
author | Tejun Heo <htejun@gmail.com> | 2007-10-09 02:06:10 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:47 -0400 |
commit | afaa5c373d2c49ee4865847031b82f1377f609d0 (patch) | |
tree | 785203bd4538d2e3c36622ebc2eac93652c7e19e | |
parent | 2b789108fc1dcba22050a7e6e29ae5ebaea427dd (diff) |
libata: implement ATA_PFLAG_RESETTING
Implement ATA_PFLAG_RESETTING. This flag is set while reset is in
progress. It's set before prereset is called and cleared after reset
fails or postreset is finished.
This flag itself doesn't have any function. It will be used by LLDs
to tell whether reset is in progress if it needs to behave differently
during reset.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/libata-eh.c | 11 | ||||
-rw-r--r-- | include/linux/libata.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c0e9a42e6ae7..1f84e40fa6ae 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2063,6 +2063,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2063 | ata_prereset_fn_t prereset, ata_reset_fn_t softreset, | 2063 | ata_prereset_fn_t prereset, ata_reset_fn_t softreset, |
2064 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) | 2064 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) |
2065 | { | 2065 | { |
2066 | struct ata_port *ap = link->ap; | ||
2066 | struct ata_eh_context *ehc = &link->eh_context; | 2067 | struct ata_eh_context *ehc = &link->eh_context; |
2067 | unsigned int *classes = ehc->classes; | 2068 | unsigned int *classes = ehc->classes; |
2068 | int verbose = !(ehc->i.flags & ATA_EHI_QUIET); | 2069 | int verbose = !(ehc->i.flags & ATA_EHI_QUIET); |
@@ -2071,9 +2072,14 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2071 | unsigned long deadline; | 2072 | unsigned long deadline; |
2072 | unsigned int action; | 2073 | unsigned int action; |
2073 | ata_reset_fn_t reset; | 2074 | ata_reset_fn_t reset; |
2075 | unsigned long flags; | ||
2074 | int rc; | 2076 | int rc; |
2075 | 2077 | ||
2076 | /* about to reset */ | 2078 | /* about to reset */ |
2079 | spin_lock_irqsave(ap->lock, flags); | ||
2080 | ap->pflags |= ATA_PFLAG_RESETTING; | ||
2081 | spin_unlock_irqrestore(ap->lock, flags); | ||
2082 | |||
2077 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); | 2083 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); |
2078 | 2084 | ||
2079 | /* Determine which reset to use and record in ehc->i.action. | 2085 | /* Determine which reset to use and record in ehc->i.action. |
@@ -2231,6 +2237,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2231 | out: | 2237 | out: |
2232 | /* clear hotplug flag */ | 2238 | /* clear hotplug flag */ |
2233 | ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; | 2239 | ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; |
2240 | |||
2241 | spin_lock_irqsave(ap->lock, flags); | ||
2242 | ap->pflags &= ~ATA_PFLAG_RESETTING; | ||
2243 | spin_unlock_irqrestore(ap->lock, flags); | ||
2244 | |||
2234 | return rc; | 2245 | return rc; |
2235 | } | 2246 | } |
2236 | 2247 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 751aabc21a3e..529af9fbed53 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -210,6 +210,7 @@ enum { | |||
210 | ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */ | 210 | ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */ |
211 | ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ | 211 | ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ |
212 | ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ | 212 | ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ |
213 | ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */ | ||
213 | 214 | ||
214 | ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ | 215 | ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ |
215 | ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ | 216 | ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ |