All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH resend 1/5] libata-scsi: minor cleanup in ata_mselect_*()
@ 2016-07-21 18:41 tom.ty89
  2016-07-21 18:41 ` [PATCH resend 2/5] libata-scsi: fix read-only bits checking " tom.ty89
  2016-07-21 18:45 ` [PATCH resend 1/5] libata-scsi: minor cleanup " Sergei Shtylyov
  0 siblings, 2 replies; 24+ messages in thread
From: tom.ty89 @ 2016-07-21 18:41 UTC (permalink / raw)
  To: tj, hare, sergei.shtylyov, arnd
  Cc: sfr, linux-ide, linux-scsi, linux-kernel, linux-next, Tom Yan

From: Tom Yan <tom.ty89@gmail.com>

1. Removed a repeated bit masking in ata_mselect_control()
2. Moved `wce`/`d_sense` assignment below the page validity checks
3. Added/Removed empty lines where appropriate

Signed-off-by: Tom Yan <tom.ty89@gmail.com>

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 2bdb5da..eb5e8ff 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3618,7 +3618,6 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
 	 * The first two bytes of def_cache_mpage are a header, so offsets
 	 * in mpage are off by 2 compared to buf.  Same for len.
 	 */
-
 	if (len != CACHE_MPAGE_LEN - 2) {
 		if (len < CACHE_MPAGE_LEN - 2)
 			*fp = len;
@@ -3627,8 +3626,6 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
 		return -EINVAL;
 	}
 
-	wce = buf[0] & (1 << 2);
-
 	/*
 	 * Check that read-only bits are not modified.
 	 */
@@ -3642,6 +3639,8 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
 		}
 	}
 
+	wce = buf[0] & (1 << 2);
+
 	tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
 	tf->protocol = ATA_PROT_NODATA;
 	tf->nsect = 0;
@@ -3674,7 +3673,6 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
 	 * The first two bytes of def_control_mpage are a header, so offsets
 	 * in mpage are off by 2 compared to buf.  Same for len.
 	 */
-
 	if (len != CONTROL_MPAGE_LEN - 2) {
 		if (len < CONTROL_MPAGE_LEN - 2)
 			*fp = len;
@@ -3683,8 +3681,6 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
 		return -EINVAL;
 	}
 
-	d_sense = buf[0] & (1 << 2);
-
 	/*
 	 * Check that read-only bits are not modified.
 	 */
@@ -3697,7 +3693,10 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
 			return -EINVAL;
 		}
 	}
-	if (d_sense & (1 << 2))
+
+	d_sense = buf[0] & (1 << 2);
+
+	if (d_sense)
 		dev->flags |= ATA_DFLAG_D_SENSE;
 	else
 		dev->flags &= ~ATA_DFLAG_D_SENSE;
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2016-08-10  3:38 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 18:41 [PATCH resend 1/5] libata-scsi: minor cleanup in ata_mselect_*() tom.ty89
2016-07-21 18:41 ` [PATCH resend 2/5] libata-scsi: fix read-only bits checking " tom.ty89
2016-07-21 18:41   ` [PATCH resend 3/5] libata-scsi: fix overflow in mode page copy tom.ty89
2016-07-21 18:41     ` [PATCH resend 4/5] libata-scsi: have all checks done before calling ata_mselect_*() tom.ty89
2016-07-21 18:41       ` [PATCH resend 5/5] libata-scsi: fix MODE SELECT translation for Control mode page tom.ty89
2016-07-21 21:26         ` Tejun Heo
2016-07-21 21:50           ` Tom Yan
2016-07-25 18:30             ` Tejun Heo
2016-07-27 21:00               ` Tom Yan
2016-08-10  3:38         ` Tejun Heo
2016-07-21 21:17     ` [PATCH resend 3/5] libata-scsi: fix overflow in mode page copy Tejun Heo
2016-07-21 21:39       ` Tom Yan
2016-07-21 21:42         ` Tejun Heo
     [not found]           ` <accc8ca07073cd0292b62903acac956f5f5eff74.1469143747.git.tom.ty89@gmail.com>
     [not found]             ` <9bbf2b818f9ca1bb48f1eae31a0f3924a4fe0d9a.1469143747.git.tom.ty89@gmail.com>
2016-07-21 23:29               ` [PATCH resend v2 3/5] libata-scsi: use u8 array to store " tom.ty89
2016-07-22  9:59                 ` Sergei Shtylyov
2016-07-22 18:22                   ` Tom Yan
2016-07-22 18:34                     ` [PATCH resend v3 " tom.ty89
2016-08-09 20:13                       ` Tejun Heo
2016-07-21 23:35           ` [PATCH resend v2 " tom.ty89
2016-07-21 23:20   ` [PATCH resend 2/5] libata-scsi: fix read-only bits checking in ata_mselect_*() Tom Yan
     [not found]     ` <accc8ca07073cd0292b62903acac956f5f5eff74.1469143271.git.tom.ty89@gmail.com>
2016-07-21 23:25       ` [PATCH resend v2 " tom.ty89
2016-07-21 23:34     ` tom.ty89
2016-07-21 18:45 ` [PATCH resend 1/5] libata-scsi: minor cleanup " Sergei Shtylyov
2016-07-21 18:51   ` Tom Yan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.