diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:19 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:19 -0400 |
commit | 4dde4492d850a4c9bcaa92e5bd7f4eebe3e2f5ab (patch) | |
tree | ee3be70390e4c617b44329edef0a05039f59c81a /include/linux | |
parent | 5b90e990928919ae411a68b865e8a6ecac09a603 (diff) |
ide: make drive->id an union (take 2)
Make drive->id an unnamed union so id can be accessed either by using
'u16 *id' or 'struct hd_driveid *driveid'. Then convert all existing
drive->id users accordingly (using 'u16 *id' when possible).
This is an intermediate step to make ide 'struct hd_driveid'-free.
While at it:
- Add missing KERN_CONTs in it821x.c.
- Use ATA_ID_WORDS and ATA_ID_*_LEN defines.
- Remove unnecessary checks for drive->id.
- s/drive_table/table/ in ide_in_drive_list().
- Cleanup ide_config_drive_speed() a bit.
- s/drive1/dev1/ & s/drive0/dev0/ in ide_undecoded_slave().
v2:
Fix typo in drivers/ide/ppc/pmac.c. (From Stephen Rothwell)
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/ide.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index 6514db8fd2e4..0c85aff3edf1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -380,7 +380,11 @@ struct ide_drive_s { | |||
380 | struct request *rq; /* current request */ | 380 | struct request *rq; /* current request */ |
381 | struct ide_drive_s *next; /* circular list of hwgroup drives */ | 381 | struct ide_drive_s *next; /* circular list of hwgroup drives */ |
382 | void *driver_data; /* extra driver data */ | 382 | void *driver_data; /* extra driver data */ |
383 | struct hd_driveid *id; /* drive model identification info */ | 383 | union { |
384 | /* identification info */ | ||
385 | struct hd_driveid *driveid; | ||
386 | u16 *id; | ||
387 | }; | ||
384 | #ifdef CONFIG_IDE_PROC_FS | 388 | #ifdef CONFIG_IDE_PROC_FS |
385 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 389 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
386 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ | 390 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ |
@@ -920,7 +924,7 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); | |||
920 | 924 | ||
921 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); | 925 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
922 | 926 | ||
923 | extern void ide_fix_driveid(struct hd_driveid *); | 927 | void ide_fix_driveid(u16 *); |
924 | 928 | ||
925 | extern void ide_fixstring(u8 *, const int, const int); | 929 | extern void ide_fixstring(u8 *, const int, const int); |
926 | 930 | ||
@@ -1240,7 +1244,7 @@ struct drive_list_entry { | |||
1240 | const char *id_firmware; | 1244 | const char *id_firmware; |
1241 | }; | 1245 | }; |
1242 | 1246 | ||
1243 | int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); | 1247 | int ide_in_drive_list(u16 *, const struct drive_list_entry *); |
1244 | 1248 | ||
1245 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1249 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1246 | int __ide_dma_bad_drive(ide_drive_t *); | 1250 | int __ide_dma_bad_drive(ide_drive_t *); |
@@ -1347,12 +1351,13 @@ const char *ide_xfer_verbose(u8 mode); | |||
1347 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); | 1351 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
1348 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | 1352 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); |
1349 | 1353 | ||
1350 | static inline int ide_dev_has_iordy(struct hd_driveid *id) | 1354 | static inline int ide_dev_has_iordy(u16 *id) |
1351 | { | 1355 | { |
1352 | return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; | 1356 | return ((id[ATA_ID_FIELD_VALID] & 2) && |
1357 | (((struct hd_driveid *)id)->capability & 8)) ? 1 : 0; | ||
1353 | } | 1358 | } |
1354 | 1359 | ||
1355 | static inline int ide_dev_is_sata(struct hd_driveid *id) | 1360 | static inline int ide_dev_is_sata(u16 *id) |
1356 | { | 1361 | { |
1357 | /* | 1362 | /* |
1358 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | 1363 | * See if word 93 is 0 AND drive is at least ATA-5 compatible |
@@ -1360,7 +1365,7 @@ static inline int ide_dev_is_sata(struct hd_driveid *id) | |||
1360 | * this trick allows us to filter out the reserved values of | 1365 | * this trick allows us to filter out the reserved values of |
1361 | * 0x0000 and 0xffff along with the earlier ATA revisions... | 1366 | * 0x0000 and 0xffff along with the earlier ATA revisions... |
1362 | */ | 1367 | */ |
1363 | if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020) | 1368 | if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) |
1364 | return 1; | 1369 | return 1; |
1365 | return 0; | 1370 | return 0; |
1366 | } | 1371 | } |
@@ -1437,11 +1442,11 @@ extern struct bus_type ide_bus_type; | |||
1437 | extern struct class *ide_port_class; | 1442 | extern struct class *ide_port_class; |
1438 | 1443 | ||
1439 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ | 1444 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ |
1440 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) | 1445 | #define ide_id_has_flush_cache(id) ((id)[ATA_ID_CFS_ENABLE_2] & 0x3000) |
1441 | 1446 | ||
1442 | /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ | 1447 | /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ |
1443 | #define ide_id_has_flush_cache_ext(id) \ | 1448 | #define ide_id_has_flush_cache_ext(id) \ |
1444 | (((id)->cfs_enable_2 & 0x2400) == 0x2400) | 1449 | (((id)[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400) |
1445 | 1450 | ||
1446 | static inline void ide_dump_identify(u8 *id) | 1451 | static inline void ide_dump_identify(u8 *id) |
1447 | { | 1452 | { |