diff options
author | Tejun Heo <htejun@gmail.com> | 2006-05-15 07:57:53 -0400 |
---|---|---|
committer | Tejun Heo <htejun@gmail.com> | 2006-05-15 07:57:53 -0400 |
commit | 3373efd89dead4ce7818d685729e0431448357c9 (patch) | |
tree | d7e7a1afd83e269c3c0978f924cd8c54d9be7f5a | |
parent | 38d87234d6c47ca487fc6344100323d5adc6f32c (diff) |
[PATCH] libata: use dev->ap
Use dev->ap where possible and eliminate superflous @ap from functions
and structures.
Signed-off-by: Tejun Heo <htejun@gmail.com>
-rw-r--r-- | drivers/scsi/ahci.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 160 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 40 | ||||
-rw-r--r-- | drivers/scsi/libata.h | 11 | ||||
-rw-r--r-- | include/linux/libata.h | 21 |
5 files changed, 106 insertions, 128 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index c2298fb131d8..f6e4c8ea74e3 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -597,7 +597,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class) | |||
597 | /* restart engine */ | 597 | /* restart engine */ |
598 | ahci_start_engine(ap); | 598 | ahci_start_engine(ap); |
599 | 599 | ||
600 | ata_tf_init(ap, &tf, 0); | 600 | ata_tf_init(ap->device, &tf); |
601 | fis = pp->cmd_tbl; | 601 | fis = pp->cmd_tbl; |
602 | 602 | ||
603 | /* issue the first D2H Register FIS */ | 603 | /* issue the first D2H Register FIS */ |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 31b65e0da0b1..4ced962db812 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -61,13 +61,10 @@ | |||
61 | 61 | ||
62 | #include "libata.h" | 62 | #include "libata.h" |
63 | 63 | ||
64 | static unsigned int ata_dev_init_params(struct ata_port *ap, | 64 | static unsigned int ata_dev_init_params(struct ata_device *dev, |
65 | struct ata_device *dev, | 65 | u16 heads, u16 sectors); |
66 | u16 heads, | 66 | static unsigned int ata_dev_set_xfermode(struct ata_device *dev); |
67 | u16 sectors); | 67 | static void ata_dev_xfermask(struct ata_device *dev); |
68 | static unsigned int ata_dev_set_xfermode(struct ata_port *ap, | ||
69 | struct ata_device *dev); | ||
70 | static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); | ||
71 | 68 | ||
72 | static unsigned int ata_unique_id = 1; | 69 | static unsigned int ata_unique_id = 1; |
73 | static struct workqueue_struct *ata_wq; | 70 | static struct workqueue_struct *ata_wq; |
@@ -412,11 +409,11 @@ static const char *sata_spd_string(unsigned int spd) | |||
412 | return spd_str[spd - 1]; | 409 | return spd_str[spd - 1]; |
413 | } | 410 | } |
414 | 411 | ||
415 | void ata_dev_disable(struct ata_port *ap, struct ata_device *dev) | 412 | void ata_dev_disable(struct ata_device *dev) |
416 | { | 413 | { |
417 | if (ata_dev_enabled(dev)) { | 414 | if (ata_dev_enabled(dev)) { |
418 | printk(KERN_WARNING "ata%u: dev %u disabled\n", | 415 | printk(KERN_WARNING "ata%u: dev %u disabled\n", |
419 | ap->id, dev->devno); | 416 | dev->ap->id, dev->devno); |
420 | dev->class++; | 417 | dev->class++; |
421 | } | 418 | } |
422 | } | 419 | } |
@@ -960,7 +957,6 @@ void ata_qc_complete_internal(struct ata_queued_cmd *qc) | |||
960 | 957 | ||
961 | /** | 958 | /** |
962 | * ata_exec_internal - execute libata internal command | 959 | * ata_exec_internal - execute libata internal command |
963 | * @ap: Port to which the command is sent | ||
964 | * @dev: Device to which the command is sent | 960 | * @dev: Device to which the command is sent |
965 | * @tf: Taskfile registers for the command and the result | 961 | * @tf: Taskfile registers for the command and the result |
966 | * @cdb: CDB for packet command | 962 | * @cdb: CDB for packet command |
@@ -978,10 +974,11 @@ void ata_qc_complete_internal(struct ata_queued_cmd *qc) | |||
978 | * None. Should be called with kernel context, might sleep. | 974 | * None. Should be called with kernel context, might sleep. |
979 | */ | 975 | */ |
980 | 976 | ||
981 | unsigned ata_exec_internal(struct ata_port *ap, struct ata_device *dev, | 977 | unsigned ata_exec_internal(struct ata_device *dev, |
982 | struct ata_taskfile *tf, const u8 *cdb, | 978 | struct ata_taskfile *tf, const u8 *cdb, |
983 | int dma_dir, void *buf, unsigned int buflen) | 979 | int dma_dir, void *buf, unsigned int buflen) |
984 | { | 980 | { |
981 | struct ata_port *ap = dev->ap; | ||
985 | u8 command = tf->command; | 982 | u8 command = tf->command; |
986 | struct ata_queued_cmd *qc; | 983 | struct ata_queued_cmd *qc; |
987 | DECLARE_COMPLETION(wait); | 984 | DECLARE_COMPLETION(wait); |
@@ -990,7 +987,7 @@ unsigned ata_exec_internal(struct ata_port *ap, struct ata_device *dev, | |||
990 | 987 | ||
991 | spin_lock_irqsave(&ap->host_set->lock, flags); | 988 | spin_lock_irqsave(&ap->host_set->lock, flags); |
992 | 989 | ||
993 | qc = ata_qc_new_init(ap, dev); | 990 | qc = ata_qc_new_init(dev); |
994 | BUG_ON(qc == NULL); | 991 | BUG_ON(qc == NULL); |
995 | 992 | ||
996 | qc->tf = *tf; | 993 | qc->tf = *tf; |
@@ -1095,7 +1092,6 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
1095 | 1092 | ||
1096 | /** | 1093 | /** |
1097 | * ata_dev_read_id - Read ID data from the specified device | 1094 | * ata_dev_read_id - Read ID data from the specified device |
1098 | * @ap: port on which target device resides | ||
1099 | * @dev: target device | 1095 | * @dev: target device |
1100 | * @p_class: pointer to class of the target device (may be changed) | 1096 | * @p_class: pointer to class of the target device (may be changed) |
1101 | * @post_reset: is this read ID post-reset? | 1097 | * @post_reset: is this read ID post-reset? |
@@ -1112,9 +1108,10 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
1112 | * RETURNS: | 1108 | * RETURNS: |
1113 | * 0 on success, -errno otherwise. | 1109 | * 0 on success, -errno otherwise. |
1114 | */ | 1110 | */ |
1115 | static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | 1111 | static int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, |
1116 | unsigned int *p_class, int post_reset, u16 *id) | 1112 | int post_reset, u16 *id) |
1117 | { | 1113 | { |
1114 | struct ata_port *ap = dev->ap; | ||
1118 | unsigned int class = *p_class; | 1115 | unsigned int class = *p_class; |
1119 | struct ata_taskfile tf; | 1116 | struct ata_taskfile tf; |
1120 | unsigned int err_mask = 0; | 1117 | unsigned int err_mask = 0; |
@@ -1126,7 +1123,7 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | |||
1126 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ | 1123 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ |
1127 | 1124 | ||
1128 | retry: | 1125 | retry: |
1129 | ata_tf_init(ap, &tf, dev->devno); | 1126 | ata_tf_init(dev, &tf); |
1130 | 1127 | ||
1131 | switch (class) { | 1128 | switch (class) { |
1132 | case ATA_DEV_ATA: | 1129 | case ATA_DEV_ATA: |
@@ -1143,7 +1140,7 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | |||
1143 | 1140 | ||
1144 | tf.protocol = ATA_PROT_PIO; | 1141 | tf.protocol = ATA_PROT_PIO; |
1145 | 1142 | ||
1146 | err_mask = ata_exec_internal(ap, dev, &tf, NULL, DMA_FROM_DEVICE, | 1143 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, |
1147 | id, sizeof(id[0]) * ATA_ID_WORDS); | 1144 | id, sizeof(id[0]) * ATA_ID_WORDS); |
1148 | if (err_mask) { | 1145 | if (err_mask) { |
1149 | rc = -EIO; | 1146 | rc = -EIO; |
@@ -1170,7 +1167,7 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | |||
1170 | * Some drives were very specific about that exact sequence. | 1167 | * Some drives were very specific about that exact sequence. |
1171 | */ | 1168 | */ |
1172 | if (ata_id_major_version(id) < 4 || !ata_id_has_lba(id)) { | 1169 | if (ata_id_major_version(id) < 4 || !ata_id_has_lba(id)) { |
1173 | err_mask = ata_dev_init_params(ap, dev, id[3], id[6]); | 1170 | err_mask = ata_dev_init_params(dev, id[3], id[6]); |
1174 | if (err_mask) { | 1171 | if (err_mask) { |
1175 | rc = -EIO; | 1172 | rc = -EIO; |
1176 | reason = "INIT_DEV_PARAMS failed"; | 1173 | reason = "INIT_DEV_PARAMS failed"; |
@@ -1195,15 +1192,13 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev, | |||
1195 | return rc; | 1192 | return rc; |
1196 | } | 1193 | } |
1197 | 1194 | ||
1198 | static inline u8 ata_dev_knobble(const struct ata_port *ap, | 1195 | static inline u8 ata_dev_knobble(struct ata_device *dev) |
1199 | struct ata_device *dev) | ||
1200 | { | 1196 | { |
1201 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); | 1197 | return ((dev->ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); |
1202 | } | 1198 | } |
1203 | 1199 | ||
1204 | /** | 1200 | /** |
1205 | * ata_dev_configure - Configure the specified ATA/ATAPI device | 1201 | * ata_dev_configure - Configure the specified ATA/ATAPI device |
1206 | * @ap: Port on which target device resides | ||
1207 | * @dev: Target device to configure | 1202 | * @dev: Target device to configure |
1208 | * @print_info: Enable device info printout | 1203 | * @print_info: Enable device info printout |
1209 | * | 1204 | * |
@@ -1216,9 +1211,9 @@ static inline u8 ata_dev_knobble(const struct ata_port *ap, | |||
1216 | * RETURNS: | 1211 | * RETURNS: |
1217 | * 0 on success, -errno otherwise | 1212 | * 0 on success, -errno otherwise |
1218 | */ | 1213 | */ |
1219 | static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev, | 1214 | static int ata_dev_configure(struct ata_device *dev, int print_info) |
1220 | int print_info) | ||
1221 | { | 1215 | { |
1216 | struct ata_port *ap = dev->ap; | ||
1222 | const u16 *id = dev->id; | 1217 | const u16 *id = dev->id; |
1223 | unsigned int xfer_mask; | 1218 | unsigned int xfer_mask; |
1224 | int i, rc; | 1219 | int i, rc; |
@@ -1331,7 +1326,7 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev, | |||
1331 | ap->device[i].cdb_len); | 1326 | ap->device[i].cdb_len); |
1332 | 1327 | ||
1333 | /* limit bridge transfers to udma5, 200 sectors */ | 1328 | /* limit bridge transfers to udma5, 200 sectors */ |
1334 | if (ata_dev_knobble(ap, dev)) { | 1329 | if (ata_dev_knobble(dev)) { |
1335 | if (print_info) | 1330 | if (print_info) |
1336 | printk(KERN_INFO "ata%u(%u): applying bridge limits\n", | 1331 | printk(KERN_INFO "ata%u(%u): applying bridge limits\n", |
1337 | ap->id, dev->devno); | 1332 | ap->id, dev->devno); |
@@ -1416,11 +1411,11 @@ static int ata_bus_probe(struct ata_port *ap) | |||
1416 | if (!ata_dev_enabled(dev)) | 1411 | if (!ata_dev_enabled(dev)) |
1417 | continue; | 1412 | continue; |
1418 | 1413 | ||
1419 | rc = ata_dev_read_id(ap, dev, &dev->class, 1, dev->id); | 1414 | rc = ata_dev_read_id(dev, &dev->class, 1, dev->id); |
1420 | if (rc) | 1415 | if (rc) |
1421 | goto fail; | 1416 | goto fail; |
1422 | 1417 | ||
1423 | rc = ata_dev_configure(ap, dev, 1); | 1418 | rc = ata_dev_configure(dev, 1); |
1424 | if (rc) | 1419 | if (rc) |
1425 | goto fail; | 1420 | goto fail; |
1426 | } | 1421 | } |
@@ -1453,13 +1448,13 @@ static int ata_bus_probe(struct ata_port *ap) | |||
1453 | default: | 1448 | default: |
1454 | tries[dev->devno]--; | 1449 | tries[dev->devno]--; |
1455 | if (down_xfermask && | 1450 | if (down_xfermask && |
1456 | ata_down_xfermask_limit(ap, dev, tries[dev->devno] == 1)) | 1451 | ata_down_xfermask_limit(dev, tries[dev->devno] == 1)) |
1457 | tries[dev->devno] = 0; | 1452 | tries[dev->devno] = 0; |
1458 | } | 1453 | } |
1459 | 1454 | ||
1460 | if (!tries[dev->devno]) { | 1455 | if (!tries[dev->devno]) { |
1461 | ata_down_xfermask_limit(ap, dev, 1); | 1456 | ata_down_xfermask_limit(dev, 1); |
1462 | ata_dev_disable(ap, dev); | 1457 | ata_dev_disable(dev); |
1463 | } | 1458 | } |
1464 | 1459 | ||
1465 | goto retry; | 1460 | goto retry; |
@@ -1586,15 +1581,15 @@ void sata_phy_reset(struct ata_port *ap) | |||
1586 | 1581 | ||
1587 | /** | 1582 | /** |
1588 | * ata_dev_pair - return other device on cable | 1583 | * ata_dev_pair - return other device on cable |
1589 | * @ap: port | ||
1590 | * @adev: device | 1584 | * @adev: device |
1591 | * | 1585 | * |
1592 | * Obtain the other device on the same cable, or if none is | 1586 | * Obtain the other device on the same cable, or if none is |
1593 | * present NULL is returned | 1587 | * present NULL is returned |
1594 | */ | 1588 | */ |
1595 | 1589 | ||
1596 | struct ata_device *ata_dev_pair(struct ata_port *ap, struct ata_device *adev) | 1590 | struct ata_device *ata_dev_pair(struct ata_device *adev) |
1597 | { | 1591 | { |
1592 | struct ata_port *ap = adev->ap; | ||
1598 | struct ata_device *pair = &ap->device[1 - adev->devno]; | 1593 | struct ata_device *pair = &ap->device[1 - adev->devno]; |
1599 | if (!ata_dev_enabled(pair)) | 1594 | if (!ata_dev_enabled(pair)) |
1600 | return NULL; | 1595 | return NULL; |
@@ -1886,7 +1881,6 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
1886 | 1881 | ||
1887 | /** | 1882 | /** |
1888 | * ata_down_xfermask_limit - adjust dev xfer masks downward | 1883 | * ata_down_xfermask_limit - adjust dev xfer masks downward |
1889 | * @ap: Port associated with device @dev | ||
1890 | * @dev: Device to adjust xfer masks | 1884 | * @dev: Device to adjust xfer masks |
1891 | * @force_pio0: Force PIO0 | 1885 | * @force_pio0: Force PIO0 |
1892 | * | 1886 | * |
@@ -1900,9 +1894,9 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
1900 | * RETURNS: | 1894 | * RETURNS: |
1901 | * 0 on success, negative errno on failure | 1895 | * 0 on success, negative errno on failure |
1902 | */ | 1896 | */ |
1903 | int ata_down_xfermask_limit(struct ata_port *ap, struct ata_device *dev, | 1897 | int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0) |
1904 | int force_pio0) | ||
1905 | { | 1898 | { |
1899 | struct ata_port *ap = dev->ap; | ||
1906 | unsigned long xfer_mask; | 1900 | unsigned long xfer_mask; |
1907 | int highbit; | 1901 | int highbit; |
1908 | 1902 | ||
@@ -1934,8 +1928,9 @@ int ata_down_xfermask_limit(struct ata_port *ap, struct ata_device *dev, | |||
1934 | return -EINVAL; | 1928 | return -EINVAL; |
1935 | } | 1929 | } |
1936 | 1930 | ||
1937 | static int ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev) | 1931 | static int ata_dev_set_mode(struct ata_device *dev) |
1938 | { | 1932 | { |
1933 | struct ata_port *ap = dev->ap; | ||
1939 | unsigned int err_mask; | 1934 | unsigned int err_mask; |
1940 | int rc; | 1935 | int rc; |
1941 | 1936 | ||
@@ -1943,7 +1938,7 @@ static int ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev) | |||
1943 | if (dev->xfer_shift == ATA_SHIFT_PIO) | 1938 | if (dev->xfer_shift == ATA_SHIFT_PIO) |
1944 | dev->flags |= ATA_DFLAG_PIO; | 1939 | dev->flags |= ATA_DFLAG_PIO; |
1945 | 1940 | ||
1946 | err_mask = ata_dev_set_xfermode(ap, dev); | 1941 | err_mask = ata_dev_set_xfermode(dev); |
1947 | if (err_mask) { | 1942 | if (err_mask) { |
1948 | printk(KERN_ERR | 1943 | printk(KERN_ERR |
1949 | "ata%u: failed to set xfermode (err_mask=0x%x)\n", | 1944 | "ata%u: failed to set xfermode (err_mask=0x%x)\n", |
@@ -1951,7 +1946,7 @@ static int ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev) | |||
1951 | return -EIO; | 1946 | return -EIO; |
1952 | } | 1947 | } |
1953 | 1948 | ||
1954 | rc = ata_dev_revalidate(ap, dev, 0); | 1949 | rc = ata_dev_revalidate(dev, 0); |
1955 | if (rc) | 1950 | if (rc) |
1956 | return rc; | 1951 | return rc; |
1957 | 1952 | ||
@@ -2007,7 +2002,7 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2007 | if (!ata_dev_enabled(dev)) | 2002 | if (!ata_dev_enabled(dev)) |
2008 | continue; | 2003 | continue; |
2009 | 2004 | ||
2010 | ata_dev_xfermask(ap, dev); | 2005 | ata_dev_xfermask(dev); |
2011 | 2006 | ||
2012 | pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0); | 2007 | pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0); |
2013 | dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask); | 2008 | dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask); |
@@ -2060,7 +2055,7 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2060 | if (!ata_dev_enabled(dev)) | 2055 | if (!ata_dev_enabled(dev)) |
2061 | continue; | 2056 | continue; |
2062 | 2057 | ||
2063 | rc = ata_dev_set_mode(ap, dev); | 2058 | rc = ata_dev_set_mode(dev); |
2064 | if (rc) | 2059 | if (rc) |
2065 | goto out; | 2060 | goto out; |
2066 | } | 2061 | } |
@@ -2712,7 +2707,6 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit, | |||
2712 | 2707 | ||
2713 | /** | 2708 | /** |
2714 | * ata_dev_same_device - Determine whether new ID matches configured device | 2709 | * ata_dev_same_device - Determine whether new ID matches configured device |
2715 | * @ap: port on which the device to compare against resides | ||
2716 | * @dev: device to compare against | 2710 | * @dev: device to compare against |
2717 | * @new_class: class of the new device | 2711 | * @new_class: class of the new device |
2718 | * @new_id: IDENTIFY page of the new device | 2712 | * @new_id: IDENTIFY page of the new device |
@@ -2727,9 +2721,10 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit, | |||
2727 | * RETURNS: | 2721 | * RETURNS: |
2728 | * 1 if @dev matches @new_class and @new_id, 0 otherwise. | 2722 | * 1 if @dev matches @new_class and @new_id, 0 otherwise. |
2729 | */ | 2723 | */ |
2730 | static int ata_dev_same_device(struct ata_port *ap, struct ata_device *dev, | 2724 | static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, |
2731 | unsigned int new_class, const u16 *new_id) | 2725 | const u16 *new_id) |
2732 | { | 2726 | { |
2727 | struct ata_port *ap = dev->ap; | ||
2733 | const u16 *old_id = dev->id; | 2728 | const u16 *old_id = dev->id; |
2734 | unsigned char model[2][41], serial[2][21]; | 2729 | unsigned char model[2][41], serial[2][21]; |
2735 | u64 new_n_sectors; | 2730 | u64 new_n_sectors; |
@@ -2774,7 +2769,6 @@ static int ata_dev_same_device(struct ata_port *ap, struct ata_device *dev, | |||
2774 | 2769 | ||
2775 | /** | 2770 | /** |
2776 | * ata_dev_revalidate - Revalidate ATA device | 2771 | * ata_dev_revalidate - Revalidate ATA device |
2777 | * @ap: port on which the device to revalidate resides | ||
2778 | * @dev: device to revalidate | 2772 | * @dev: device to revalidate |
2779 | * @post_reset: is this revalidation after reset? | 2773 | * @post_reset: is this revalidation after reset? |
2780 | * | 2774 | * |
@@ -2787,9 +2781,9 @@ static int ata_dev_same_device(struct ata_port *ap, struct ata_device *dev, | |||
2787 | * RETURNS: | 2781 | * RETURNS: |
2788 | * 0 on success, negative errno otherwise | 2782 | * 0 on success, negative errno otherwise |
2789 | */ | 2783 | */ |
2790 | int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev, | 2784 | int ata_dev_revalidate(struct ata_device *dev, int post_reset) |
2791 | int post_reset) | ||
2792 | { | 2785 | { |
2786 | struct ata_port *ap = dev->ap; | ||
2793 | unsigned int class = dev->class; | 2787 | unsigned int class = dev->class; |
2794 | u16 *id = (void *)ap->sector_buf; | 2788 | u16 *id = (void *)ap->sector_buf; |
2795 | int rc; | 2789 | int rc; |
@@ -2800,12 +2794,12 @@ int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev, | |||
2800 | } | 2794 | } |
2801 | 2795 | ||
2802 | /* read ID data */ | 2796 | /* read ID data */ |
2803 | rc = ata_dev_read_id(ap, dev, &class, post_reset, id); | 2797 | rc = ata_dev_read_id(dev, &class, post_reset, id); |
2804 | if (rc) | 2798 | if (rc) |
2805 | goto fail; | 2799 | goto fail; |
2806 | 2800 | ||
2807 | /* is the device still there? */ | 2801 | /* is the device still there? */ |
2808 | if (!ata_dev_same_device(ap, dev, class, id)) { | 2802 | if (!ata_dev_same_device(dev, class, id)) { |
2809 | rc = -ENODEV; | 2803 | rc = -ENODEV; |
2810 | goto fail; | 2804 | goto fail; |
2811 | } | 2805 | } |
@@ -2813,7 +2807,7 @@ int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev, | |||
2813 | memcpy(dev->id, id, sizeof(id[0]) * ATA_ID_WORDS); | 2807 | memcpy(dev->id, id, sizeof(id[0]) * ATA_ID_WORDS); |
2814 | 2808 | ||
2815 | /* configure device according to the new ID */ | 2809 | /* configure device according to the new ID */ |
2816 | rc = ata_dev_configure(ap, dev, 0); | 2810 | rc = ata_dev_configure(dev, 0); |
2817 | if (rc == 0) | 2811 | if (rc == 0) |
2818 | return 0; | 2812 | return 0; |
2819 | 2813 | ||
@@ -2895,7 +2889,6 @@ static int ata_dma_blacklisted(const struct ata_device *dev) | |||
2895 | 2889 | ||
2896 | /** | 2890 | /** |
2897 | * ata_dev_xfermask - Compute supported xfermask of the given device | 2891 | * ata_dev_xfermask - Compute supported xfermask of the given device |
2898 | * @ap: Port on which the device to compute xfermask for resides | ||
2899 | * @dev: Device to compute xfermask for | 2892 | * @dev: Device to compute xfermask for |
2900 | * | 2893 | * |
2901 | * Compute supported xfermask of @dev and store it in | 2894 | * Compute supported xfermask of @dev and store it in |
@@ -2910,8 +2903,9 @@ static int ata_dma_blacklisted(const struct ata_device *dev) | |||
2910 | * LOCKING: | 2903 | * LOCKING: |
2911 | * None. | 2904 | * None. |
2912 | */ | 2905 | */ |
2913 | static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev) | 2906 | static void ata_dev_xfermask(struct ata_device *dev) |
2914 | { | 2907 | { |
2908 | struct ata_port *ap = dev->ap; | ||
2915 | struct ata_host_set *hs = ap->host_set; | 2909 | struct ata_host_set *hs = ap->host_set; |
2916 | unsigned long xfer_mask; | 2910 | unsigned long xfer_mask; |
2917 | int i; | 2911 | int i; |
@@ -2964,7 +2958,6 @@ static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev) | |||
2964 | 2958 | ||
2965 | /** | 2959 | /** |
2966 | * ata_dev_set_xfermode - Issue SET FEATURES - XFER MODE command | 2960 | * ata_dev_set_xfermode - Issue SET FEATURES - XFER MODE command |
2967 | * @ap: Port associated with device @dev | ||
2968 | * @dev: Device to which command will be sent | 2961 | * @dev: Device to which command will be sent |
2969 | * | 2962 | * |
2970 | * Issue SET FEATURES - XFER MODE command to device @dev | 2963 | * Issue SET FEATURES - XFER MODE command to device @dev |
@@ -2977,8 +2970,7 @@ static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev) | |||
2977 | * 0 on success, AC_ERR_* mask otherwise. | 2970 | * 0 on success, AC_ERR_* mask otherwise. |
2978 | */ | 2971 | */ |
2979 | 2972 | ||
2980 | static unsigned int ata_dev_set_xfermode(struct ata_port *ap, | 2973 | static unsigned int ata_dev_set_xfermode(struct ata_device *dev) |
2981 | struct ata_device *dev) | ||
2982 | { | 2974 | { |
2983 | struct ata_taskfile tf; | 2975 | struct ata_taskfile tf; |
2984 | unsigned int err_mask; | 2976 | unsigned int err_mask; |
@@ -2986,14 +2978,14 @@ static unsigned int ata_dev_set_xfermode(struct ata_port *ap, | |||
2986 | /* set up set-features taskfile */ | 2978 | /* set up set-features taskfile */ |
2987 | DPRINTK("set features - xfer mode\n"); | 2979 | DPRINTK("set features - xfer mode\n"); |
2988 | 2980 | ||
2989 | ata_tf_init(ap, &tf, dev->devno); | 2981 | ata_tf_init(dev, &tf); |
2990 | tf.command = ATA_CMD_SET_FEATURES; | 2982 | tf.command = ATA_CMD_SET_FEATURES; |
2991 | tf.feature = SETFEATURES_XFER; | 2983 | tf.feature = SETFEATURES_XFER; |
2992 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | 2984 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; |
2993 | tf.protocol = ATA_PROT_NODATA; | 2985 | tf.protocol = ATA_PROT_NODATA; |
2994 | tf.nsect = dev->xfer_mode; | 2986 | tf.nsect = dev->xfer_mode; |
2995 | 2987 | ||
2996 | err_mask = ata_exec_internal(ap, dev, &tf, NULL, DMA_NONE, NULL, 0); | 2988 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); |
2997 | 2989 | ||
2998 | DPRINTK("EXIT, err_mask=%x\n", err_mask); | 2990 | DPRINTK("EXIT, err_mask=%x\n", err_mask); |
2999 | return err_mask; | 2991 | return err_mask; |
@@ -3001,8 +2993,9 @@ static unsigned int ata_dev_set_xfermode(struct ata_port *ap, | |||
3001 | 2993 | ||
3002 | /** | 2994 | /** |
3003 | * ata_dev_init_params - Issue INIT DEV PARAMS command | 2995 | * ata_dev_init_params - Issue INIT DEV PARAMS command |
3004 | * @ap: Port associated with device @dev | ||
3005 | * @dev: Device to which command will be sent | 2996 | * @dev: Device to which command will be sent |
2997 | * @heads: Number of heads | ||
2998 | * @sectors: Number of sectors | ||
3006 | * | 2999 | * |
3007 | * LOCKING: | 3000 | * LOCKING: |
3008 | * Kernel thread context (may sleep) | 3001 | * Kernel thread context (may sleep) |
@@ -3010,11 +3003,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_port *ap, | |||
3010 | * RETURNS: | 3003 | * RETURNS: |
3011 | * 0 on success, AC_ERR_* mask otherwise. | 3004 | * 0 on success, AC_ERR_* mask otherwise. |
3012 | */ | 3005 | */ |
3013 | 3006 | static unsigned int ata_dev_init_params(struct ata_device *dev, | |
3014 | static unsigned int ata_dev_init_params(struct ata_port *ap, | 3007 | u16 heads, u16 sectors) |
3015 | struct ata_device *dev, | ||
3016 | u16 heads, | ||
3017 | u16 sectors) | ||
3018 | { | 3008 | { |
3019 | struct ata_taskfile tf; | 3009 | struct ata_taskfile tf; |
3020 | unsigned int err_mask; | 3010 | unsigned int err_mask; |
@@ -3026,14 +3016,14 @@ static unsigned int ata_dev_init_params(struct ata_port *ap, | |||
3026 | /* set up init dev params taskfile */ | 3016 | /* set up init dev params taskfile */ |
3027 | DPRINTK("init dev params \n"); | 3017 | DPRINTK("init dev params \n"); |
3028 | 3018 | ||
3029 | ata_tf_init(ap, &tf, dev->devno); | 3019 | ata_tf_init(dev, &tf); |
3030 | tf.command = ATA_CMD_INIT_DEV_PARAMS; | 3020 | tf.command = ATA_CMD_INIT_DEV_PARAMS; |
3031 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | 3021 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; |
3032 | tf.protocol = ATA_PROT_NODATA; | 3022 | tf.protocol = ATA_PROT_NODATA; |
3033 | tf.nsect = sectors; | 3023 | tf.nsect = sectors; |
3034 | tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */ | 3024 | tf.device |= (heads - 1) & 0x0f; /* max head = num. of heads - 1 */ |
3035 | 3025 | ||
3036 | err_mask = ata_exec_internal(ap, dev, &tf, NULL, DMA_NONE, NULL, 0); | 3026 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); |
3037 | 3027 | ||
3038 | DPRINTK("EXIT, err_mask=%x\n", err_mask); | 3028 | DPRINTK("EXIT, err_mask=%x\n", err_mask); |
3039 | return err_mask; | 3029 | return err_mask; |
@@ -4045,16 +4035,15 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | |||
4045 | 4035 | ||
4046 | /** | 4036 | /** |
4047 | * ata_qc_new_init - Request an available ATA command, and initialize it | 4037 | * ata_qc_new_init - Request an available ATA command, and initialize it |
4048 | * @ap: Port associated with device @dev | ||
4049 | * @dev: Device from whom we request an available command structure | 4038 | * @dev: Device from whom we request an available command structure |
4050 | * | 4039 | * |
4051 | * LOCKING: | 4040 | * LOCKING: |
4052 | * None. | 4041 | * None. |
4053 | */ | 4042 | */ |
4054 | 4043 | ||
4055 | struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 4044 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) |
4056 | struct ata_device *dev) | ||
4057 | { | 4045 | { |
4046 | struct ata_port *ap = dev->ap; | ||
4058 | struct ata_queued_cmd *qc; | 4047 | struct ata_queued_cmd *qc; |
4059 | 4048 | ||
4060 | qc = ata_qc_new(ap); | 4049 | qc = ata_qc_new(ap); |
@@ -4520,19 +4509,18 @@ int ata_port_offline(struct ata_port *ap) | |||
4520 | * Execute a 'simple' command, that only consists of the opcode 'cmd' itself, | 4509 | * Execute a 'simple' command, that only consists of the opcode 'cmd' itself, |
4521 | * without filling any other registers | 4510 | * without filling any other registers |
4522 | */ | 4511 | */ |
4523 | static int ata_do_simple_cmd(struct ata_port *ap, struct ata_device *dev, | 4512 | static int ata_do_simple_cmd(struct ata_device *dev, u8 cmd) |
4524 | u8 cmd) | ||
4525 | { | 4513 | { |
4526 | struct ata_taskfile tf; | 4514 | struct ata_taskfile tf; |
4527 | int err; | 4515 | int err; |
4528 | 4516 | ||
4529 | ata_tf_init(ap, &tf, dev->devno); | 4517 | ata_tf_init(dev, &tf); |
4530 | 4518 | ||
4531 | tf.command = cmd; | 4519 | tf.command = cmd; |
4532 | tf.flags |= ATA_TFLAG_DEVICE; | 4520 | tf.flags |= ATA_TFLAG_DEVICE; |
4533 | tf.protocol = ATA_PROT_NODATA; | 4521 | tf.protocol = ATA_PROT_NODATA; |
4534 | 4522 | ||
4535 | err = ata_exec_internal(ap, dev, &tf, NULL, DMA_NONE, NULL, 0); | 4523 | err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); |
4536 | if (err) | 4524 | if (err) |
4537 | printk(KERN_ERR "%s: ata command failed: %d\n", | 4525 | printk(KERN_ERR "%s: ata command failed: %d\n", |
4538 | __FUNCTION__, err); | 4526 | __FUNCTION__, err); |
@@ -4540,7 +4528,7 @@ static int ata_do_simple_cmd(struct ata_port *ap, struct ata_device *dev, | |||
4540 | return err; | 4528 | return err; |
4541 | } | 4529 | } |
4542 | 4530 | ||
4543 | static int ata_flush_cache(struct ata_port *ap, struct ata_device *dev) | 4531 | static int ata_flush_cache(struct ata_device *dev) |
4544 | { | 4532 | { |
4545 | u8 cmd; | 4533 | u8 cmd; |
4546 | 4534 | ||
@@ -4552,22 +4540,21 @@ static int ata_flush_cache(struct ata_port *ap, struct ata_device *dev) | |||
4552 | else | 4540 | else |
4553 | cmd = ATA_CMD_FLUSH; | 4541 | cmd = ATA_CMD_FLUSH; |
4554 | 4542 | ||
4555 | return ata_do_simple_cmd(ap, dev, cmd); | 4543 | return ata_do_simple_cmd(dev, cmd); |
4556 | } | 4544 | } |
4557 | 4545 | ||
4558 | static int ata_standby_drive(struct ata_port *ap, struct ata_device *dev) | 4546 | static int ata_standby_drive(struct ata_device *dev) |
4559 | { | 4547 | { |
4560 | return ata_do_simple_cmd(ap, dev, ATA_CMD_STANDBYNOW1); | 4548 | return ata_do_simple_cmd(dev, ATA_CMD_STANDBYNOW1); |
4561 | } | 4549 | } |
4562 | 4550 | ||
4563 | static int ata_start_drive(struct ata_port *ap, struct ata_device *dev) | 4551 | static int ata_start_drive(struct ata_device *dev) |
4564 | { | 4552 | { |
4565 | return ata_do_simple_cmd(ap, dev, ATA_CMD_IDLEIMMEDIATE); | 4553 | return ata_do_simple_cmd(dev, ATA_CMD_IDLEIMMEDIATE); |
4566 | } | 4554 | } |
4567 | 4555 | ||
4568 | /** | 4556 | /** |
4569 | * ata_device_resume - wakeup a previously suspended devices | 4557 | * ata_device_resume - wakeup a previously suspended devices |
4570 | * @ap: port the device is connected to | ||
4571 | * @dev: the device to resume | 4558 | * @dev: the device to resume |
4572 | * | 4559 | * |
4573 | * Kick the drive back into action, by sending it an idle immediate | 4560 | * Kick the drive back into action, by sending it an idle immediate |
@@ -4575,39 +4562,42 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev) | |||
4575 | * and host. | 4562 | * and host. |
4576 | * | 4563 | * |
4577 | */ | 4564 | */ |
4578 | int ata_device_resume(struct ata_port *ap, struct ata_device *dev) | 4565 | int ata_device_resume(struct ata_device *dev) |
4579 | { | 4566 | { |
4567 | struct ata_port *ap = dev->ap; | ||
4568 | |||
4580 | if (ap->flags & ATA_FLAG_SUSPENDED) { | 4569 | if (ap->flags & ATA_FLAG_SUSPENDED) { |
4581 | struct ata_device *failed_dev; | 4570 | struct ata_device *failed_dev; |
4582 | ap->flags &= ~ATA_FLAG_SUSPENDED; | 4571 | ap->flags &= ~ATA_FLAG_SUSPENDED; |
4583 | while (ata_set_mode(ap, &failed_dev)) | 4572 | while (ata_set_mode(ap, &failed_dev)) |
4584 | ata_dev_disable(ap, failed_dev); | 4573 | ata_dev_disable(failed_dev); |
4585 | } | 4574 | } |
4586 | if (!ata_dev_enabled(dev)) | 4575 | if (!ata_dev_enabled(dev)) |
4587 | return 0; | 4576 | return 0; |
4588 | if (dev->class == ATA_DEV_ATA) | 4577 | if (dev->class == ATA_DEV_ATA) |
4589 | ata_start_drive(ap, dev); | 4578 | ata_start_drive(dev); |
4590 | 4579 | ||
4591 | return 0; | 4580 | return 0; |
4592 | } | 4581 | } |
4593 | 4582 | ||
4594 | /** | 4583 | /** |
4595 | * ata_device_suspend - prepare a device for suspend | 4584 | * ata_device_suspend - prepare a device for suspend |
4596 | * @ap: port the device is connected to | ||
4597 | * @dev: the device to suspend | 4585 | * @dev: the device to suspend |
4598 | * | 4586 | * |
4599 | * Flush the cache on the drive, if appropriate, then issue a | 4587 | * Flush the cache on the drive, if appropriate, then issue a |
4600 | * standbynow command. | 4588 | * standbynow command. |
4601 | */ | 4589 | */ |
4602 | int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t state) | 4590 | int ata_device_suspend(struct ata_device *dev, pm_message_t state) |
4603 | { | 4591 | { |
4592 | struct ata_port *ap = dev->ap; | ||
4593 | |||
4604 | if (!ata_dev_enabled(dev)) | 4594 | if (!ata_dev_enabled(dev)) |
4605 | return 0; | 4595 | return 0; |
4606 | if (dev->class == ATA_DEV_ATA) | 4596 | if (dev->class == ATA_DEV_ATA) |
4607 | ata_flush_cache(ap, dev); | 4597 | ata_flush_cache(dev); |
4608 | 4598 | ||
4609 | if (state.event != PM_EVENT_FREEZE) | 4599 | if (state.event != PM_EVENT_FREEZE) |
4610 | ata_standby_drive(ap, dev); | 4600 | ata_standby_drive(dev); |
4611 | ap->flags |= ATA_FLAG_SUSPENDED; | 4601 | ap->flags |= ATA_FLAG_SUSPENDED; |
4612 | return 0; | 4602 | return 0; |
4613 | } | 4603 | } |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index ce90b6352a81..fcbf64e741bb 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -302,7 +302,6 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) | |||
302 | 302 | ||
303 | /** | 303 | /** |
304 | * ata_scsi_qc_new - acquire new ata_queued_cmd reference | 304 | * ata_scsi_qc_new - acquire new ata_queued_cmd reference |
305 | * @ap: ATA port to which the new command is attached | ||
306 | * @dev: ATA device to which the new command is attached | 305 | * @dev: ATA device to which the new command is attached |
307 | * @cmd: SCSI command that originated this ATA command | 306 | * @cmd: SCSI command that originated this ATA command |
308 | * @done: SCSI command completion function | 307 | * @done: SCSI command completion function |
@@ -321,14 +320,13 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) | |||
321 | * RETURNS: | 320 | * RETURNS: |
322 | * Command allocated, or %NULL if none available. | 321 | * Command allocated, or %NULL if none available. |
323 | */ | 322 | */ |
324 | struct ata_queued_cmd *ata_scsi_qc_new(struct ata_port *ap, | 323 | struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, |
325 | struct ata_device *dev, | ||
326 | struct scsi_cmnd *cmd, | 324 | struct scsi_cmnd *cmd, |
327 | void (*done)(struct scsi_cmnd *)) | 325 | void (*done)(struct scsi_cmnd *)) |
328 | { | 326 | { |
329 | struct ata_queued_cmd *qc; | 327 | struct ata_queued_cmd *qc; |
330 | 328 | ||
331 | qc = ata_qc_new_init(ap, dev); | 329 | qc = ata_qc_new_init(dev); |
332 | if (qc) { | 330 | if (qc) { |
333 | qc->scsicmd = cmd; | 331 | qc->scsicmd = cmd; |
334 | qc->scsidone = done; | 332 | qc->scsidone = done; |
@@ -398,7 +396,7 @@ int ata_scsi_device_resume(struct scsi_device *sdev) | |||
398 | struct ata_port *ap = ata_shost_to_port(sdev->host); | 396 | struct ata_port *ap = ata_shost_to_port(sdev->host); |
399 | struct ata_device *dev = &ap->device[sdev->id]; | 397 | struct ata_device *dev = &ap->device[sdev->id]; |
400 | 398 | ||
401 | return ata_device_resume(ap, dev); | 399 | return ata_device_resume(dev); |
402 | } | 400 | } |
403 | 401 | ||
404 | int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) | 402 | int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) |
@@ -406,7 +404,7 @@ int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) | |||
406 | struct ata_port *ap = ata_shost_to_port(sdev->host); | 404 | struct ata_port *ap = ata_shost_to_port(sdev->host); |
407 | struct ata_device *dev = &ap->device[sdev->id]; | 405 | struct ata_device *dev = &ap->device[sdev->id]; |
408 | 406 | ||
409 | return ata_device_suspend(ap, dev, state); | 407 | return ata_device_suspend(dev, state); |
410 | } | 408 | } |
411 | 409 | ||
412 | /** | 410 | /** |
@@ -1224,7 +1222,6 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | |||
1224 | 1222 | ||
1225 | /** | 1223 | /** |
1226 | * ata_scsi_translate - Translate then issue SCSI command to ATA device | 1224 | * ata_scsi_translate - Translate then issue SCSI command to ATA device |
1227 | * @ap: ATA port to which the command is addressed | ||
1228 | * @dev: ATA device to which the command is addressed | 1225 | * @dev: ATA device to which the command is addressed |
1229 | * @cmd: SCSI command to execute | 1226 | * @cmd: SCSI command to execute |
1230 | * @done: SCSI command completion function | 1227 | * @done: SCSI command completion function |
@@ -1247,17 +1244,16 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | |||
1247 | * spin_lock_irqsave(host_set lock) | 1244 | * spin_lock_irqsave(host_set lock) |
1248 | */ | 1245 | */ |
1249 | 1246 | ||
1250 | static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev, | 1247 | static void ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd, |
1251 | struct scsi_cmnd *cmd, | 1248 | void (*done)(struct scsi_cmnd *), |
1252 | void (*done)(struct scsi_cmnd *), | 1249 | ata_xlat_func_t xlat_func) |
1253 | ata_xlat_func_t xlat_func) | ||
1254 | { | 1250 | { |
1255 | struct ata_queued_cmd *qc; | 1251 | struct ata_queued_cmd *qc; |
1256 | u8 *scsicmd = cmd->cmnd; | 1252 | u8 *scsicmd = cmd->cmnd; |
1257 | 1253 | ||
1258 | VPRINTK("ENTER\n"); | 1254 | VPRINTK("ENTER\n"); |
1259 | 1255 | ||
1260 | qc = ata_scsi_qc_new(ap, dev, cmd, done); | 1256 | qc = ata_scsi_qc_new(dev, cmd, done); |
1261 | if (!qc) | 1257 | if (!qc) |
1262 | goto err_mem; | 1258 | goto err_mem; |
1263 | 1259 | ||
@@ -1266,7 +1262,7 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev, | |||
1266 | cmd->sc_data_direction == DMA_TO_DEVICE) { | 1262 | cmd->sc_data_direction == DMA_TO_DEVICE) { |
1267 | if (unlikely(cmd->request_bufflen < 1)) { | 1263 | if (unlikely(cmd->request_bufflen < 1)) { |
1268 | printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n", | 1264 | printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n", |
1269 | ap->id, dev->devno); | 1265 | dev->ap->id, dev->devno); |
1270 | goto err_did; | 1266 | goto err_did; |
1271 | } | 1267 | } |
1272 | 1268 | ||
@@ -2433,19 +2429,20 @@ static inline void ata_scsi_dump_cdb(struct ata_port *ap, | |||
2433 | #endif | 2429 | #endif |
2434 | } | 2430 | } |
2435 | 2431 | ||
2436 | static inline void __ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | 2432 | static inline void __ata_scsi_queuecmd(struct scsi_cmnd *cmd, |
2437 | struct ata_port *ap, struct ata_device *dev) | 2433 | void (*done)(struct scsi_cmnd *), |
2434 | struct ata_device *dev) | ||
2438 | { | 2435 | { |
2439 | if (dev->class == ATA_DEV_ATA) { | 2436 | if (dev->class == ATA_DEV_ATA) { |
2440 | ata_xlat_func_t xlat_func = ata_get_xlat_func(dev, | 2437 | ata_xlat_func_t xlat_func = ata_get_xlat_func(dev, |
2441 | cmd->cmnd[0]); | 2438 | cmd->cmnd[0]); |
2442 | 2439 | ||
2443 | if (xlat_func) | 2440 | if (xlat_func) |
2444 | ata_scsi_translate(ap, dev, cmd, done, xlat_func); | 2441 | ata_scsi_translate(dev, cmd, done, xlat_func); |
2445 | else | 2442 | else |
2446 | ata_scsi_simulate(ap, dev, cmd, done); | 2443 | ata_scsi_simulate(dev, cmd, done); |
2447 | } else | 2444 | } else |
2448 | ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); | 2445 | ata_scsi_translate(dev, cmd, done, atapi_xlat); |
2449 | } | 2446 | } |
2450 | 2447 | ||
2451 | /** | 2448 | /** |
@@ -2483,7 +2480,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
2483 | 2480 | ||
2484 | dev = ata_scsi_find_dev(ap, scsidev); | 2481 | dev = ata_scsi_find_dev(ap, scsidev); |
2485 | if (likely(dev)) | 2482 | if (likely(dev)) |
2486 | __ata_scsi_queuecmd(cmd, done, ap, dev); | 2483 | __ata_scsi_queuecmd(cmd, done, dev); |
2487 | else { | 2484 | else { |
2488 | cmd->result = (DID_BAD_TARGET << 16); | 2485 | cmd->result = (DID_BAD_TARGET << 16); |
2489 | done(cmd); | 2486 | done(cmd); |
@@ -2496,7 +2493,6 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
2496 | 2493 | ||
2497 | /** | 2494 | /** |
2498 | * ata_scsi_simulate - simulate SCSI command on ATA device | 2495 | * ata_scsi_simulate - simulate SCSI command on ATA device |
2499 | * @ap: port the device is connected to | ||
2500 | * @dev: the target device | 2496 | * @dev: the target device |
2501 | * @cmd: SCSI command being sent to device. | 2497 | * @cmd: SCSI command being sent to device. |
2502 | * @done: SCSI command completion function. | 2498 | * @done: SCSI command completion function. |
@@ -2508,14 +2504,12 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
2508 | * spin_lock_irqsave(host_set lock) | 2504 | * spin_lock_irqsave(host_set lock) |
2509 | */ | 2505 | */ |
2510 | 2506 | ||
2511 | void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, | 2507 | void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, |
2512 | struct scsi_cmnd *cmd, | ||
2513 | void (*done)(struct scsi_cmnd *)) | 2508 | void (*done)(struct scsi_cmnd *)) |
2514 | { | 2509 | { |
2515 | struct ata_scsi_args args; | 2510 | struct ata_scsi_args args; |
2516 | const u8 *scsicmd = cmd->cmnd; | 2511 | const u8 *scsicmd = cmd->cmnd; |
2517 | 2512 | ||
2518 | args.ap = ap; | ||
2519 | args.dev = dev; | 2513 | args.dev = dev; |
2520 | args.id = dev->id; | 2514 | args.id = dev->id; |
2521 | args.cmd = cmd; | 2515 | args.cmd = cmd; |
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 6442c2f1a80c..c9ff83bbcfae 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -32,7 +32,6 @@ | |||
32 | #define DRV_VERSION "1.30" /* must be exactly four chars */ | 32 | #define DRV_VERSION "1.30" /* must be exactly four chars */ |
33 | 33 | ||
34 | struct ata_scsi_args { | 34 | struct ata_scsi_args { |
35 | struct ata_port *ap; | ||
36 | struct ata_device *dev; | 35 | struct ata_device *dev; |
37 | u16 *id; | 36 | u16 *id; |
38 | struct scsi_cmnd *cmd; | 37 | struct scsi_cmnd *cmd; |
@@ -43,18 +42,16 @@ struct ata_scsi_args { | |||
43 | extern int atapi_enabled; | 42 | extern int atapi_enabled; |
44 | extern int atapi_dmadir; | 43 | extern int atapi_dmadir; |
45 | extern int libata_fua; | 44 | extern int libata_fua; |
46 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 45 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); |
47 | struct ata_device *dev); | ||
48 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 46 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
49 | extern void ata_dev_disable(struct ata_port *ap, struct ata_device *dev); | 47 | extern void ata_dev_disable(struct ata_device *dev); |
50 | extern void ata_port_flush_task(struct ata_port *ap); | 48 | extern void ata_port_flush_task(struct ata_port *ap); |
51 | extern unsigned ata_exec_internal(struct ata_port *ap, struct ata_device *dev, | 49 | extern unsigned ata_exec_internal(struct ata_device *dev, |
52 | struct ata_taskfile *tf, const u8 *cdb, | 50 | struct ata_taskfile *tf, const u8 *cdb, |
53 | int dma_dir, void *buf, unsigned int buflen); | 51 | int dma_dir, void *buf, unsigned int buflen); |
54 | extern int sata_down_spd_limit(struct ata_port *ap); | 52 | extern int sata_down_spd_limit(struct ata_port *ap); |
55 | extern int sata_set_spd_needed(struct ata_port *ap); | 53 | extern int sata_set_spd_needed(struct ata_port *ap); |
56 | extern int ata_down_xfermask_limit(struct ata_port *ap, struct ata_device *dev, | 54 | extern int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0); |
57 | int force_pio0); | ||
58 | extern int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev); | 55 | extern int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev); |
59 | extern int ata_do_reset(struct ata_port *ap, ata_reset_fn_t reset, | 56 | extern int ata_do_reset(struct ata_port *ap, ata_reset_fn_t reset, |
60 | unsigned int *classes); | 57 | unsigned int *classes); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index ac2d2cc78b10..8154b366bbd1 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -518,8 +518,7 @@ extern void ata_std_probeinit(struct ata_port *ap); | |||
518 | extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes); | 518 | extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes); |
519 | extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class); | 519 | extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class); |
520 | extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); | 520 | extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); |
521 | extern int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev, | 521 | extern int ata_dev_revalidate(struct ata_device *dev, int post_reset); |
522 | int post_reset); | ||
523 | extern void ata_port_disable(struct ata_port *); | 522 | extern void ata_port_disable(struct ata_port *); |
524 | extern void ata_std_ports(struct ata_ioports *ioaddr); | 523 | extern void ata_std_ports(struct ata_ioports *ioaddr); |
525 | #ifdef CONFIG_PCI | 524 | #ifdef CONFIG_PCI |
@@ -545,8 +544,8 @@ extern int ata_port_online(struct ata_port *ap); | |||
545 | extern int ata_port_offline(struct ata_port *ap); | 544 | extern int ata_port_offline(struct ata_port *ap); |
546 | extern int ata_scsi_device_resume(struct scsi_device *); | 545 | extern int ata_scsi_device_resume(struct scsi_device *); |
547 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); | 546 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); |
548 | extern int ata_device_resume(struct ata_port *, struct ata_device *); | 547 | extern int ata_device_resume(struct ata_device *); |
549 | extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state); | 548 | extern int ata_device_suspend(struct ata_device *, pm_message_t state); |
550 | extern int ata_ratelimit(void); | 549 | extern int ata_ratelimit(void); |
551 | extern unsigned int ata_busy_sleep(struct ata_port *ap, | 550 | extern unsigned int ata_busy_sleep(struct ata_port *ap, |
552 | unsigned long timeout_pat, | 551 | unsigned long timeout_pat, |
@@ -592,15 +591,13 @@ extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | |||
592 | extern u8 ata_bmdma_status(struct ata_port *ap); | 591 | extern u8 ata_bmdma_status(struct ata_port *ap); |
593 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | 592 | extern void ata_bmdma_irq_clear(struct ata_port *ap); |
594 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); | 593 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); |
595 | extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, | 594 | extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, |
596 | struct scsi_cmnd *cmd, | ||
597 | void (*done)(struct scsi_cmnd *)); | 595 | void (*done)(struct scsi_cmnd *)); |
598 | extern int ata_std_bios_param(struct scsi_device *sdev, | 596 | extern int ata_std_bios_param(struct scsi_device *sdev, |
599 | struct block_device *bdev, | 597 | struct block_device *bdev, |
600 | sector_t capacity, int geom[]); | 598 | sector_t capacity, int geom[]); |
601 | extern int ata_scsi_slave_config(struct scsi_device *sdev); | 599 | extern int ata_scsi_slave_config(struct scsi_device *sdev); |
602 | extern struct ata_device *ata_dev_pair(struct ata_port *ap, | 600 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
603 | struct ata_device *adev); | ||
604 | 601 | ||
605 | /* | 602 | /* |
606 | * Timing helpers | 603 | * Timing helpers |
@@ -812,12 +809,12 @@ static inline struct ata_queued_cmd *ata_qc_from_tag (struct ata_port *ap, | |||
812 | return NULL; | 809 | return NULL; |
813 | } | 810 | } |
814 | 811 | ||
815 | static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, unsigned int device) | 812 | static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf) |
816 | { | 813 | { |
817 | memset(tf, 0, sizeof(*tf)); | 814 | memset(tf, 0, sizeof(*tf)); |
818 | 815 | ||
819 | tf->ctl = ap->ctl; | 816 | tf->ctl = dev->ap->ctl; |
820 | if (device == 0) | 817 | if (dev->devno == 0) |
821 | tf->device = ATA_DEVICE_OBS; | 818 | tf->device = ATA_DEVICE_OBS; |
822 | else | 819 | else |
823 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; | 820 | tf->device = ATA_DEVICE_OBS | ATA_DEV1; |
@@ -832,7 +829,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc) | |||
832 | qc->nbytes = qc->curbytes = 0; | 829 | qc->nbytes = qc->curbytes = 0; |
833 | qc->err_mask = 0; | 830 | qc->err_mask = 0; |
834 | 831 | ||
835 | ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); | 832 | ata_tf_init(qc->dev, &qc->tf); |
836 | 833 | ||
837 | /* init result_tf such that it indicates normal completion */ | 834 | /* init result_tf such that it indicates normal completion */ |
838 | qc->result_tf.command = ATA_DRDY; | 835 | qc->result_tf.command = ATA_DRDY; |