From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, albertcc@tw.ibm.com, linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 4/5] libata: separate out ata_id_major_version()
Date: Sun, 12 Feb 2006 22:47:04 +0900 [thread overview]
Message-ID: <11397520242979-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11397520242602-git-send-email-htejun@gmail.com>
Separate out ATA major version calculation from ata_dev_identify()
into ata_id_major_version(). It's preparation for splitting
ata_dev_identify().
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/scsi/libata-core.c | 6 +-----
include/linux/ata.h | 10 ++++++++++
2 files changed, 11 insertions(+), 5 deletions(-)
66ee6dfccf92daec72aa80724f37f26abfb3352d
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 1fe63ee..7bb99b0 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -927,7 +927,6 @@ static void ata_dev_identify(struct ata_
{
struct ata_device *dev = &ap->device[device];
unsigned int major_version;
- u16 tmp;
unsigned long xfer_modes;
unsigned int using_edd;
struct ata_taskfile tf;
@@ -1030,10 +1029,7 @@ retry:
goto err_out_nosup;
/* get major version */
- tmp = dev->id[ATA_ID_MAJOR_VER];
- for (major_version = 14; major_version >= 1; major_version--)
- if (tmp & (1 << major_version))
- break;
+ major_version = ata_id_major_version(dev->id);
/*
* The exact sequence expected by certain pre-ATA4 drives is:
diff --git a/include/linux/ata.h b/include/linux/ata.h
index a8155ca..b02a16c 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -267,6 +267,16 @@ struct ata_taskfile {
((u64) (id)[(n) + 1] << 16) | \
((u64) (id)[(n) + 0]) )
+static inline unsigned int ata_id_major_version(const u16 *id)
+{
+ unsigned int mver;
+
+ for (mver = 14; mver >= 1; mver--)
+ if (id[ATA_ID_MAJOR_VER] & (1 << mver))
+ break;
+ return mver;
+}
+
static inline int ata_id_current_chs_valid(const u16 *id)
{
/* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
--
1.1.5
next prev parent reply other threads:[~2006-02-12 13:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-12 13:47 [PATCHSET] libata: misc preps for configuration reorganization Tejun Heo
2006-02-12 13:47 ` Tejun Heo [this message]
2006-02-12 13:47 ` [PATCH 2/5] libata: use ata_dev_id_c_string() Tejun Heo
2006-02-12 13:47 ` [PATCH 1/5] libata: implement ata_dev_id_c_string() Tejun Heo
2006-02-12 19:25 ` Jeff Garzik
2006-02-13 1:02 ` [PATCH] libata: rename ata_dev_id_[c_]string() Tejun Heo
2006-02-15 2:00 ` Tejun Heo
2006-02-20 9:54 ` Jeff Garzik
2006-02-12 13:47 ` [PATCH 5/5] libata: make ata_dump_id() take @id instead of @dev 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=11397520242979-git-send-email-htejun@gmail.com \
--to=htejun@gmail.com \
--cc=albertcc@tw.ibm.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.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.