/* RETURNS: Number of executed taskfiles on success, 0 if _GTF doesn't exist. -errno on other errors.  */
static int ata_acpi_exec_tfs(struct ata_device *dev, int *nr_executed)
/* RETURNS: Number of executed taskfiles on success, 0 if _GTF doesn't exist. -errno on other errors.  */
static int ata_acpi_exec_tfs(struct ata_device *dev, int *nr_executed)
{
	struct ata_acpi_gtf *gtf = NULL, *pgtf = NULL;
	int gtf_count, i, rc;
	rc = ata_dev_get_GTF(dev, &gtf);
	if (rc < 0)
		return rc;
	gtf_count = rc;
	for (i = 0; i < gtf_count; i++, gtf++) {
		rc = ata_acpi_run_tf(dev, gtf, pgtf);
		if (rc < 0)
			break;
		if (rc) {
			(*nr_executed)++;
			pgtf = gtf;
		}
	}
	ata_acpi_clear_gtf(dev);
	if (rc < 0)
		return rc;
	return 0;
}