Skip to contentSkip to conversation

Subject: [PATCH] Update legacy codes in ltp_tpci.c

LTP Chen Li 2 participants 2 messages Mar 7, 2020 – Mar 13, 2020

lore
Share & tools
lore

Chen Li

author
#0 lore raw

The kernel api used in ltp_tpci.c is too old and connot pass compile after 3.12.

---
 .../device-drivers/pci/tpci_kernel/ltp_tpci.c | 30 ++-----------------
 1 file changed, 2 insertions(+), 28 deletions(-)
testcases/kernel/device-drivers/pci/tpci_kernel/ltp_tpci.c +2 -28
index 2cf8cefc8..7cbabfaa5 100644
@@ -61,7 +61,7 @@ MODULE_LICENSE("GPL");
 #define TFAIL	1
 #define TSKIP	32
 
-static DEFINE_PCI_DEVICE_TABLE(ltp_pci_tbl) = {
+static const struct pci_device_id ltp_pci_tbl[] = {
 	{ PCI_DEVICE(PCI_ANY_ID, PCI_ANY_ID) },
 	{ 0, }
 };
@@ -104,7 +104,7 @@ static int probe_pci_dev(unsigned int bus, unsigned int slot)
 		ltp_pci.dev = NULL;
 	}
 
-	dev = pci_get_bus_and_slot(bus, slot);
+	dev = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), bus, slot);
 	if (!dev || !dev->driver)
 		return -ENODEV;
 
@@ -360,29 +360,6 @@ static int test_bus_add_devices(void)
 	return TFAIL;
 }
 
-/*
- * test_enable_bridges
- *	make call to pci_enable_bridges,
- *	use bus pointer from the ltp_pci
- *	structure
- */
-static int test_enable_bridges(void)
-{
-	struct pci_bus *bus = ltp_pci.bus;
-
-	prk_info("enable bridges");
-
-	pci_enable_bridges(bus);
-
-	if (bus) {
-		prk_info("called enable bridges");
-		return TPASS;
-	}
-
-	prk_err("enable_bridges failed");
-	return TFAIL;
-}
-
 /*
  * test_match_device
  *	make call to pci_match_device, returns a
@@ -609,9 +586,6 @@ static int test_case(unsigned int cmd)
 	case BUS_ADD_DEVICES:
 		rc = test_bus_add_devices();
 		break;
-	case ENABLE_BRIDGES:
-		rc = test_enable_bridges();
-		break;
 	case MATCH_DEVICE:
 		rc = test_match_device();
 		break;

--
2.25.0

#1 lore raw

Hi,

Quoted 2 lines

The kernel api used in ltp_tpci.c is too old and connot pass compile after 3.12.

Merged as obviously correct.
I added git commit references.

BTW whole pci is not used atm.
We should decide for versions we want to support and then update kernel versions, which are now wrongly set to 2.6:

REQ_VERSION_MAJOR := 2
REQ_VERSION_PATCH := 6

This waits for project to define which kernel versions we support. We had some discussion about it in the past, I just cannot find it, so I'll probably send a new mail about it.

Kind regards,
Petr