diff options
author | Tejun Heo <htejun@gmail.com> | 2007-05-14 14:28:15 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-05-16 01:18:30 -0400 |
commit | fe30911b34098db58c21d0f936f6c3f17f32deb8 (patch) | |
tree | 70cca4ffb94f5f34650c30c68d46173505ee890f /drivers/ata | |
parent | d1c68fa6ce7e56e300d8561bb3b6492c336df863 (diff) |
libata: separate out ata_dev_reread_id()
Separate out ata_dev_reread_id() from ata_dev_revalidate().
ata_dev_reread_id() reads IDENTIFY page and determines whether the
same device is still there. ata_dev_revalidate() reconfigures after
reread completes. This will be used by ACPI update.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 47 | ||||
-rw-r--r-- | drivers/ata/libata.h | 3 |
2 files changed, 36 insertions, 14 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4166407eb47c..6f266c8179ec 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3675,8 +3675,8 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, | |||
3675 | } | 3675 | } |
3676 | 3676 | ||
3677 | /** | 3677 | /** |
3678 | * ata_dev_revalidate - Revalidate ATA device | 3678 | * ata_dev_reread_id - Re-read IDENTIFY data |
3679 | * @dev: device to revalidate | 3679 | * @adev: target ATA device |
3680 | * @readid_flags: read ID flags | 3680 | * @readid_flags: read ID flags |
3681 | * | 3681 | * |
3682 | * Re-read IDENTIFY page and make sure @dev is still attached to | 3682 | * Re-read IDENTIFY page and make sure @dev is still attached to |
@@ -3688,29 +3688,50 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, | |||
3688 | * RETURNS: | 3688 | * RETURNS: |
3689 | * 0 on success, negative errno otherwise | 3689 | * 0 on success, negative errno otherwise |
3690 | */ | 3690 | */ |
3691 | int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags) | 3691 | int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags) |
3692 | { | 3692 | { |
3693 | unsigned int class = dev->class; | 3693 | unsigned int class = dev->class; |
3694 | u16 *id = (void *)dev->ap->sector_buf; | 3694 | u16 *id = (void *)dev->ap->sector_buf; |
3695 | int rc; | 3695 | int rc; |
3696 | 3696 | ||
3697 | if (!ata_dev_enabled(dev)) { | ||
3698 | rc = -ENODEV; | ||
3699 | goto fail; | ||
3700 | } | ||
3701 | |||
3702 | /* read ID data */ | 3697 | /* read ID data */ |
3703 | rc = ata_dev_read_id(dev, &class, readid_flags, id); | 3698 | rc = ata_dev_read_id(dev, &class, readid_flags, id); |
3704 | if (rc) | 3699 | if (rc) |
3705 | goto fail; | 3700 | return rc; |
3706 | 3701 | ||
3707 | /* is the device still there? */ | 3702 | /* is the device still there? */ |
3708 | if (!ata_dev_same_device(dev, class, id)) { | 3703 | if (!ata_dev_same_device(dev, class, id)) |
3709 | rc = -ENODEV; | 3704 | return -ENODEV; |
3710 | goto fail; | ||
3711 | } | ||
3712 | 3705 | ||
3713 | memcpy(dev->id, id, sizeof(id[0]) * ATA_ID_WORDS); | 3706 | memcpy(dev->id, id, sizeof(id[0]) * ATA_ID_WORDS); |
3707 | return 0; | ||
3708 | } | ||
3709 | |||
3710 | /** | ||
3711 | * ata_dev_revalidate - Revalidate ATA device | ||
3712 | * @dev: device to revalidate | ||
3713 | * @readid_flags: read ID flags | ||
3714 | * | ||
3715 | * Re-read IDENTIFY page, make sure @dev is still attached to the | ||
3716 | * port and reconfigure it according to the new IDENTIFY page. | ||
3717 | * | ||
3718 | * LOCKING: | ||
3719 | * Kernel thread context (may sleep) | ||
3720 | * | ||
3721 | * RETURNS: | ||
3722 | * 0 on success, negative errno otherwise | ||
3723 | */ | ||
3724 | int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags) | ||
3725 | { | ||
3726 | int rc; | ||
3727 | |||
3728 | if (!ata_dev_enabled(dev)) | ||
3729 | return -ENODEV; | ||
3730 | |||
3731 | /* re-read ID */ | ||
3732 | rc = ata_dev_reread_id(dev, readid_flags); | ||
3733 | if (rc) | ||
3734 | goto fail; | ||
3714 | 3735 | ||
3715 | /* configure device according to the new ID */ | 3736 | /* configure device according to the new ID */ |
3716 | rc = ata_dev_configure(dev); | 3737 | rc = ata_dev_configure(dev); |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 8b71b73a199c..13cb0c9af68d 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -76,7 +76,8 @@ extern unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
76 | extern unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd); | 76 | extern unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd); |
77 | extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | 77 | extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, |
78 | unsigned int flags, u16 *id); | 78 | unsigned int flags, u16 *id); |
79 | extern int ata_dev_revalidate(struct ata_device *dev, unsigned int flags); | 79 | extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags); |
80 | extern int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags); | ||
80 | extern int ata_dev_configure(struct ata_device *dev); | 81 | extern int ata_dev_configure(struct ata_device *dev); |
81 | extern int sata_down_spd_limit(struct ata_port *ap); | 82 | extern int sata_down_spd_limit(struct ata_port *ap); |
82 | extern int sata_set_spd_needed(struct ata_port *ap); | 83 | extern int sata_set_spd_needed(struct ata_port *ap); |