aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-24 18:22:59 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-24 18:22:59 -0400
commit2ebe1d9efed5f232afc8d00901d0959c9814bce3 (patch)
tree683864ff5a5e952fe5c2d3d811215175edfa17d4 /drivers/ide/ide-probe.c
parentff18b89bef76d291db594af3e27b6c91e6600b57 (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-probe.c')
-rw-r--r--drivers/ide/ide-probe.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 3f9faef5e50e..974067043fba 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -181,16 +181,16 @@ static void ide_classify_atapi_dev(ide_drive_t *drive)
181 * do_identify - identify a drive 181 * do_identify - identify a drive
182 * @drive: drive to identify 182 * @drive: drive to identify
183 * @cmd: command used 183 * @cmd: command used
184 * @id: buffer for IDENTIFY data
184 * 185 *
185 * Called when we have issued a drive identify command to 186 * Called when we have issued a drive identify command to
186 * read and parse the results. This function is run with 187 * read and parse the results. This function is run with
187 * interrupts disabled. 188 * interrupts disabled.
188 */ 189 */
189 190
190static void do_identify(ide_drive_t *drive, u8 cmd) 191static void do_identify(ide_drive_t *drive, u8 cmd, u16 *id)
191{ 192{
192 ide_hwif_t *hwif = drive->hwif; 193 ide_hwif_t *hwif = drive->hwif;
193 u16 *id = drive->id;
194 char *m = (char *)&id[ATA_ID_PROD]; 194 char *m = (char *)&id[ATA_ID_PROD];
195 unsigned long flags; 195 unsigned long flags;
196 int bswap = 1; 196 int bswap = 1;
@@ -240,19 +240,19 @@ err_misc:
240} 240}
241 241
242/** 242/**
243 * try_to_identify - send ATA/ATAPI identify 243 * ide_dev_read_id - send ATA/ATAPI IDENTIFY command
244 * @drive: drive to identify 244 * @drive: drive to identify
245 * @cmd: command to use 245 * @cmd: command to use
246 * @id: buffer for IDENTIFY data
246 * 247 *
247 * try_to_identify() sends an ATA(PI) IDENTIFY request to a drive 248 * Sends an ATA(PI) IDENTIFY request to a drive and waits for a response.
248 * and waits for a response.
249 * 249 *
250 * Returns: 0 device was identified 250 * Returns: 0 device was identified
251 * 1 device timed-out (no response to identify request) 251 * 1 device timed-out (no response to identify request)
252 * 2 device aborted the command (refused to identify itself) 252 * 2 device aborted the command (refused to identify itself)
253 */ 253 */
254 254
255static int try_to_identify(ide_drive_t *drive, u8 cmd) 255int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id)
256{ 256{
257 ide_hwif_t *hwif = drive->hwif; 257 ide_hwif_t *hwif = drive->hwif;
258 struct ide_io_ports *io_ports = &hwif->io_ports; 258 struct ide_io_ports *io_ports = &hwif->io_ports;
@@ -312,7 +312,7 @@ static int try_to_identify(ide_drive_t *drive, u8 cmd)
312 312
313 if (OK_STAT(s, ATA_DRQ, BAD_R_STAT)) { 313 if (OK_STAT(s, ATA_DRQ, BAD_R_STAT)) {
314 /* drive returned ID */ 314 /* drive returned ID */
315 do_identify(drive, cmd); 315 do_identify(drive, cmd, id);
316 /* drive responded with ID */ 316 /* drive responded with ID */
317 rc = 0; 317 rc = 0;
318 /* clear drive IRQ */ 318 /* clear drive IRQ */
@@ -378,6 +378,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
378{ 378{
379 ide_hwif_t *hwif = drive->hwif; 379 ide_hwif_t *hwif = drive->hwif;
380 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 380 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
381 u16 *id = drive->id;
381 int rc; 382 int rc;
382 u8 present = !!(drive->dev_flags & IDE_DFLAG_PRESENT), stat; 383 u8 present = !!(drive->dev_flags & IDE_DFLAG_PRESENT), stat;
383 384
@@ -413,11 +414,10 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
413 414
414 if (OK_STAT(stat, ATA_DRDY, ATA_BUSY) || 415 if (OK_STAT(stat, ATA_DRDY, ATA_BUSY) ||
415 present || cmd == ATA_CMD_ID_ATAPI) { 416 present || cmd == ATA_CMD_ID_ATAPI) {
416 /* send cmd and wait */ 417 rc = ide_dev_read_id(drive, cmd, id);
417 if ((rc = try_to_identify(drive, cmd))) { 418 if (rc)
418 /* failed: try again */ 419 /* failed: try again */
419 rc = try_to_identify(drive,cmd); 420 rc = ide_dev_read_id(drive, cmd, id);
420 }
421 421
422 stat = tp_ops->read_status(hwif); 422 stat = tp_ops->read_status(hwif);
423 423
@@ -432,7 +432,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
432 msleep(50); 432 msleep(50);
433 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET); 433 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
434 (void)ide_busy_sleep(hwif, WAIT_WORSTCASE, 0); 434 (void)ide_busy_sleep(hwif, WAIT_WORSTCASE, 0);
435 rc = try_to_identify(drive, cmd); 435 rc = ide_dev_read_id(drive, cmd, id);
436 } 436 }
437 437
438 /* ensure drive IRQ is clear */ 438 /* ensure drive IRQ is clear */