aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-lib.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:19 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:19 -0400
commit4dde4492d850a4c9bcaa92e5bd7f4eebe3e2f5ab (patch)
treeee3be70390e4c617b44329edef0a05039f59c81a /drivers/ide/ide-lib.c
parent5b90e990928919ae411a68b865e8a6ecac09a603 (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 'drivers/ide/ide-lib.c')
-rw-r--r--drivers/ide/ide-lib.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 97fefabea8b8..3066d7e75c73 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -90,29 +90,31 @@ static u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
90 90
91u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) 91u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
92{ 92{
93 int pio_mode; 93 u16 *id = drive->id;
94 struct hd_driveid* id = drive->id; 94 int pio_mode = -1, overridden = 0;
95 int overridden = 0;
96 95
97 if (mode_wanted != 255) 96 if (mode_wanted != 255)
98 return min_t(u8, mode_wanted, max_mode); 97 return min_t(u8, mode_wanted, max_mode);
99 98
100 if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 && 99 if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0)
101 (pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { 100 pio_mode = ide_scan_pio_blacklist((char *)&id[ATA_ID_PROD]);
101
102 if (pio_mode != -1) {
102 printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); 103 printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name);
103 } else { 104 } else {
104 pio_mode = id->tPIO; 105 pio_mode = drive->driveid->tPIO;
105 if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ 106 if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */
106 pio_mode = 2; 107 pio_mode = 2;
107 overridden = 1; 108 overridden = 1;
108 } 109 }
109 if (id->field_valid & 2) { /* drive implements ATA2? */ 110
110 if (id->capability & 8) { /* IORDY supported? */ 111 if (id[ATA_ID_FIELD_VALID] & 2) { /* ATA2? */
111 if (id->eide_pio_modes & 7) { 112 if (drive->driveid->capability & 8) { /* IORDY sup? */
113 if (id[ATA_ID_PIO_MODES] & 7) {
112 overridden = 0; 114 overridden = 0;
113 if (id->eide_pio_modes & 4) 115 if (id[ATA_ID_PIO_MODES] & 4)
114 pio_mode = 5; 116 pio_mode = 5;
115 else if (id->eide_pio_modes & 2) 117 else if (id[ATA_ID_PIO_MODES] & 2)
116 pio_mode = 4; 118 pio_mode = 4;
117 else 119 else
118 pio_mode = 3; 120 pio_mode = 3;