diff options
author | Tejun Heo <htejun@gmail.com> | 2006-03-01 02:09:35 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-03 17:31:04 -0500 |
commit | d9572b1d5e60b63e27e17f1f7771c5a26dd5d81e (patch) | |
tree | d102151d0e1b4014c920def6a3257f031ffd56d6 /drivers/scsi/libata-core.c | |
parent | d133ecab8ff1233c2eb3ecb94f7956aa10002300 (diff) |
[PATCH] libata: convert dev->id to pointer
Convert dev->id from array to pointer. This is to accomodate
revalidation. During revalidation, both old and new IDENTIFY pages
should be accessible and single ->id array doesn't cut it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index e34b421eb2a3..fecda706d85f 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -911,7 +911,7 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
911 | * @dev: target device | 911 | * @dev: target device |
912 | * @p_class: pointer to class of the target device (may be changed) | 912 | * @p_class: pointer to class of the target device (may be changed) |
913 | * @post_reset: is this read ID post-reset? | 913 | * @post_reset: is this read ID post-reset? |
914 | * @id: buffer to fill IDENTIFY page into | 914 | * @p_id: read IDENTIFY page (newly allocated) |
915 | * | 915 | * |
916 | * Read ID data from the specified device. ATA_CMD_ID_ATA is | 916 | * Read ID data from the specified device. ATA_CMD_ID_ATA is |
917 | * performed on ATA devices and ATA_CMD_ID_ATAPI on ATAPI | 917 | * performed on ATA devices and ATA_CMD_ID_ATAPI on ATAPI |
@@ -926,12 +926,13 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
926 | * 0 on success, -errno otherwise. | 926 | * 0 on success, -errno otherwise. |
927 | */ | 927 | */ |
928 | static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | 928 | static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, |
929 | unsigned int *p_class, int post_reset, u16 *id) | 929 | unsigned int *p_class, int post_reset, u16 **p_id) |
930 | { | 930 | { |
931 | unsigned int class = *p_class; | 931 | unsigned int class = *p_class; |
932 | unsigned int using_edd; | 932 | unsigned int using_edd; |
933 | struct ata_taskfile tf; | 933 | struct ata_taskfile tf; |
934 | unsigned int err_mask = 0; | 934 | unsigned int err_mask = 0; |
935 | u16 *id; | ||
935 | const char *reason; | 936 | const char *reason; |
936 | int rc; | 937 | int rc; |
937 | 938 | ||
@@ -945,6 +946,13 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | |||
945 | 946 | ||
946 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ | 947 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ |
947 | 948 | ||
949 | id = kmalloc(sizeof(id[0]) * ATA_ID_WORDS, GFP_KERNEL); | ||
950 | if (id == NULL) { | ||
951 | rc = -ENOMEM; | ||
952 | reason = "out of memory"; | ||
953 | goto err_out; | ||
954 | } | ||
955 | |||
948 | retry: | 956 | retry: |
949 | ata_tf_init(ap, &tf, dev->devno); | 957 | ata_tf_init(ap, &tf, dev->devno); |
950 | 958 | ||
@@ -1035,11 +1043,13 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | |||
1035 | } | 1043 | } |
1036 | 1044 | ||
1037 | *p_class = class; | 1045 | *p_class = class; |
1046 | *p_id = id; | ||
1038 | return 0; | 1047 | return 0; |
1039 | 1048 | ||
1040 | err_out: | 1049 | err_out: |
1041 | printk(KERN_WARNING "ata%u: dev %u failed to IDENTIFY (%s)\n", | 1050 | printk(KERN_WARNING "ata%u: dev %u failed to IDENTIFY (%s)\n", |
1042 | ap->id, dev->devno, reason); | 1051 | ap->id, dev->devno, reason); |
1052 | kfree(id); | ||
1043 | return rc; | 1053 | return rc; |
1044 | } | 1054 | } |
1045 | 1055 | ||
@@ -1079,7 +1089,8 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device) | |||
1079 | 1089 | ||
1080 | DPRINTK("ENTER, host %u, dev %u\n", ap->id, device); | 1090 | DPRINTK("ENTER, host %u, dev %u\n", ap->id, device); |
1081 | 1091 | ||
1082 | rc = ata_dev_read_id(ap, dev, &dev->class, 1, dev->id); | 1092 | WARN_ON(dev->id != NULL); |
1093 | rc = ata_dev_read_id(ap, dev, &dev->class, 1, &dev->id); | ||
1083 | if (rc) | 1094 | if (rc) |
1084 | goto err_out; | 1095 | goto err_out; |
1085 | 1096 | ||
@@ -4732,11 +4743,14 @@ void ata_host_set_remove(struct ata_host_set *host_set) | |||
4732 | int ata_scsi_release(struct Scsi_Host *host) | 4743 | int ata_scsi_release(struct Scsi_Host *host) |
4733 | { | 4744 | { |
4734 | struct ata_port *ap = (struct ata_port *) &host->hostdata[0]; | 4745 | struct ata_port *ap = (struct ata_port *) &host->hostdata[0]; |
4746 | int i; | ||
4735 | 4747 | ||
4736 | DPRINTK("ENTER\n"); | 4748 | DPRINTK("ENTER\n"); |
4737 | 4749 | ||
4738 | ap->ops->port_disable(ap); | 4750 | ap->ops->port_disable(ap); |
4739 | ata_host_remove(ap, 0); | 4751 | ata_host_remove(ap, 0); |
4752 | for (i = 0; i < ATA_MAX_DEVICES; i++) | ||
4753 | kfree(ap->device[i].id); | ||
4740 | 4754 | ||
4741 | DPRINTK("EXIT\n"); | 4755 | DPRINTK("EXIT\n"); |
4742 | return 1; | 4756 | return 1; |