From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk, linux-kernel@vger.kernel.org,
donari75@gmail.com, bzolnier@gmail.com, joerg@dorchain.net,
geert@linux-m68k.org, davem@davemloft.net, jdike@linux.intel.com,
benh@kernel.crashing.org, Laurent@lvivier.info
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 13/14] mg_disk: fix dependency on libata
Date: Tue, 28 Apr 2009 13:06:16 +0900 [thread overview]
Message-ID: <1240891577-4813-14-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1240891577-4813-1-git-send-email-tj@kernel.org>
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add local copies of ata_id_string() and ata_id_c_string() to mg_disk
so there is no need for the driver to depend on ATA and SCSI.
[ Impact: break dependency on libata by copying ata id string functions ]
Cc: unsik Kim <donari75@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
---
drivers/block/Kconfig | 2 +-
drivers/block/mg_disk.c | 44 ++++++++++++++++++++++++++++++++++++++++----
2 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index ddea8e4..f42fa50 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -412,7 +412,7 @@ config ATA_OVER_ETH
config MG_DISK
tristate "mGine mflash, gflash support"
- depends on ARM && ATA && GPIOLIB
+ depends on ARM && GPIOLIB
help
mGine mFlash(gFlash) block device driver
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 1a4cc96..8e53cae 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -17,7 +17,7 @@
#include <linux/fs.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
-#include <linux/libata.h>
+#include <linux/ata.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
@@ -357,6 +357,42 @@ static irqreturn_t mg_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
+/* local copy of ata_id_string() */
+static void mg_id_string(const u16 *id, unsigned char *s,
+ unsigned int ofs, unsigned int len)
+{
+ unsigned int c;
+
+ BUG_ON(len & 1);
+
+ while (len > 0) {
+ c = id[ofs] >> 8;
+ *s = c;
+ s++;
+
+ c = id[ofs] & 0xff;
+ *s = c;
+ s++;
+
+ ofs++;
+ len -= 2;
+ }
+}
+
+/* local copy of ata_id_c_string() */
+static void mg_id_c_string(const u16 *id, unsigned char *s,
+ unsigned int ofs, unsigned int len)
+{
+ unsigned char *p;
+
+ mg_id_string(id, s, ofs, len - 1);
+
+ p = s + strnlen(s, len - 1);
+ while (p > s && p[-1] == ' ')
+ p--;
+ *p = '\0';
+}
+
static int mg_get_disk_id(struct mg_host *host)
{
u32 i;
@@ -403,9 +439,9 @@ static int mg_get_disk_id(struct mg_host *host)
host->n_sectors -= host->nres_sectors;
}
- ata_id_c_string(id, fwrev, ATA_ID_FW_REV, sizeof(fwrev));
- ata_id_c_string(id, model, ATA_ID_PROD, sizeof(model));
- ata_id_c_string(id, serial, ATA_ID_SERNO, sizeof(serial));
+ mg_id_c_string(id, fwrev, ATA_ID_FW_REV, sizeof(fwrev));
+ mg_id_c_string(id, model, ATA_ID_PROD, sizeof(model));
+ mg_id_c_string(id, serial, ATA_ID_SERNO, sizeof(serial));
printk(KERN_INFO "mg_disk: model: %s\n", model);
printk(KERN_INFO "mg_disk: firm: %.8s\n", fwrev);
printk(KERN_INFO "mg_disk: serial: %s\n", serial);
--
1.6.0.2
next prev parent reply other threads:[~2009-04-28 4:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-28 4:06 [GIT PATCH linux-2.6-block#for-2.6.31] block: lld cleanup patches, take#2 Tejun Heo
2009-04-28 4:06 ` [PATCH 01/14] block: make blk_end_request_cur() return bool Tejun Heo
2009-04-28 4:06 ` [PATCH 02/14] block: don't init rq fields unnecessarily Tejun Heo
2009-04-28 4:06 ` [PATCH 03/14] amiflop,ataflop,xd,mg_disk: clean up unnecessary stuff from block drivers Tejun Heo
2009-04-28 4:06 ` [PATCH 04/14] ps3disk: simplify request completion Tejun Heo
2009-04-28 4:06 ` [PATCH 05/14] sunvdc: kill vdc_end_request() Tejun Heo
2009-04-28 4:06 ` [PATCH 06/14] ubd: cleanup completion path Tejun Heo
2009-04-28 4:06 ` [PATCH 07/14] ubd: drop unnecessary rq->sector manipulation Tejun Heo
2009-04-28 4:06 ` [PATCH 08/14] hd: clean up request completion paths Tejun Heo
2009-04-28 4:06 ` [PATCH 09/14] swim3: " Tejun Heo
2009-04-28 6:44 ` Benjamin Herrenschmidt
2009-04-28 4:06 ` [PATCH 10/14] swim: " Tejun Heo
2009-04-28 4:06 ` [PATCH 11/14] mg_disk: fold mg_disk.h into mg_disk.c Tejun Heo
2009-04-28 4:06 ` [PATCH 12/14] mg_disk: clean up request completion paths Tejun Heo
2009-04-28 4:06 ` Tejun Heo [this message]
2009-04-28 4:06 ` [PATCH 14/14] mg_disk: use defines from <linux/ata.h> Tejun Heo
2009-04-28 6:15 ` [GIT PATCH linux-2.6-block#for-2.6.31] block: lld cleanup patches, take#2 Jens Axboe
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=1240891577-4813-14-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=Laurent@lvivier.info \
--cc=axboe@kernel.dk \
--cc=benh@kernel.crashing.org \
--cc=bzolnier@gmail.com \
--cc=davem@davemloft.net \
--cc=donari75@gmail.com \
--cc=geert@linux-m68k.org \
--cc=jdike@linux.intel.com \
--cc=joerg@dorchain.net \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox