Split up ata_detect() function.