Thread (18 messages) 18 messages, 5 authors, 2017-06-06

Re: [PATCH 4/6] libata: factor out a ata_identify_page_supported helper

From: Sergei Shtylyov <hidden>
Date: 2017-06-05 12:46:42
Also in: linux-ide, linux-scsi

Hello!

On 06/04/2017 03:42 PM, Christoph Hellwig wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/ata/libata-core.c | 59 +++++++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 27 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 445e7050637b..f57131115594 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2120,6 +2120,37 @@ static bool ata_log_supported(struct ata_device *dev, u8 log)
 	return get_unaligned_le16(&ap->sector_buf[log * 2]) ? true : false;
 }

+static bool ata_identify_page_supported(struct ata_device *dev, u8 page)
+{
+	struct ata_port *ap = dev->link->ap;
+	unsigned int err, i;
+
+	if (!ata_log_supported(dev, ATA_LOG_IDENTIFY_DEVICE)) {
+		ata_dev_warn(dev, "ATA Identify Device Log not supported\n");
+		return false;
+	}
+
+	/*
+	 * Read IDENTIFY DEVICE data log, page 0, to figure out if the page is
+	 * supported.
+	 */
+	err = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE, 0, ap->sector_buf,
+			1);
+	if (err) {
+		ata_dev_info(dev,
+			     "failed to get Device Identify Log Emask 0x%x\n",
+			     err);
    Your line continuation style is spomewhat inconsistent: 2 tabs above and 
tabs/spaces here...

[...]

MBR, Sergei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help