diff options
author | Tejun Heo <tj@kernel.org> | 2010-09-06 11:56:29 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2010-10-21 20:21:05 -0400 |
commit | 97750cebb3000a9cc08f8ce8dc8c7143be7d7201 (patch) | |
tree | 04220b8a8ed3f353e3e0023805b32e7d746dc6f3 /drivers/ata/libata-core.c | |
parent | a97c40068fab5d85c4241451fc312cb9025d7e6c (diff) |
libata: add @ap to ata_wait_register() and introduce ata_msleep()
Add optional @ap argument to ata_wait_register() and replace msleep()
calls with ata_msleep() which take optional @ap in addition to the
duration. These will be used to implement EH exclusion.
This patch doesn't cause any behavior difference.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r-- | drivers/ata/libata-core.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 7c5538b9fa3b..42d9ce29f50d 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3404,7 +3404,7 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline, | |||
3404 | warned = 1; | 3404 | warned = 1; |
3405 | } | 3405 | } |
3406 | 3406 | ||
3407 | msleep(50); | 3407 | ata_msleep(link->ap, 50); |
3408 | } | 3408 | } |
3409 | } | 3409 | } |
3410 | 3410 | ||
@@ -3425,7 +3425,7 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline, | |||
3425 | int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, | 3425 | int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, |
3426 | int (*check_ready)(struct ata_link *link)) | 3426 | int (*check_ready)(struct ata_link *link)) |
3427 | { | 3427 | { |
3428 | msleep(ATA_WAIT_AFTER_RESET); | 3428 | ata_msleep(link->ap, ATA_WAIT_AFTER_RESET); |
3429 | 3429 | ||
3430 | return ata_wait_ready(link, deadline, check_ready); | 3430 | return ata_wait_ready(link, deadline, check_ready); |
3431 | } | 3431 | } |
@@ -3473,7 +3473,7 @@ int sata_link_debounce(struct ata_link *link, const unsigned long *params, | |||
3473 | last_jiffies = jiffies; | 3473 | last_jiffies = jiffies; |
3474 | 3474 | ||
3475 | while (1) { | 3475 | while (1) { |
3476 | msleep(interval); | 3476 | ata_msleep(link->ap, interval); |
3477 | if ((rc = sata_scr_read(link, SCR_STATUS, &cur))) | 3477 | if ((rc = sata_scr_read(link, SCR_STATUS, &cur))) |
3478 | return rc; | 3478 | return rc; |
3479 | cur &= 0xf; | 3479 | cur &= 0xf; |
@@ -3538,7 +3538,7 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params, | |||
3538 | * immediately after resuming. Delay 200ms before | 3538 | * immediately after resuming. Delay 200ms before |
3539 | * debouncing. | 3539 | * debouncing. |
3540 | */ | 3540 | */ |
3541 | msleep(200); | 3541 | ata_msleep(link->ap, 200); |
3542 | 3542 | ||
3543 | /* is SControl restored correctly? */ | 3543 | /* is SControl restored correctly? */ |
3544 | if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol))) | 3544 | if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol))) |
@@ -3742,7 +3742,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, | |||
3742 | /* Couldn't find anything in SATA I/II specs, but AHCI-1.1 | 3742 | /* Couldn't find anything in SATA I/II specs, but AHCI-1.1 |
3743 | * 10.4.2 says at least 1 ms. | 3743 | * 10.4.2 says at least 1 ms. |
3744 | */ | 3744 | */ |
3745 | msleep(1); | 3745 | ata_msleep(link->ap, 1); |
3746 | 3746 | ||
3747 | /* bring link back */ | 3747 | /* bring link back */ |
3748 | rc = sata_link_resume(link, timing, deadline); | 3748 | rc = sata_link_resume(link, timing, deadline); |
@@ -6483,8 +6483,14 @@ int ata_ratelimit(void) | |||
6483 | return __ratelimit(&ratelimit); | 6483 | return __ratelimit(&ratelimit); |
6484 | } | 6484 | } |
6485 | 6485 | ||
6486 | void ata_msleep(struct ata_port *ap, unsigned int msecs) | ||
6487 | { | ||
6488 | msleep(msecs); | ||
6489 | } | ||
6490 | |||
6486 | /** | 6491 | /** |
6487 | * ata_wait_register - wait until register value changes | 6492 | * ata_wait_register - wait until register value changes |
6493 | * @ap: ATA port to wait register for, can be NULL | ||
6488 | * @reg: IO-mapped register | 6494 | * @reg: IO-mapped register |
6489 | * @mask: Mask to apply to read register value | 6495 | * @mask: Mask to apply to read register value |
6490 | * @val: Wait condition | 6496 | * @val: Wait condition |
@@ -6506,7 +6512,7 @@ int ata_ratelimit(void) | |||
6506 | * RETURNS: | 6512 | * RETURNS: |
6507 | * The final register value. | 6513 | * The final register value. |
6508 | */ | 6514 | */ |
6509 | u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | 6515 | u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, |
6510 | unsigned long interval, unsigned long timeout) | 6516 | unsigned long interval, unsigned long timeout) |
6511 | { | 6517 | { |
6512 | unsigned long deadline; | 6518 | unsigned long deadline; |
@@ -6521,7 +6527,7 @@ u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | |||
6521 | deadline = ata_deadline(jiffies, timeout); | 6527 | deadline = ata_deadline(jiffies, timeout); |
6522 | 6528 | ||
6523 | while ((tmp & mask) == val && time_before(jiffies, deadline)) { | 6529 | while ((tmp & mask) == val && time_before(jiffies, deadline)) { |
6524 | msleep(interval); | 6530 | ata_msleep(ap, interval); |
6525 | tmp = ioread32(reg); | 6531 | tmp = ioread32(reg); |
6526 | } | 6532 | } |
6527 | 6533 | ||
@@ -6605,6 +6611,7 @@ EXPORT_SYMBOL_GPL(ata_std_postreset); | |||
6605 | EXPORT_SYMBOL_GPL(ata_dev_classify); | 6611 | EXPORT_SYMBOL_GPL(ata_dev_classify); |
6606 | EXPORT_SYMBOL_GPL(ata_dev_pair); | 6612 | EXPORT_SYMBOL_GPL(ata_dev_pair); |
6607 | EXPORT_SYMBOL_GPL(ata_ratelimit); | 6613 | EXPORT_SYMBOL_GPL(ata_ratelimit); |
6614 | EXPORT_SYMBOL_GPL(ata_msleep); | ||
6608 | EXPORT_SYMBOL_GPL(ata_wait_register); | 6615 | EXPORT_SYMBOL_GPL(ata_wait_register); |
6609 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); | 6616 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); |
6610 | EXPORT_SYMBOL_GPL(ata_scsi_slave_config); | 6617 | EXPORT_SYMBOL_GPL(ata_scsi_slave_config); |