libata: simplify PCI legacy SFF host handling
PATCH 1/1 libata: simplify PCI legacy SFF host handling
With PCI resource fix up for legacy hosts. We can use the same code path to allocate IO resources and initialize host for both legacy and native SFF hosts. Only IRQ requesting needs to be different.
Rename ata_pci_*_native_host() to ata_pci_*_sff_host(), kill all legacy specific functions and use the renamed functions instead. This simplifies code a lot.
---
Gee, I like it. The BAR fixup thing was a really good idea. :-)
drivers/ata/libata-core.c | 4 drivers/ata/libata-sff.c | 288 +++++----------------------------------------- drivers/ata/sata_nv.c | 2 drivers/ata/sata_sis.c | 2 drivers/ata/sata_uli.c | 2 drivers/ata/sata_via.c | 2 include/linux/libata.h | 8 - 7 files changed, 42 insertions(+), 266 deletions(-)
drivers/ata/libata-core.c +2 -2
@@ -6961,9 +6961,9 @@ EXPORT_SYMBOL_GPL(ata_timing_merge);#ifdef CONFIG_PCI EXPORT_SYMBOL_GPL (pci_test_config_bits); -EXPORT_SYMBOL_GPL (ata_pci_init_native_host); +EXPORT_SYMBOL_GPL (ata_pci_init_sff_host);EXPORT_SYMBOL_GPL (ata_pci_init_bmdma); -EXPORT_SYMBOL_GPL (ata_pci_prepare_native_host); +EXPORT_SYMBOL_GPL (ata_pci_prepare_sff_host);EXPORT_SYMBOL_GPL (ata_pci_init_one);EXPORT_SYMBOL_GPL (ata_pci_remove_one);#ifdef CONFIG_PM
drivers/ata/libata-sff.c +32 -256
348 lines not on this page · raw message
drivers/ata/sata_nv.c +1 -1
@@ -1560,7 +1560,7 @@ static int nv_init_one (struct pci_dev * } ppi[0 ] = &nv_port_info[type]; - rc =ata_pci_prepare_native_host (pdev, ppi, &host); + rc =ata_pci_prepare_sff_host (pdev, ppi, &host);if (rc)return rc;
drivers/ata/sata_sis.c +1 -1
@@ -334,7 +334,7 @@ static int sis_init_one (struct pci_devbreak ; } - rc =ata_pci_prepare_native_host (pdev, ppi, &host); + rc =ata_pci_prepare_sff_host (pdev, ppi, &host);if (rc)return rc;
drivers/ata/sata_uli.c +1 -1
@@ -213,7 +213,7 @@ static int uli_init_one (struct pci_dev host->private_data = hpriv;/* the first two ports are standard SFF */ - rc =ata_pci_init_native_host (host); + rc =ata_pci_init_sff_host (host);if (rc)return rc;
drivers/ata/sata_via.c +1 -1
@@ -412,7 +412,7 @@ static int vt6420_prepare_host(struct pcstruct ata_host *host;int rc; - rc =ata_pci_prepare_native_host (pdev, ppi, &host); + rc =ata_pci_prepare_sff_host (pdev, ppi, &host);if (rc)return rc; *r_host = host;
include/linux/libata.h +4 -4
@@ -871,11 +871,11 @@ struct pci_bits { unsigned long val; }; -extern int ata_pci_init_native_host (struct ata_host *host); +extern int ata_pci_init_sff_host (struct ata_host *host);extern int ata_pci_init_bmdma (struct ata_host *host); -extern int ata_pci_prepare_native_host (struct pci_dev *pdev, -const struct ata_port_info *const * ppi, -struct ata_host **r_host); +extern int ata_pci_prepare_sff_host (struct pci_dev *pdev, +const struct ata_port_info *const * ppi, +struct ata_host **r_host);extern int pci_test_config_bits (struct pci_dev *pdev,const struct pci_bits *bits);extern unsigned long ata_pci_default_filter (struct ata_device *,unsigned long );#endif /* CONFIG_PCI */
Quoted 4 lines
Signed-off-by Tejun Heo <[email protected]>Cc Alan Cox <[email protected]>---
Gee, I like it. The BAR fixup thing was a really good idea. :-)
Told you it would 8)
Looks good to me
[Jeff - this replaces the minimal tweak I sent out to use the PCI
resources set by the pci layer and does the lot properly so drop the little patch of mine]
Jeff Garzik
AppliedQuoted 13 lines · Tejun Heo
With PCI resource fix up for legacy hosts. We can use the same code path to allocate IO resources and initialize host for both legacy and native SFF hosts. Only IRQ requesting needs to be different.
Rename ata_pci_*_native_host() to ata_pci_*_sff_host(), kill all legacy specific functions and use the renamed functions instead. This simplifies code a lot.
Signed-off-by Tejun Heo <[email protected]>Cc Alan Cox <[email protected]>---
Gee, I like it. The BAR fixup thing was a really good idea. :-)
Quoted 8 lines
drivers/ata/libata-core.c | 4 drivers/ata/libata-sff.c | 288 +++++----------------------------------------- drivers/ata/sata_nv.c | 2 drivers/ata/sata_sis.c | 2 drivers/ata/sata_uli.c | 2 drivers/ata/sata_via.c | 2 include/linux/libata.h | 8 - 7 files changed, 42 insertions(+), 266 deletions(-)
applied