diff options
author | Tejun Heo <htejun@gmail.com> | 2006-02-02 04:20:00 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-09 01:59:52 -0500 |
commit | 7944ea9522ce0ea32d57894b3dc2540b0bdca66e (patch) | |
tree | ad45c0cccefa40c2b91fbeee6bfa156fa04aeeb4 | |
parent | 5140788f77d71b4f05fde217adbfb0c92f28f20c (diff) |
[PATCH] libata: add probeinit component operation to ata_drive_probe_reset()
This patch adds probeinit component operation to
ata_drive_probe_reset(). If present, this new operation is called
before performing any reset. The operations's roll is to prepare @ap
for following probe-reset operations.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | drivers/scsi/libata-core.c | 9 | ||||
-rw-r--r-- | include/linux/libata.h | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 99f4bf6022ee..c36c5a9a4617 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -2485,7 +2485,8 @@ int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes) | |||
2485 | if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read) | 2485 | if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read) |
2486 | hardreset = sata_std_hardreset; | 2486 | hardreset = sata_std_hardreset; |
2487 | 2487 | ||
2488 | return ata_drive_probe_reset(ap, ata_std_softreset, hardreset, | 2488 | return ata_drive_probe_reset(ap, NULL, |
2489 | ata_std_softreset, hardreset, | ||
2489 | ata_std_postreset, classes); | 2490 | ata_std_postreset, classes); |
2490 | } | 2491 | } |
2491 | 2492 | ||
@@ -2524,6 +2525,7 @@ static int do_probe_reset(struct ata_port *ap, ata_reset_fn_t reset, | |||
2524 | /** | 2525 | /** |
2525 | * ata_drive_probe_reset - Perform probe reset with given methods | 2526 | * ata_drive_probe_reset - Perform probe reset with given methods |
2526 | * @ap: port to reset | 2527 | * @ap: port to reset |
2528 | * @probeinit: probeinit method (can be NULL) | ||
2527 | * @softreset: softreset method (can be NULL) | 2529 | * @softreset: softreset method (can be NULL) |
2528 | * @hardreset: hardreset method (can be NULL) | 2530 | * @hardreset: hardreset method (can be NULL) |
2529 | * @postreset: postreset method (can be NULL) | 2531 | * @postreset: postreset method (can be NULL) |
@@ -2552,12 +2554,15 @@ static int do_probe_reset(struct ata_port *ap, ata_reset_fn_t reset, | |||
2552 | * if classification fails, and any error code from reset | 2554 | * if classification fails, and any error code from reset |
2553 | * methods. | 2555 | * methods. |
2554 | */ | 2556 | */ |
2555 | int ata_drive_probe_reset(struct ata_port *ap, | 2557 | int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit, |
2556 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | 2558 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
2557 | ata_postreset_fn_t postreset, unsigned int *classes) | 2559 | ata_postreset_fn_t postreset, unsigned int *classes) |
2558 | { | 2560 | { |
2559 | int rc = -EINVAL; | 2561 | int rc = -EINVAL; |
2560 | 2562 | ||
2563 | if (probeinit) | ||
2564 | probeinit(ap); | ||
2565 | |||
2561 | if (softreset) { | 2566 | if (softreset) { |
2562 | rc = do_probe_reset(ap, softreset, postreset, classes); | 2567 | rc = do_probe_reset(ap, softreset, postreset, classes); |
2563 | if (rc == 0) | 2568 | if (rc == 0) |
diff --git a/include/linux/libata.h b/include/linux/libata.h index f4cd1eb734a0..e8f29cefc351 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -244,6 +244,7 @@ struct ata_queued_cmd; | |||
244 | 244 | ||
245 | /* typedefs */ | 245 | /* typedefs */ |
246 | typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); | 246 | typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); |
247 | typedef void (*ata_probeinit_fn_t)(struct ata_port *); | ||
247 | typedef int (*ata_reset_fn_t)(struct ata_port *, int, unsigned int *); | 248 | typedef int (*ata_reset_fn_t)(struct ata_port *, int, unsigned int *); |
248 | typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *); | 249 | typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *); |
249 | 250 | ||
@@ -484,6 +485,7 @@ extern void __sata_phy_reset(struct ata_port *ap); | |||
484 | extern void sata_phy_reset(struct ata_port *ap); | 485 | extern void sata_phy_reset(struct ata_port *ap); |
485 | extern void ata_bus_reset(struct ata_port *ap); | 486 | extern void ata_bus_reset(struct ata_port *ap); |
486 | extern int ata_drive_probe_reset(struct ata_port *ap, | 487 | extern int ata_drive_probe_reset(struct ata_port *ap, |
488 | ata_probeinit_fn_t probeinit, | ||
487 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | 489 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
488 | ata_postreset_fn_t postreset, unsigned int *classes); | 490 | ata_postreset_fn_t postreset, unsigned int *classes); |
489 | extern int ata_std_softreset(struct ata_port *ap, int verbose, | 491 | extern int ata_std_softreset(struct ata_port *ap, int verbose, |