Skip to contentSkip to conversation

libata-scsi: fix D_SENSE bit relection in control mode page

PATCH Superseded [email protected] 2 participants 3 messages Jul 12, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata-scsi: fix D_SENSE bit relection in control mode page

From: Tom Yan <[email protected]>

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").

drivers/ata/libata-scsi.c +1 -1
index bfec66f..7e24f0a 100644
@@ -2446,7 +2446,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);
 }
Signature · 1 line
2.9.0
author
#1 lore raw

Btw, why is the MODE SELECT function called ata_mselect_control() while the MODE SENSE function is called ata_msense_ctl_mode()? Shouldn't we make their names consistent?

Quoted 25 lines · On 13 July 2016 at 01:35, <[email protected]> wrote:

From: Tom Yan <[email protected]>

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").

drivers/ata/libata-scsi.c +1 -2
index bfec66f..7e24f0a 100644
@@ -2446,7 +2446,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);
 }
--

2.9.0

#2 lore raw
Quoted 3 lines · Tom Yan

Btw, why is the MODE SELECT function called ata_mselect_control() while the MODE SENSE function is called ata_msense_ctl_mode()? Shouldn't we make their names consistent?

Sure, please go ahead.

Thanks.

Signature · 1 line
tejun