Skip to contentSkip to conversation

libata: simplify PCI legacy SFF host handling

PATCH Applied Tejun Heo 3 participants 3 messages Jul 4, 2007 – Jul 11, 2007 libata

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

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
Index: work/drivers/ata/libata-core.c
===================================================================
@@ -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
Index: work/drivers/ata/sata_nv.c
===================================================================
@@ -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
Index: work/drivers/ata/sata_sis.c
===================================================================
@@ -334,7 +334,7 @@ static int sis_init_one (struct pci_dev 
 		break;
 	}
 
-	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
Index: work/drivers/ata/sata_uli.c
===================================================================
@@ -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
Index: work/drivers/ata/sata_via.c
===================================================================
@@ -412,7 +412,7 @@ static int vt6420_prepare_host(struct pc
 	struct 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
Index: work/include/linux/libata.h
===================================================================
@@ -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 */
Applied
#2 lore raw
In reply to Tejun Heo
Quoted 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.

---
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