diff options
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r-- | drivers/ata/libata-core.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4166407eb47..6f266c8179e 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); |