diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-04-28 00:06:16 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-28 02:14:52 -0400 |
commit | 8a11a789c39cd6f61de4243234cf44a46c23ffd0 (patch) | |
tree | ec88d32cffdf40bf13c3f83ad4220e4205666e3f /drivers/block | |
parent | a03bb5a32fff4aa23f081a3cff7e98d4084104cd (diff) |
mg_disk: fix dependency on libata
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>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/Kconfig | 2 | ||||
-rw-r--r-- | drivers/block/mg_disk.c | 44 |
2 files changed, 41 insertions, 5 deletions
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index ddea8e485cc9..f42fa50d3550 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -412,7 +412,7 @@ config ATA_OVER_ETH | |||
412 | 412 | ||
413 | config MG_DISK | 413 | config MG_DISK |
414 | tristate "mGine mflash, gflash support" | 414 | tristate "mGine mflash, gflash support" |
415 | depends on ARM && ATA && GPIOLIB | 415 | depends on ARM && GPIOLIB |
416 | help | 416 | help |
417 | mGine mFlash(gFlash) block device driver | 417 | mGine mFlash(gFlash) block device driver |
418 | 418 | ||
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index 1a4cc968cfee..8e53cae9fa90 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/blkdev.h> | 18 | #include <linux/blkdev.h> |
19 | #include <linux/hdreg.h> | 19 | #include <linux/hdreg.h> |
20 | #include <linux/libata.h> | 20 | #include <linux/ata.h> |
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
@@ -357,6 +357,42 @@ static irqreturn_t mg_irq(int irq, void *dev_id) | |||
357 | return IRQ_HANDLED; | 357 | return IRQ_HANDLED; |
358 | } | 358 | } |
359 | 359 | ||
360 | /* local copy of ata_id_string() */ | ||
361 | static void mg_id_string(const u16 *id, unsigned char *s, | ||
362 | unsigned int ofs, unsigned int len) | ||
363 | { | ||
364 | unsigned int c; | ||
365 | |||
366 | BUG_ON(len & 1); | ||
367 | |||
368 | while (len > 0) { | ||
369 | c = id[ofs] >> 8; | ||
370 | *s = c; | ||
371 | s++; | ||
372 | |||
373 | c = id[ofs] & 0xff; | ||
374 | *s = c; | ||
375 | s++; | ||
376 | |||
377 | ofs++; | ||
378 | len -= 2; | ||
379 | } | ||
380 | } | ||
381 | |||
382 | /* local copy of ata_id_c_string() */ | ||
383 | static void mg_id_c_string(const u16 *id, unsigned char *s, | ||
384 | unsigned int ofs, unsigned int len) | ||
385 | { | ||
386 | unsigned char *p; | ||
387 | |||
388 | mg_id_string(id, s, ofs, len - 1); | ||
389 | |||
390 | p = s + strnlen(s, len - 1); | ||
391 | while (p > s && p[-1] == ' ') | ||
392 | p--; | ||
393 | *p = '\0'; | ||
394 | } | ||
395 | |||
360 | static int mg_get_disk_id(struct mg_host *host) | 396 | static int mg_get_disk_id(struct mg_host *host) |
361 | { | 397 | { |
362 | u32 i; | 398 | u32 i; |
@@ -403,9 +439,9 @@ static int mg_get_disk_id(struct mg_host *host) | |||
403 | host->n_sectors -= host->nres_sectors; | 439 | host->n_sectors -= host->nres_sectors; |
404 | } | 440 | } |
405 | 441 | ||
406 | ata_id_c_string(id, fwrev, ATA_ID_FW_REV, sizeof(fwrev)); | 442 | mg_id_c_string(id, fwrev, ATA_ID_FW_REV, sizeof(fwrev)); |
407 | ata_id_c_string(id, model, ATA_ID_PROD, sizeof(model)); | 443 | mg_id_c_string(id, model, ATA_ID_PROD, sizeof(model)); |
408 | ata_id_c_string(id, serial, ATA_ID_SERNO, sizeof(serial)); | 444 | mg_id_c_string(id, serial, ATA_ID_SERNO, sizeof(serial)); |
409 | printk(KERN_INFO "mg_disk: model: %s\n", model); | 445 | printk(KERN_INFO "mg_disk: model: %s\n", model); |
410 | printk(KERN_INFO "mg_disk: firm: %.8s\n", fwrev); | 446 | printk(KERN_INFO "mg_disk: firm: %.8s\n", fwrev); |
411 | printk(KERN_INFO "mg_disk: serial: %s\n", serial); | 447 | printk(KERN_INFO "mg_disk: serial: %s\n", serial); |