Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9974e7cc authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik
Browse files

[PATCH] libata: convert do_probe_reset() to ata_do_reset()



Make do_probe_reset() generic by pushing classification check into
ata_drive_probe_reset() and rename it to ata_do_reset().  This will be
used by EH reset.

Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 4c360c81
Loading
Loading
Loading
Loading
+16 −13
Original line number Original line Diff line number Diff line
@@ -2371,16 +2371,16 @@ int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes)
				     ata_std_postreset, classes);
				     ata_std_postreset, classes);
}
}


static int do_probe_reset(struct ata_port *ap, ata_reset_fn_t reset,
static int ata_do_reset(struct ata_port *ap,
			  ata_postreset_fn_t postreset,
			ata_reset_fn_t reset, ata_postreset_fn_t postreset,
			  unsigned int *classes)
			int verbose, unsigned int *classes)
{
{
	int i, rc;
	int i, rc;


	for (i = 0; i < ATA_MAX_DEVICES; i++)
	for (i = 0; i < ATA_MAX_DEVICES; i++)
		classes[i] = ATA_DEV_UNKNOWN;
		classes[i] = ATA_DEV_UNKNOWN;


	rc = reset(ap, 0, classes);
	rc = reset(ap, verbose, classes);
	if (rc)
	if (rc)
		return rc;
		return rc;


@@ -2400,7 +2400,7 @@ static int do_probe_reset(struct ata_port *ap, ata_reset_fn_t reset,
	if (postreset)
	if (postreset)
		postreset(ap, classes);
		postreset(ap, classes);


	return classes[0] != ATA_DEV_UNKNOWN ? 0 : -ENODEV;
	return 0;
}
}


/**
/**
@@ -2445,21 +2445,24 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
		probeinit(ap);
		probeinit(ap);


	if (softreset) {
	if (softreset) {
		rc = do_probe_reset(ap, softreset, postreset, classes);
		rc = ata_do_reset(ap, softreset, postreset, 0, classes);
		if (rc == 0)
		if (rc == 0 && classes[0] != ATA_DEV_UNKNOWN)
			return 0;
			goto done;
	}
	}


	if (!hardreset)
	if (!hardreset)
		return rc;
		goto done;


	rc = do_probe_reset(ap, hardreset, postreset, classes);
	rc = ata_do_reset(ap, hardreset, postreset, 0, classes);
	if (rc == 0 || rc != -ENODEV)
	if (rc || classes[0] != ATA_DEV_UNKNOWN)
		return rc;
		goto done;


	if (softreset)
	if (softreset)
		rc = do_probe_reset(ap, softreset, postreset, classes);
		rc = ata_do_reset(ap, softreset, postreset, 0, classes);


 done:
	if (rc == 0 && classes[0] == ATA_DEV_UNKNOWN)
		rc = -ENODEV;
	return rc;
	return rc;
}
}