Skip to content

Commit 1bd4c1f

Browse files
committed
ide: classify device type in do_probe()
Defer classifying device type from do_identify() to do_probe(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1 parent 552d3a9 commit 1bd4c1f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

drivers/ide/ide-probe.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,6 @@ static void do_identify(ide_drive_t *drive, u8 cmd)
233233
drive->dev_flags |= IDE_DFLAG_PRESENT;
234234
drive->dev_flags &= ~IDE_DFLAG_DEAD;
235235

236-
/*
237-
* Check for an ATAPI device
238-
*/
239-
if (cmd == ATA_CMD_ID_ATAPI)
240-
ide_classify_atapi_dev(drive);
241-
else
242-
/*
243-
* Not an ATAPI device: looks like a "regular" hard disk
244-
*/
245-
ide_classify_ata_dev(drive);
246236
return;
247237
err_misc:
248238
kfree(id);
@@ -480,6 +470,8 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
480470
static u8 probe_for_drive(ide_drive_t *drive)
481471
{
482472
char *m;
473+
int rc;
474+
u8 cmd;
483475

484476
/*
485477
* In order to keep things simple we have an id
@@ -504,9 +496,13 @@ static u8 probe_for_drive(ide_drive_t *drive)
504496
/* skip probing? */
505497
if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0) {
506498
/* if !(success||timed-out) */
507-
if (do_probe(drive, ATA_CMD_ID_ATA) >= 2)
499+
cmd = ATA_CMD_ID_ATA;
500+
rc = do_probe(drive, cmd);
501+
if (rc >= 2) {
508502
/* look for ATAPI device */
509-
(void)do_probe(drive, ATA_CMD_ID_ATAPI);
503+
cmd = ATA_CMD_ID_ATAPI;
504+
rc = do_probe(drive, cmd);
505+
}
510506

511507
if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0)
512508
/* drive not found */
@@ -525,8 +521,12 @@ static u8 probe_for_drive(ide_drive_t *drive)
525521
printk(KERN_WARNING "%s: Unknown device on bus refused identification. Ignoring.\n", drive->name);
526522
drive->dev_flags &= ~IDE_DFLAG_PRESENT;
527523
}
524+
} else {
525+
if (cmd == ATA_CMD_ID_ATAPI)
526+
ide_classify_atapi_dev(drive);
527+
else
528+
ide_classify_ata_dev(drive);
528529
}
529-
/* drive was found */
530530
}
531531

532532
if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0)

0 commit comments

Comments
 (0)