diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:59 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:59 -0400 |
commit | 2ebe1d9efed5f232afc8d00901d0959c9814bce3 (patch) | |
tree | 683864ff5a5e952fe5c2d3d811215175edfa17d4 /drivers/ide/ide-iops.c | |
parent | ff18b89bef76d291db594af3e27b6c91e6600b57 (diff) |
ide: use try_to_identify() in ide_driveid_update()
* Pass pointer to buffer for IDENTIFY data to do_identify()
and try_to_identify().
* Un-static try_to_identify() and use it in ide_driveid_update().
* Rename try_to_identify() to ide_dev_read_id().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r-- | drivers/ide/ide-iops.c | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index affbc603987a..317c5dadd7c0 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -289,65 +289,19 @@ no_80w: | |||
289 | 289 | ||
290 | int ide_driveid_update(ide_drive_t *drive) | 290 | int ide_driveid_update(ide_drive_t *drive) |
291 | { | 291 | { |
292 | ide_hwif_t *hwif = drive->hwif; | ||
293 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | ||
294 | u16 *id; | 292 | u16 *id; |
295 | unsigned long flags; | 293 | int rc; |
296 | int use_altstatus = 0, rc; | ||
297 | u8 a, uninitialized_var(s); | ||
298 | 294 | ||
299 | id = kmalloc(SECTOR_SIZE, GFP_ATOMIC); | 295 | id = kmalloc(SECTOR_SIZE, GFP_ATOMIC); |
300 | if (id == NULL) | 296 | if (id == NULL) |
301 | return 0; | 297 | return 0; |
302 | 298 | ||
303 | /* | ||
304 | * Re-read drive->id for possible DMA mode | ||
305 | * change (copied from ide-probe.c) | ||
306 | */ | ||
307 | |||
308 | SELECT_MASK(drive, 1); | 299 | SELECT_MASK(drive, 1); |
309 | tp_ops->set_irq(hwif, 0); | 300 | rc = ide_dev_read_id(drive, ATA_CMD_ID_ATA, id); |
310 | msleep(50); | 301 | SELECT_MASK(drive, 0); |
311 | |||
312 | if (hwif->io_ports.ctl_addr && | ||
313 | (hwif->host_flags & IDE_HFLAG_BROKEN_ALTSTATUS) == 0) { | ||
314 | a = tp_ops->read_altstatus(hwif); | ||
315 | s = tp_ops->read_status(hwif); | ||
316 | if ((a ^ s) & ~ATA_IDX) | ||
317 | /* ancient Seagate drives, broken interfaces */ | ||
318 | printk(KERN_INFO "%s: probing with STATUS(0x%02x) " | ||
319 | "instead of ALTSTATUS(0x%02x)\n", | ||
320 | drive->name, s, a); | ||
321 | else | ||
322 | /* use non-intrusive polling */ | ||
323 | use_altstatus = 1; | ||
324 | } | ||
325 | |||
326 | tp_ops->exec_command(hwif, ATA_CMD_ID_ATA); | ||
327 | |||
328 | if (ide_busy_sleep(hwif, WAIT_WORSTCASE / 2, use_altstatus)) { | ||
329 | rc = 1; | ||
330 | goto out_err; | ||
331 | } | ||
332 | |||
333 | msleep(50); /* wait for IRQ and ATA_DRQ */ | ||
334 | |||
335 | s = tp_ops->read_status(hwif); | ||
336 | 302 | ||
337 | if (!OK_STAT(s, ATA_DRQ, BAD_R_STAT)) { | 303 | if (rc) |
338 | rc = 2; | ||
339 | goto out_err; | 304 | goto out_err; |
340 | } | ||
341 | |||
342 | local_irq_save(flags); | ||
343 | tp_ops->input_data(drive, NULL, id, SECTOR_SIZE); | ||
344 | local_irq_restore(flags); | ||
345 | |||
346 | (void)tp_ops->read_status(hwif); /* clear drive IRQ */ | ||
347 | |||
348 | ide_fix_driveid(id); | ||
349 | |||
350 | SELECT_MASK(drive, 0); | ||
351 | 305 | ||
352 | drive->id[ATA_ID_UDMA_MODES] = id[ATA_ID_UDMA_MODES]; | 306 | drive->id[ATA_ID_UDMA_MODES] = id[ATA_ID_UDMA_MODES]; |
353 | drive->id[ATA_ID_MWDMA_MODES] = id[ATA_ID_MWDMA_MODES]; | 307 | drive->id[ATA_ID_MWDMA_MODES] = id[ATA_ID_MWDMA_MODES]; |