Re: [PATCH] ide/libata: fix ata_id_is_cfa()

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

 



Alan Cox wrote:
This is what I would favour:

libata: Fix CFA detection & improve version inlines

From: Alan Cox <alan@xxxxxxxxxx>

Sergei Shtylyov noticed thae ata_id_is_cfa checked the wrong word for the
secondary CFA test and posted a patch set to improve this, but which
removed the version checks.

This patch keeps the version checks but incorporates the other suggestions
Sergei made including a better ata version check for the usual case where
we want to know "is version >= x" rather than "what version do you
support".

Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>

diff --git a/include/linux/ata.h b/include/linux/ata.h
index a53318b..e35d8de 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -675,6 +675,13 @@ static inline unsigned int ata_id_major_version(const u16 *id)
 	return mver;
 }
+static inline int ata_id_has_version(const u16 *id, int v)
+{
+	if (id[ATA_ID_MAJOR_VER] == 0xFFFF)
+		return 0;
+	return (id[ATA_ID_MAJOR_VER] & (1 << v)) ? 1 : 0;

   Refer to afa_dev_cf_sata() on how it's done in really optimal way.

WBR, Sergei
--
To unsubscribe from this list: 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