/* Return 1 if the cable appears to be 40 wire.  */
static int cable_is_40wire(struct ata_port *ap)
/* Return 1 if the cable appears to be 40 wire.  */
static int cable_is_40wire(struct ata_port *ap)
{
	struct ata_link *link;
	struct ata_device *dev;
	if (ap->cbl == ATA_CBL_PATA40)
		return 1;
	if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA)
		return 0;
	if (ap->cbl == ATA_CBL_PATA40_SHORT)
		return 0;
	ata_for_each_link(link, ap, EDGE) {
		ata_for_each_dev(dev, link, ENABLED) {
			if (!ata_is_40wire(dev))
				return 0;
		}
	}
	return 1;
}