浏览代码

[PATCH] libata: ignore CFA signature while sanity-checking an ATAPI device

0x848a in ID word 0 indicates CFA device iff the ID data is obtained from
IDENTIFY DEVICE.  For ATAPI devices, 0x848a in ID work 0 indicates valid
ATAPI device.  Fix sanity check in ata_dev_read_id() such that ATAPI
devices reporting 0x848a in ID word 0 is not handled as error.

The problem is identified by J.A.  Magallon with HL-DT-ST DVDRAM GSA-4120B.

Signed-off-by: Tejun Helo <htejun@gmail.com>
Cc: J.A. Magallon <jamagallon@ono.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Tejun Heo 18 年之前
父节点
当前提交
a4f5749ba6
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      drivers/scsi/libata-core.c

+ 9 - 4
drivers/scsi/libata-core.c

@@ -1256,10 +1256,15 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 	swap_buf_le16(id, ATA_ID_WORDS);
 
 	/* sanity check */
-	if ((class == ATA_DEV_ATA) != (ata_id_is_ata(id) | ata_id_is_cfa(id))) {
-		rc = -EINVAL;
-		reason = "device reports illegal type";
-		goto err_out;
+	rc = -EINVAL;
+	reason = "device reports illegal type";
+
+	if (class == ATA_DEV_ATA) {
+		if (!ata_id_is_ata(id) && !ata_id_is_cfa(id))
+			goto err_out;
+	} else {
+		if (ata_id_is_ata(id))
+			goto err_out;
 	}
 
 	if (post_reset && class == ATA_DEV_ATA) {