libata-scsi: fix D_SENSE bit relection in control mode page
authorTom Yan <tom.ty89@gmail.com>
Tue, 12 Jul 2016 18:54:11 +0000 (02:54 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 12 Jul 2016 18:58:43 +0000 (14:58 -0400)
The bit should always be set to 1 when the requested version of
page is "changeable" because we've made it so in ata_mselect_control().
Also, it should always be set to 1 if ATA_DFLAG_D_SENSE is set (when
the requested version of page is "current" or "default").

Signed-off-by: Tom Yan <tom.ty89@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/libata-scsi.c

index f6888fca4b5ff18822fb63deadc10684df0ab292..9c7c9f28ac23a3ab371edba13eee72e7a56bec58 100644 (file)
@@ -2451,7 +2451,7 @@ static unsigned int ata_msense_ctl_mode(struct ata_device *dev, u8 *buf,
                                        bool changeable)
 {
        modecpy(buf, def_control_mpage, sizeof(def_control_mpage), changeable);
-       if (changeable && (dev->flags & ATA_DFLAG_D_SENSE))
+       if (changeable || (dev->flags & ATA_DFLAG_D_SENSE))
                buf[2] |= (1 << 2);     /* Descriptor sense requested */
        return sizeof(def_control_mpage);
 }