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 /drivers/scsi/libata-scsi.c | |
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>
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 40 |
1 files changed, 17 insertions, 23 deletions
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; |