[PATCH 06/12] libata: add ata_port_nr_ready()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add ready counting function - ata_port_nr_ready().  This is in
preparation for powersave support.

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>

---

 drivers/scsi/libata-core.c |   10 ++++++++++
 drivers/scsi/libata.h      |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)

efc7e0e82005a0135d9b658af156d6388c49367d
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 8e75899..3e35839 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -120,6 +120,16 @@ int ata_port_nr_enabled(struct ata_port 
 	return cnt;
 }
 
+int ata_port_nr_ready(struct ata_port *ap)
+{
+	int i, cnt = 0;
+
+	for (i = 0; i < ATA_MAX_DEVICES; i++)
+		if (ata_dev_ready(&ap->device[i]))
+			cnt++;
+	return cnt;
+}
+
 /**
  *	ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure
  *	@tf: Taskfile to convert
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index d77b5ff..ce44e06 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -50,6 +50,7 @@ extern int atapi_dmadir;
 extern int libata_fua;
 extern int ata_port_nr_vacant(struct ata_port *ap);
 extern int ata_port_nr_enabled(struct ata_port *ap);
+extern int ata_port_nr_ready(struct ata_port *ap);
 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
 extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc);
 extern void ata_dev_disable(struct ata_device *dev);
-- 
1.3.2


-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux