I killed hard_port_no by s/ap->hard_port_no/ap->port_no/g without actually reviewing the usages (man, those are a LOT). If all pata drivers always relied on ap->hard_port_no representing the actual port index in the controller, there shouldn't be a problem. But, just in case, please review the change.
Think about the following execution sequence
ati_pci_init_one
primary port already stolen by drivers/ide secondary port free
legacy_mode = ATA_PORT_SECONDARY
ata_pci_init_legacy_port
port_num = 0
hard_port_num = 1
*kerunnccchhhhhh*
If this fixes Magallon's problem and you agree with the fix, I'll break it down to two patches and submit'em to you with proper heading and all.
I agree with the theory and the diagnosis. I'm a bit worried about
hard_port_no however and I don't think that bit is safe in the secondary
only corner case. Registering both always and disabling one works for me
as a cleanup.
If you do that then I'll audit all the drivers use of ->port_no against
the patches.