Skip to content

Commit

Permalink
ide: use ata_id_is_cfa()
Browse files Browse the repository at this point in the history
Use ata_id_is_cfa() in do_identify() instead of open-coding
check for CompactFlash devices (the inline helper also takes
care of detecting CFs advertising themselves as ATA disks).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Oct 10, 2008
1 parent ff2779b commit 718c72e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/ide/ide-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
ide_hwif_t *hwif = HWIF(drive);
u16 *id = drive->id;
char *m = (char *)&id[ATA_ID_PROD];
int bswap = 1;
int bswap = 1, is_cfa;

/* read 512 bytes of id info */
hwif->tp_ops->input_data(drive, NULL, id, SECTOR_SIZE);
Expand Down Expand Up @@ -212,17 +212,15 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
* Not an ATAPI device: looks like a "regular" hard disk
*/

/*
* 0x848a = CompactFlash device
* These are *not* removable in Linux definition of the term
*/
if (id[ATA_ID_CONFIG] != 0x848a && (id[ATA_ID_CONFIG] & (1 << 7)))
is_cfa = ata_id_is_cfa(id);

/* CF devices are *not* removable in Linux definition of the term */
if (is_cfa == 0 && (id[ATA_ID_CONFIG] & (1 << 7)))
drive->removable = 1;

drive->media = ide_disk;

printk(KERN_CONT "%s DISK drive\n",
(id[ATA_ID_CONFIG] == 0x848a) ? "CFA" : "ATA");
printk(KERN_CONT "%s DISK drive\n", is_cfa ? "CFA" : "ATA");

return;

Expand Down

0 comments on commit 718c72e

Please sign in to comment.