[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>
This commit is contained in:
Tejun Heo 2006-02-02 18:20:00 +09:00 committed by Jeff Garzik
parent 5140788f77
commit 7944ea9522
2 changed files with 9 additions and 2 deletions

View File

@ -2485,7 +2485,8 @@ int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes)
if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read) if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read)
hardreset = sata_std_hardreset; hardreset = sata_std_hardreset;
return ata_drive_probe_reset(ap, ata_std_softreset, hardreset, return ata_drive_probe_reset(ap, NULL,
ata_std_softreset, hardreset,
ata_std_postreset, classes); ata_std_postreset, classes);
} }
@ -2524,6 +2525,7 @@ static int do_probe_reset(struct ata_port *ap, ata_reset_fn_t reset,
/** /**
* ata_drive_probe_reset - Perform probe reset with given methods * ata_drive_probe_reset - Perform probe reset with given methods
* @ap: port to reset * @ap: port to reset
* @probeinit: probeinit method (can be NULL)
* @softreset: softreset method (can be NULL) * @softreset: softreset method (can be NULL)
* @hardreset: hardreset method (can be NULL) * @hardreset: hardreset method (can be NULL)
* @postreset: postreset method (can be NULL) * @postreset: postreset method (can be NULL)
@ -2552,12 +2554,15 @@ static int do_probe_reset(struct ata_port *ap, ata_reset_fn_t reset,
* if classification fails, and any error code from reset * if classification fails, and any error code from reset
* methods. * methods.
*/ */
int ata_drive_probe_reset(struct ata_port *ap, int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
ata_postreset_fn_t postreset, unsigned int *classes) ata_postreset_fn_t postreset, unsigned int *classes)
{ {
int rc = -EINVAL; int rc = -EINVAL;
if (probeinit)
probeinit(ap);
if (softreset) { if (softreset) {
rc = do_probe_reset(ap, softreset, postreset, classes); rc = do_probe_reset(ap, softreset, postreset, classes);
if (rc == 0) if (rc == 0)

View File

@ -244,6 +244,7 @@ struct ata_queued_cmd;
/* typedefs */ /* typedefs */
typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
typedef void (*ata_probeinit_fn_t)(struct ata_port *);
typedef int (*ata_reset_fn_t)(struct ata_port *, int, unsigned int *); typedef int (*ata_reset_fn_t)(struct ata_port *, int, unsigned int *);
typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *); typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *);
@ -484,6 +485,7 @@ extern void __sata_phy_reset(struct ata_port *ap);
extern void sata_phy_reset(struct ata_port *ap); extern void sata_phy_reset(struct ata_port *ap);
extern void ata_bus_reset(struct ata_port *ap); extern void ata_bus_reset(struct ata_port *ap);
extern int ata_drive_probe_reset(struct ata_port *ap, extern int ata_drive_probe_reset(struct ata_port *ap,
ata_probeinit_fn_t probeinit,
ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
ata_postreset_fn_t postreset, unsigned int *classes); ata_postreset_fn_t postreset, unsigned int *classes);
extern int ata_std_softreset(struct ata_port *ap, int verbose, extern int ata_std_softreset(struct ata_port *ap, int verbose,