aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-01 15:42:22 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-01 15:42:22 -0400
commit4aaf2fec718f6fbf38668edf733a0ab09a49cab1 (patch)
tree2825245ceb1eaf5c62c9e68282751fb2d9881df2
parent73855e13b2bce2bb5cd2a62c270fb07f49353e02 (diff)
xsysace: make it 'struct hd_driveid'-free
* Change cf_id field in struct ace_device from 'struct hd_driveid *id' to 'u16 *id' and update driver accordingly. * Include <linux/ata.h> directly instead of through <linux/hdreg.h>. While at it: * Use ata_id_u32() macro. There should be no functional changes caused by this patch. Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/block/xsysace.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 119be3442f28..6cccdc3f5220 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -89,6 +89,7 @@
89#include <linux/delay.h> 89#include <linux/delay.h>
90#include <linux/slab.h> 90#include <linux/slab.h>
91#include <linux/blkdev.h> 91#include <linux/blkdev.h>
92#include <linux/ata.h>
92#include <linux/hdreg.h> 93#include <linux/hdreg.h>
93#include <linux/platform_device.h> 94#include <linux/platform_device.h>
94#if defined(CONFIG_OF) 95#if defined(CONFIG_OF)
@@ -208,7 +209,7 @@ struct ace_device {
208 struct gendisk *gd; 209 struct gendisk *gd;
209 210
210 /* Inserted CF card parameters */ 211 /* Inserted CF card parameters */
211 struct hd_driveid cf_id; 212 u16 cf_id[ATA_ID_WORDS];
212}; 213};
213 214
214static int ace_major; 215static int ace_major;
@@ -402,21 +403,14 @@ static void ace_dump_regs(struct ace_device *ace)
402 ace_in32(ace, ACE_CFGLBA), ace_in(ace, ACE_FATSTAT)); 403 ace_in32(ace, ACE_CFGLBA), ace_in(ace, ACE_FATSTAT));
403} 404}
404 405
405void ace_fix_driveid(struct hd_driveid *id) 406void ace_fix_driveid(u16 *id)
406{ 407{
407#if defined(__BIG_ENDIAN) 408#if defined(__BIG_ENDIAN)
408 u16 *buf = (void *)id;
409 int i; 409 int i;
410 410
411 /* All half words have wrong byte order; swap the bytes */ 411 /* All half words have wrong byte order; swap the bytes */
412 for (i = 0; i < sizeof(struct hd_driveid); i += 2, buf++) 412 for (i = 0; i < ATA_ID_WORDS; i++, id++)
413 *buf = le16_to_cpu(*buf); 413 *id = le16_to_cpu(*id);
414
415 /* Some of the data values are 32bit; swap the half words */
416 id->lba_capacity = ((id->lba_capacity >> 16) & 0x0000FFFF) |
417 ((id->lba_capacity << 16) & 0xFFFF0000);
418 id->spg = ((id->spg >> 16) & 0x0000FFFF) |
419 ((id->spg << 16) & 0xFFFF0000);
420#endif 414#endif
421} 415}
422 416
@@ -614,7 +608,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
614 break; 608 break;
615 609
616 case ACE_FSM_STATE_IDENTIFY_COMPLETE: 610 case ACE_FSM_STATE_IDENTIFY_COMPLETE:
617 ace_fix_driveid(&ace->cf_id); 611 ace_fix_driveid(&ace->cf_id[0]);
618 ace_dump_mem(&ace->cf_id, 512); /* Debug: Dump out disk ID */ 612 ace_dump_mem(&ace->cf_id, 512); /* Debug: Dump out disk ID */
619 613
620 if (ace->data_result) { 614 if (ace->data_result) {
@@ -627,9 +621,10 @@ static void ace_fsm_dostate(struct ace_device *ace)
627 ace->media_change = 0; 621 ace->media_change = 0;
628 622
629 /* Record disk parameters */ 623 /* Record disk parameters */
630 set_capacity(ace->gd, ace->cf_id.lba_capacity); 624 set_capacity(ace->gd,
625 ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
631 dev_info(ace->dev, "capacity: %i sectors\n", 626 dev_info(ace->dev, "capacity: %i sectors\n",
632 ace->cf_id.lba_capacity); 627 ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
633 } 628 }
634 629
635 /* We're done, drop to IDLE state and notify waiters */ 630 /* We're done, drop to IDLE state and notify waiters */
@@ -928,12 +923,13 @@ static int ace_release(struct gendisk *disk, fmode_t mode)
928static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) 923static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
929{ 924{
930 struct ace_device *ace = bdev->bd_disk->private_data; 925 struct ace_device *ace = bdev->bd_disk->private_data;
926 u16 *cf_id = &ace->cf_id[0];
931 927
932 dev_dbg(ace->dev, "ace_getgeo()\n"); 928 dev_dbg(ace->dev, "ace_getgeo()\n");
933 929
934 geo->heads = ace->cf_id.heads; 930 geo->heads = cf_id[ATA_ID_HEADS];
935 geo->sectors = ace->cf_id.sectors; 931 geo->sectors = cf_id[ATA_ID_SECTORS];
936 geo->cylinders = ace->cf_id.cyls; 932 geo->cylinders = cf_id[ATA_ID_CYLS];
937 933
938 return 0; 934 return 0;
939} 935}