From: tom.ty89@gmail.com
To: tj@kernel.org, sergei.shtylyov@cogentembedded.com
Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
Tom Yan <tom.ty89@gmail.com>
Subject: [PATCH v4] libata-scsi: minor cleanup in ata_mselect_*()
Date: Wed, 20 Jul 2016 05:11:50 +0800 [thread overview]
Message-ID: <578e979d.d40c620a.f5800.0924@mx.google.com> (raw)
In-Reply-To: <578e9008.4500420a.2d828.d131@mx.google.com>
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 b00521b..06afe63 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3604,7 +3604,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;
@@ -3613,8 +3612,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.
*/
@@ -3628,6 +3625,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;
@@ -3660,7 +3659,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;
@@ -3669,8 +3667,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.
*/
@@ -3683,7 +3679,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
next prev parent reply other threads:[~2016-07-19 21:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160712133703.2076-1-me>
2016-07-12 13:37 ` [PATCH v3 2/2] libata-scsi: better style in ata_msense_caching() tom.ty89
2016-07-12 14:48 ` Tejun Heo
2016-07-12 16:20 ` Tom Yan
2016-07-12 17:20 ` Tejun Heo
2016-07-12 17:54 ` Tom Yan
2016-07-19 20:39 ` [PATCH v4] libata-scsi: better style in ata_msense_*() tom.ty89
2016-07-19 20:44 ` Tom Yan
2016-07-19 21:11 ` tom.ty89 [this message]
2016-07-19 22:50 ` [PATCH] libata-scsi: fix read-only bits checking in ata_mselect_*() tom.ty89
2016-07-19 22:59 ` Tom Yan
2016-07-19 22:59 ` [PATCH v2] " tom.ty89
2016-07-20 15:25 ` Tejun Heo
2016-07-20 17:20 ` Tejun Heo
2016-07-19 23:03 ` [PATCH v4] libata-scsi: minor cleanup " Tom Yan
2016-07-20 15:22 ` Tejun Heo
2016-07-20 15:22 ` [PATCH v4] libata-scsi: better style in ata_msense_*() Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=578e979d.d40c620a.f5800.0924@mx.google.com \
--to=tom.ty89@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.