Commit 3ad6776cca21f2456b7288f44f224b344ac3c4d0

Authored by Borislav Petkov
Committed by Bartlomiej Zolnierkiewicz
1 parent 3d53ba87f0

ide-floppy: remove struct idefloppy_id_gcw

Bart:
- minor fixups

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Showing 1 changed file with 24 additions and 43 deletions Side-by-side Diff

drivers/ide/ide-floppy.c
... ... @@ -195,32 +195,6 @@
195 195 #define IDEFLOPPY_ERROR_GENERAL 101
196 196  
197 197 /*
198   - * The following is used to format the general configuration word of the
199   - * ATAPI IDENTIFY DEVICE command.
200   - */
201   -struct idefloppy_id_gcw {
202   -#if defined(__LITTLE_ENDIAN_BITFIELD)
203   - unsigned packet_size :2; /* Packet Size */
204   - unsigned reserved234 :3; /* Reserved */
205   - unsigned drq_type :2; /* Command packet DRQ type */
206   - unsigned removable :1; /* Removable media */
207   - unsigned device_type :5; /* Device type */
208   - unsigned reserved13 :1; /* Reserved */
209   - unsigned protocol :2; /* Protocol type */
210   -#elif defined(__BIG_ENDIAN_BITFIELD)
211   - unsigned protocol :2; /* Protocol type */
212   - unsigned reserved13 :1; /* Reserved */
213   - unsigned device_type :5; /* Device type */
214   - unsigned removable :1; /* Removable media */
215   - unsigned drq_type :2; /* Command packet DRQ type */
216   - unsigned reserved234 :3; /* Reserved */
217   - unsigned packet_size :2; /* Packet Size */
218   -#else
219   -#error "Bitfield endianness not defined! Check your byteorder.h"
220   -#endif
221   -};
222   -
223   -/*
224 198 * Pages of the SELECT SENSE / MODE SENSE packet commands.
225 199 * See SFF-8070i spec.
226 200 */
227 201  
228 202  
229 203  
230 204  
231 205  
232 206  
233 207  
234 208  
... ... @@ -1271,33 +1245,39 @@
1271 1245 */
1272 1246 static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id)
1273 1247 {
1274   - struct idefloppy_id_gcw gcw;
  1248 + u8 gcw[2];
  1249 + u8 device_type, protocol, removable, drq_type, packet_size;
1275 1250  
1276 1251 *((u16 *) &gcw) = id->config;
1277 1252  
  1253 + device_type = gcw[1] & 0x1F;
  1254 + removable = (gcw[0] & 0x80) >> 7;
  1255 + protocol = (gcw[1] & 0xC0) >> 6;
  1256 + drq_type = (gcw[0] & 0x60) >> 5;
  1257 + packet_size = gcw[0] & 0x03;
  1258 +
1278 1259 #ifdef CONFIG_PPC
1279 1260 /* kludge for Apple PowerBook internal zip */
1280   - if ((gcw.device_type == 5) &&
1281   - !strstr(id->model, "CD-ROM") &&
1282   - strstr(id->model, "ZIP"))
1283   - gcw.device_type = 0;
  1261 + if (device_type == 5 &&
  1262 + !strstr(id->model, "CD-ROM") && strstr(id->model, "ZIP"))
  1263 + device_type = 0;
1284 1264 #endif
1285 1265  
1286   - if (gcw.protocol != 2)
  1266 + if (protocol != 2)
1287 1267 printk(KERN_ERR "ide-floppy: Protocol (0x%02x) is not ATAPI\n",
1288   - gcw.protocol);
1289   - else if (gcw.device_type != 0)
  1268 + protocol);
  1269 + else if (device_type != 0)
1290 1270 printk(KERN_ERR "ide-floppy: Device type (0x%02x) is not set "
1291   - "to floppy\n", gcw.device_type);
1292   - else if (!gcw.removable)
  1271 + "to floppy\n", device_type);
  1272 + else if (!removable)
1293 1273 printk(KERN_ERR "ide-floppy: The removable flag is not set\n");
1294   - else if (gcw.drq_type == 3) {
  1274 + else if (drq_type == 3)
1295 1275 printk(KERN_ERR "ide-floppy: Sorry, DRQ type (0x%02x) not "
1296   - "supported\n", gcw.drq_type);
1297   - } else if (gcw.packet_size != 0) {
  1276 + "supported\n", drq_type);
  1277 + else if (packet_size != 0)
1298 1278 printk(KERN_ERR "ide-floppy: Packet size (0x%02x) is not 12 "
1299   - "bytes long\n", gcw.packet_size);
1300   - } else
  1279 + "bytes\n", packet_size);
  1280 + else
1301 1281 return 1;
1302 1282 return 0;
1303 1283 }
1304 1284  
... ... @@ -1322,11 +1302,12 @@
1322 1302  
1323 1303 static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
1324 1304 {
1325   - struct idefloppy_id_gcw gcw;
  1305 + u8 gcw[2];
1326 1306  
1327 1307 *((u16 *) &gcw) = drive->id->config;
1328 1308 floppy->pc = floppy->pc_stack;
1329   - if (gcw.drq_type == 1)
  1309 +
  1310 + if (((gcw[0] & 0x60) >> 5) == 1)
1330 1311 floppy->flags |= IDEFLOPPY_FLAG_DRQ_INTERRUPT;
1331 1312 /*
1332 1313 * We used to check revisions here. At this point however I'm giving up.