Skip to contentSkip to conversation

PCI: deprecate pci_get_bus_and_slot()

PATCH Applied Sinan Kaya 10 participants 62 messages Nov 22, 2017 – Nov 27, 2017

Subsystems (30)

v1 of 4 Applied Latest is v4 →

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

cover PCI: deprecate pci_get_bus_and_slot()

Deprecate pci_get_bus_and_slot() in favor of pci_get_domain_bus_and_slot() in order to remove domain 0 assumptions in the kernel.

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

Sinan Kaya (30):
alpha/PCI: deprecate pci_get_bus_and_slot() powerpc/PCI: deprecate pci_get_bus_and_slot() x86/PCI: deprecate pci_get_bus_and_slot()
ata: deprecate pci_get_bus_and_slot()
agp: nvidia: deprecate pci_get_bus_and_slot()
edd: deprecate pci_get_bus_and_slot()
ibft: deprecate pci_get_bus_and_slot() drm/gma500: deprecate pci_get_bus_and_slot() drm/i915: deprecate pci_get_bus_and_slot() drm/nouveau: deprecate pci_get_bus_and_slot()
hwmon: (coretemp) deprecate pci_get_bus_and_slot()
Drivers: ide: deprecate pci_get_bus_and_slot() iommu/amd: deprecate pci_get_bus_and_slot() powerpc/powermac: deprecate pci_get_bus_and_slot()
bnx2x: deprecate pci_get_bus_and_slot()
pch_gbe: deprecate pci_get_bus_and_slot()
PCI: cpqhp: deprecate pci_get_bus_and_slot()
PCI: ibmphp: deprecate pci_get_bus_and_slot() PCI/quirks: deprecate pci_get_bus_and_slot() PCI/syscall: deprecate pci_get_bus_and_slot()
xen: deprecate pci_get_bus_and_slot()
openprom: deprecate pci_get_bus_and_slot() [media] atomisp: deprecate pci_get_bus_and_slot()
staging: rts5208: deprecate pci_get_bus_and_slot()
backlight: deprecate pci_get_bus_and_slot()
video: fbdev: intelfb: deprecate pci_get_bus_and_slot()
video: fbdev: nvidia: deprecate pci_get_bus_and_slot()
video: fbdev: riva: deprecate pci_get_bus_and_slot()
i7300_idle: deprecate pci_get_bus_and_slot()
PCI: remove pci_get_bus_and_slot() function

 arch/alpha/kernel/pci.c                                |  2 +-
 arch/alpha/kernel/sys_nautilus.c                       |  2 +-
 arch/powerpc/kernel/pci_32.c                           |  3 ++-
 arch/powerpc/platforms/powermac/feature.c              |  2 +-
 arch/powerpc/sysdev/mv64x60_pci.c                      |  4 ++--
 arch/x86/pci/irq.c                                     |  3 ++-
 drivers/ata/pata_ali.c                                 |  2 +-
 drivers/char/agp/nvidia-agp.c                          | 12 +++++++++---
 drivers/char/agp/sworks-agp.c                          |  3 ++-
 drivers/firmware/edd.c                                 |  8 ++++----
 drivers/firmware/iscsi_ibft.c                          |  5 +++--
 drivers/gpu/drm/gma500/cdv_device.c                    |  4 ++--
 drivers/gpu/drm/gma500/gma_device.c                    |  2 +-
 drivers/gpu/drm/gma500/mid_bios.c                      |  8 +++++---
 drivers/gpu/drm/gma500/psb_drv.c                       |  7 +++++--
 drivers/gpu/drm/gma500/psb_drv.h                       |  8 ++++----
 drivers/gpu/drm/i915/i915_drv.c                        |  4 +++-
 drivers/gpu/drm/nouveau/dispnv04/arb.c                 |  3 ++-
 drivers/gpu/drm/nouveau/dispnv04/hw.c                  |  6 ++++--
 drivers/gpu/drm/nouveau/nouveau_drm.c                  |  3 ++-
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c       |  2 +-
 drivers/hwmon/coretemp.c                               |  3 ++-
 drivers/ide/sl82c105.c                                 |  5 +++--
 drivers/iommu/amd_iommu.c                              |  3 ++-
 drivers/iommu/amd_iommu_init.c                         | 10 ++++++----
 drivers/iommu/amd_iommu_v2.c                           |  3 ++-
 drivers/macintosh/via-pmu.c                            |  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c      | 10 +++++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h      |  1 +
 drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c   |  7 +++++--
 drivers/pci/hotplug/cpqphp_pci.c                       | 18 ++++++++++++++----
 drivers/pci/hotplug/ibmphp_core.c                      |  7 ++++---
 drivers/pci/quirks.c                                   |  2 +-
 drivers/pci/syscall.c                                  |  4 ++--
 drivers/pci/xen-pcifront.c                             |  3 ++-
 drivers/sbus/char/openprom.c                           |  5 +++--
 .../staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c  |  2 +-
 .../atomisp/platform/intel-mid/intel_mid_pcihelpers.c  |  2 +-
 drivers/staging/rts5208/rtsx.c                         |  2 +-
 drivers/video/backlight/apple_bl.c                     |  2 +-
 drivers/video/fbdev/intelfb/intelfbhw.c                |  4 +++-
 drivers/video/fbdev/nvidia/nv_hw.c                     | 10 +++++-----
 drivers/video/fbdev/nvidia/nv_setup.c                  |  2 +-
 drivers/video/fbdev/riva/nv_driver.c                   |  4 ++--
 drivers/video/fbdev/riva/riva_hw.c                     |  8 ++++----
 include/linux/i7300_idle.h                             |  4 ++--
 include/linux/pci.h                                    |  8 --------
 47 files changed, 135 insertions(+), 89 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/30 alpha/PCI: deprecate pci_get_bus_and_slot()

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 arch/alpha/kernel/pci.c          | 2 +-
 arch/alpha/kernel/sys_nautilus.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/alpha/kernel/pci.c +1 -1
index 08235bb..e866daf 100644
@@ -416,7 +416,7 @@ struct resource * __init
 		if (bus == 0 && dfn == 0) {
 			hose = pci_isa_hose;
 		} else {
-			dev = pci_get_bus_and_slot(bus, dfn);
+			dev = pci_get_domain_bus_and_slot(0, bus, dfn);
 			if (!dev)
 				return -ENODEV;
 			hose = dev->sysdata;
arch/alpha/kernel/sys_nautilus.c +1 -1
index 239dc0e..5eacaf9 100644
@@ -237,7 +237,7 @@
 	bus = hose->bus = bridge->bus;
 	pcibios_claim_one_bus(bus);
 
-	irongate = pci_get_bus_and_slot(0, 0);
+	irongate = pci_get_domain_bus_and_slot(0, 0, 0);
 	bus->self = irongate;
 	bus->resource[0] = &irongate_io;
 	bus->resource[1] = &irongate_mem;
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/30 powerpc/PCI: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 arch/powerpc/kernel/pci_32.c              | 3 ++-
 arch/powerpc/platforms/powermac/feature.c | 2 +-
 arch/powerpc/sysdev/mv64x60_pci.c         | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)
arch/powerpc/kernel/pci_32.c +2 -1
index 1d817f4..85ad2f7 100644
@@ -96,7 +96,8 @@
 		reg = of_get_property(node, "reg", NULL);
 		if (!reg)
 			continue;
-		dev = pci_get_bus_and_slot(pci_bus, ((reg[0] >> 8) & 0xff));
+		dev = pci_get_domain_bus_and_slot(0, pci_bus,
+						  ((reg[0] >> 8) & 0xff));
 		if (!dev || !dev->subordinate) {
 			pci_dev_put(dev);
 			continue;
arch/powerpc/platforms/powermac/feature.c +1 -1
index 9e3f39d..ed8b166 100644
@@ -829,7 +829,7 @@ static long core99_scc_enable(struct device_node *node, long param, long value)
 
 	if (value) {
 		if (pci_device_from_OF_node(node, &pbus, &pid) == 0)
-			pdev = pci_get_bus_and_slot(pbus, pid);
+			pdev = pci_get_domain_bus_and_slot(0, pbus, pid);
 		if (pdev == NULL)
 			return 0;
 		rc = pci_enable_device(pdev);
arch/powerpc/sysdev/mv64x60_pci.c +2 -2
index d52b3b8..6fe9104 100644
@@ -37,7 +37,7 @@ static ssize_t mv64x60_hs_reg_read(struct file *filp, struct kobject *kobj,
 	if (count < MV64X60_VAL_LEN_MAX)
 		return -EINVAL;
 
-	phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	phb = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
 	if (!phb)
 		return -ENODEV;
 	pci_read_config_dword(phb, MV64X60_PCICFG_CPCI_HOTSWAP, &v);
@@ -61,7 +61,7 @@ static ssize_t mv64x60_hs_reg_write(struct file *filp, struct kobject *kobj,
 	if (sscanf(buf, "%i", &v) != 1)
 		return -EINVAL;
 
-	phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	phb = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
 	if (!phb)
 		return -ENODEV;
 	pci_write_config_dword(phb, MV64X60_PCICFG_CPCI_HOTSWAP, v);
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH 3/30 x86/PCI: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 arch/x86/pci/irq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/pci/irq.c +2 -1
index 04526291..52e5510 100644
@@ -839,7 +839,8 @@ static void __init pirq_find_router(struct irq_router *r)
 	DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for [%04x:%04x]\n",
 	    rt->rtr_vendor, rt->rtr_device);
 
-	pirq_router_dev = pci_get_bus_and_slot(rt->rtr_bus, rt->rtr_devfn);
+	pirq_router_dev = pci_get_domain_bus_and_slot(0, rt->rtr_bus,
+						      rt->rtr_devfn);
 	if (!pirq_router_dev) {
 		DBG(KERN_DEBUG "PCI: Interrupt router not found at "
 			"%02x:%02x\n", rt->rtr_bus, rt->rtr_devfn);
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 4/30 ata: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/ata/pata_ali.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_ali.c +1 -1
index d19cd88..b297fea 100644
@@ -466,7 +466,7 @@ static void ali_init_chipset(struct pci_dev *pdev)
 			tmp |= 0x01;	/* CD_ROM enable for DMA */
 		pci_write_config_byte(pdev, 0x53, tmp);
 	}
-	north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0));
+	north = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
 	if (north && north->vendor == PCI_VENDOR_ID_AL && ali_isa_bridge) {
 		/* Configure the ALi bridge logic. For non ALi rely on BIOS.
 		   Set the south bridge enable bit */
Signature · 1 line
1.9.1
author
#5 lore raw

PATCH 5/30 agp: nvidia: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/char/agp/nvidia-agp.c | 12 +++++++++---
 drivers/char/agp/sworks-agp.c |  3 ++-
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/char/agp/nvidia-agp.c +9 -3
index 828b344..623205b 100644
@@ -340,11 +340,17 @@ static int agp_nvidia_probe(struct pci_dev *pdev,
 	u8 cap_ptr;
 
 	nvidia_private.dev_1 =
-		pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 1));
+		pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
+					    (unsigned int)pdev->bus->number,
+					    PCI_DEVFN(0, 1));
 	nvidia_private.dev_2 =
-		pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(0, 2));
+		pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
+					    (unsigned int)pdev->bus->number,
+					    PCI_DEVFN(0, 2));
 	nvidia_private.dev_3 =
-		pci_get_bus_and_slot((unsigned int)pdev->bus->number, PCI_DEVFN(30, 0));
+		pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
+					    (unsigned int)pdev->bus->number,
+					    PCI_DEVFN(30, 0));
 
 	if (!nvidia_private.dev_1 || !nvidia_private.dev_2 || !nvidia_private.dev_3) {
 		printk(KERN_INFO PFX "Detected an NVIDIA nForce/nForce2 "
drivers/char/agp/sworks-agp.c +2 -1
index 03be4ac..4dbdd3b 100644
@@ -474,7 +474,8 @@ static int agp_serverworks_probe(struct pci_dev *pdev,
 	}
 
 	/* Everything is on func 1 here so we are hardcoding function one */
-	bridge_dev = pci_get_bus_and_slot((unsigned int)pdev->bus->number,
+	bridge_dev = pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
+			(unsigned int)pdev->bus->number,
 			PCI_DEVFN(0, 1));
 	if (!bridge_dev) {
 		dev_info(&pdev->dev, "can't find secondary device\n");
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH 6/30 edd: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/firmware/edd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/firmware/edd.c +4 -4
index e229576..60a8f13 100644
@@ -669,10 +669,10 @@ static void edd_release(struct kobject * kobj)
 	struct edd_info *info = edd_dev_get_info(edev);
 
 	if (edd_dev_is_type(edev, "PCI") || edd_dev_is_type(edev, "XPRS")) {
-		return pci_get_bus_and_slot(info->params.interface_path.pci.bus,
-				     PCI_DEVFN(info->params.interface_path.pci.slot,
-					       info->params.interface_path.pci.
-					       function));
+		return pci_get_domain_bus_and_slot(0,
+				info->params.interface_path.pci.bus,
+				PCI_DEVFN(info->params.interface_path.pci.slot,
+				info->params.interface_path.pci.function));
 	}
 	return NULL;
 }
Signature · 1 line
1.9.1
author
#7 lore raw

PATCH 7/30 ibft: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/firmware/iscsi_ibft.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/firmware/iscsi_ibft.c +3 -2
index 14042a6..6bc8e66 100644
@@ -719,8 +719,9 @@ static int __init ibft_create_kobject(struct acpi_table_ibft *header,
 		* executes only devices which are in domain 0. Furthermore, the
 		* iBFT spec doesn't have a domain id field :-(
 		*/
-		pci_dev = pci_get_bus_and_slot((nic->pci_bdf & 0xff00) >> 8,
-					       (nic->pci_bdf & 0xff));
+		pci_dev = pci_get_domain_bus_and_slot(0,
+						(nic->pci_bdf & 0xff00) >> 8,
+						(nic->pci_bdf & 0xff));
 		if (pci_dev) {
 			rc = sysfs_create_link(&boot_kobj->kobj,
 					       &pci_dev->dev.kobj, "device");
Signature · 1 line
1.9.1
author
#8 lore raw

PATCH 8/30 drm/gma500: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/gpu/drm/gma500/cdv_device.c | 4 ++--
 drivers/gpu/drm/gma500/gma_device.c | 2 +-
 drivers/gpu/drm/gma500/mid_bios.c   | 8 +++++---
 drivers/gpu/drm/gma500/psb_drv.c    | 7 +++++--
 drivers/gpu/drm/gma500/psb_drv.h    | 8 ++++----
 5 files changed, 17 insertions(+), 12 deletions(-)
drivers/gpu/drm/gma500/cdv_device.c +2 -2
index 8745971..da9630f 100644
@@ -189,7 +189,7 @@ static inline u32 CDV_MSG_READ32(uint port, uint offset)
 {
 	int mcr = (0x10<<24) | (port << 16) | (offset << 8);
 	uint32_t ret_val = 0;
-	struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);
+	struct pci_dev *pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	pci_write_config_dword(pci_root, 0xD0, mcr);
 	pci_read_config_dword(pci_root, 0xD4, &ret_val);
 	pci_dev_put(pci_root);
@@ -199,7 +199,7 @@ static inline u32 CDV_MSG_READ32(uint port, uint offset)
 static inline void CDV_MSG_WRITE32(uint port, uint offset, u32 value)
 {
 	int mcr = (0x11<<24) | (port << 16) | (offset << 8) | 0xF0;
-	struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);
+	struct pci_dev *pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	pci_write_config_dword(pci_root, 0xD4, value);
 	pci_write_config_dword(pci_root, 0xD0, mcr);
 	pci_dev_put(pci_root);
drivers/gpu/drm/gma500/gma_device.c +1 -1
index 4a295f9..5dd5335 100644
@@ -19,7 +19,7 @@
 void gma_get_core_freq(struct drm_device *dev)
 {
 	uint32_t clock;
-	struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);
+	struct pci_dev *pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	struct drm_psb_private *dev_priv = dev->dev_private;
 
 	/*pci_write_config_dword(pci_root, 0xD4, 0x00C32004);*/
drivers/gpu/drm/gma500/mid_bios.c +5 -3
index d75ecb3..fed2c7a 100644
@@ -32,7 +32,7 @@
 static void mid_get_fuse_settings(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
-	struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);
+	struct pci_dev *pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	uint32_t fuse_value = 0;
 	uint32_t fuse_value_tmp = 0;
 
@@ -104,7 +104,8 @@ static void mid_get_fuse_settings(struct drm_device *dev)
 static void mid_get_pci_revID(struct drm_psb_private *dev_priv)
 {
 	uint32_t platform_rev_id = 0;
-	struct pci_dev *pci_gfx_root = pci_get_bus_and_slot(0, PCI_DEVFN(2, 0));
+	uint16_t devfn = PCI_DEVFN(2, 0);
+	struct pci_dev *pci_gfx_root = pci_get_domain_bus_and_slot(0, 0, devfn);
 
 	if (pci_gfx_root == NULL) {
 		WARN_ON(1);
@@ -281,7 +282,8 @@ static void mid_get_vbt_data(struct drm_psb_private *dev_priv)
 	u32 addr;
 	u8 __iomem *vbt_virtual;
 	struct mid_vbt_header vbt_header;
-	struct pci_dev *pci_gfx_root = pci_get_bus_and_slot(0, PCI_DEVFN(2, 0));
+	uint16_t devfn = PCI_DEVFN(2, 0);
+	struct pci_dev *pci_gfx_root = pci_get_domain_bus_and_slot(0, 0, devfn);
 	int ret = -1;
 
 	/* Get the address of the platform config vbt */
drivers/gpu/drm/gma500/psb_drv.c +5 -2
index 37a3be7..5327729 100644
@@ -261,7 +261,9 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 		goto out_err;
 
 	if (IS_MRST(dev)) {
-		dev_priv->aux_pdev = pci_get_bus_and_slot(0, PCI_DEVFN(3, 0));
+		uint16_t devfn = PCI_DEVFN(3, 0);
+
+		dev_priv->aux_pdev = pci_get_domain_bus_and_slot(0, 0, devfn);
 
 		if (dev_priv->aux_pdev) {
 			resource_start = pci_resource_start(dev_priv->aux_pdev,
@@ -281,7 +283,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 		}
 		dev_priv->gmbus_reg = dev_priv->aux_reg;
 
-		dev_priv->lpc_pdev = pci_get_bus_and_slot(0, PCI_DEVFN(31, 0));
+		devfn = PCI_DEVFN(31, 0);
+		dev_priv->lpc_pdev = pci_get_domain_bus_and_slot(0, 0, devfn);
 		if (dev_priv->lpc_pdev) {
 			pci_read_config_word(dev_priv->lpc_pdev, PSB_LPC_GBA,
 				&dev_priv->lpc_gpio_base);
drivers/gpu/drm/gma500/psb_drv.h +4 -4
index 821497d..0959191 100644
@@ -785,7 +785,7 @@ static inline u32 MRST_MSG_READ32(uint port, uint offset)
 {
 	int mcr = (0xD0<<24) | (port << 16) | (offset << 8);
 	uint32_t ret_val = 0;
-	struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);
+	struct pci_dev *pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	pci_write_config_dword(pci_root, 0xD0, mcr);
 	pci_read_config_dword(pci_root, 0xD4, &ret_val);
 	pci_dev_put(pci_root);
@@ -794,7 +794,7 @@ static inline u32 MRST_MSG_READ32(uint port, uint offset)
 static inline void MRST_MSG_WRITE32(uint port, uint offset, u32 value)
 {
 	int mcr = (0xE0<<24) | (port << 16) | (offset << 8) | 0xF0;
-	struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);
+	struct pci_dev *pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	pci_write_config_dword(pci_root, 0xD4, value);
 	pci_write_config_dword(pci_root, 0xD0, mcr);
 	pci_dev_put(pci_root);
@@ -803,7 +803,7 @@ static inline u32 MDFLD_MSG_READ32(uint port, uint offset)
 {
 	int mcr = (0x10<<24) | (port << 16) | (offset << 8);
 	uint32_t ret_val = 0;
-	struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);
+	struct pci_dev *pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	pci_write_config_dword(pci_root, 0xD0, mcr);
 	pci_read_config_dword(pci_root, 0xD4, &ret_val);
 	pci_dev_put(pci_root);
@@ -812,7 +812,7 @@ static inline u32 MDFLD_MSG_READ32(uint port, uint offset)
 static inline void MDFLD_MSG_WRITE32(uint port, uint offset, u32 value)
 {
 	int mcr = (0x11<<24) | (port << 16) | (offset << 8) | 0xF0;
-	struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0);
+	struct pci_dev *pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	pci_write_config_dword(pci_root, 0xD4, value);
 	pci_write_config_dword(pci_root, 0xD0, mcr);
 	pci_dev_put(pci_root);
Signature · 1 line
1.9.1
author
#9 lore raw

PATCH 9/30 drm/i915: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/gpu/drm/i915/i915_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +3 -1
index 9f45cfe..2ca7603 100644
@@ -419,7 +419,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 
 static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
 {
-	dev_priv->bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	uint16_t devfn = PCI_DEVFN(0, 0)
+
+	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0, devfn);
 	if (!dev_priv->bridge_dev) {
 		DRM_ERROR("bridge device not found\n");
 		return -1;
Signature · 1 line
1.9.1
maintainer
#10 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

Dropping the extra mailing lists and Dave, this is a rather trivial thing.

Quoted 9 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

<SNIP>

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam(struct drm_device *dev, void *data, · line 422

Quoted 7 lines

+++ b/drivers/gpu/drm/i915/i915_drv.c

drivers/gpu/drm/i915/i915_drv.c +1 -1
@@ -419,7 +419,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 
 static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
 {
-	dev_priv->bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	uint16_t devfn = PCI_DEVFN(0, 0)

The would have to be "unsigned int" according to the function signature.

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam(struct drm_device *dev, void *data, · line 424

Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.c +2 -0
+
+	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0, devfn);

But the most straightforward change is to simply convert to:

	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0,
							   PCI_DEVFN(0, 0));

Can you please resend like that.

Looks like this is a part of abigger series, so others may prefer latter form too, to avoid the variable.

Regards, Joonas

Signature · 3 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
author
#11 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

Quoted 18 lines · Joonas Lahtinen

Dropping the extra mailing lists and Dave, this is a rather trivial thing.

Quoted 9 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

<SNIP>

Quoted 3 lines

+++ b/drivers/gpu/drm/i915/i915_drv.c

(quoted diff) +0 -0
@@ -419,7 +419,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam(struct drm_device *dev, void *data, · line 422

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +1 -1
 static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
 {
-	dev_priv->bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	uint16_t devfn = PCI_DEVFN(0, 0)

The would have to be "unsigned int" according to the function signature.

Even though the return value is unsigned int, PCI_DEVFN cannot be bigger than 16 bits.

http://elixir.free-electrons.com/linux/v4.14.1/source/include/uapi/linux/pci.h#L31

/*
* The PCI interface treats multi-function devices as independent
* devices. The slot/function address of each device is encoded
* in a single byte as follows:
*
* 7:3 = slot
* 2:0 = function
*/

It is common practice to use u16 for keeping devfn information in the kernel.

Quoted 10 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam(struct drm_device *dev, void *data, · line 424

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c +2 -0
+
+	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0, devfn);

But the most straightforward change is to simply convert to:

	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0,
							   PCI_DEVFN(0, 0));

Can you please resend like that.

I did this at the beginning and but, I hit a checkpatch problem with more than 80 characters. That's why, I moved the devfn value assignment to a different line.

Quoted 6 lines

Looks like this is a part of abigger series, so others may prefer latter form too, to avoid the variable.

Regards, Joonas

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#12 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

Quoted 50 lines · Sinan Kaya
Quoted 18 lines · Joonas Lahtinen

Dropping the extra mailing lists and Dave, this is a rather trivial thing.

Quoted 9 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

<SNIP>

Quoted 3 lines

+++ b/drivers/gpu/drm/i915/i915_drv.c

(quoted diff) +0 -0
@@ -419,7 +419,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam(struct drm_device *dev, void *data, · line 422

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +1 -1
 static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
 {
-	dev_priv->bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	uint16_t devfn = PCI_DEVFN(0, 0)

The would have to be "unsigned int" according to the function signature.

Even though the return value is unsigned int, PCI_DEVFN cannot be bigger than 16 bits.

http://elixir.free-electrons.com/linux/v4.14.1/source/include/uapi/linux/pci.h#L31

/*
* The PCI interface treats multi-function devices as independent
* devices. The slot/function address of each device is encoded
* in a single byte as follows:
*
* 7:3 = slot
* 2:0 = function
*/

It is common practice to use u16 for keeping devfn information in the kernel.

Quoted 6 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam(struct drm_device *dev, void *data, · line 424

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c +2 -0
+
+	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0, devfn);

But the most straightforward change is to simply convert to:

Quoted 8 lines
Quoted 4 lines
	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0,
							   PCI_DEVFN(0, 0));

Can you please resend like that.

I did this at the beginning and but, I hit a checkpatch problem with more than 80 characters. That's why, I moved the devfn value assignment to a different line.

Please ignore checkpatch when it makes the code worse. 80 is not a strict limit.

BR,
Jani.

Quoted 7 lines
Quoted 7 lines

Looks like this is a part of abigger series, so others may prefer latter form too, to avoid the variable.

Regards, Joonas

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#13 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

Quoted 9 lines · Jani Nikula
Quoted 7 lines
Quoted 4 lines
	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0,
							   PCI_DEVFN(0, 0));

Can you please resend like that.

I did this at the beginning and but, I hit a checkpatch problem with more than 80 characters. That's why, I moved the devfn value assignment to a different line.

Please ignore checkpatch when it makes the code worse. 80 is not a strict limit.

How about this:

	dev_priv->bridge_dev =
		pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));

That should fit, and it's very readable.

Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#14 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

Quoted 11 lines · Timur Tabi
Quoted 9 lines · Jani Nikula
Quoted 7 lines
Quoted 4 lines
	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0,
							   PCI_DEVFN(0, 0));

Can you please resend like that.

I did this at the beginning and but, I hit a checkpatch problem with more than 80 characters. That's why, I moved the devfn value assignment to a different line.

Please ignore checkpatch when it makes the code worse. 80 is not a strict limit.

Quoted 6 lines

How about this:

	dev_priv->bridge_dev =
		pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));

That should fit, and it's very readable.

*shrug* I'm fine with either, though I think the first one I like more when I git grep stuff. Get more contex. But let's not get hung up on this.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
maintainer
#15 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya
Quoted 41 lines · Sinan Kaya
Quoted 18 lines · Joonas Lahtinen

Dropping the extra mailing lists and Dave, this is a rather trivial thing.

Quoted 9 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

<SNIP>

Quoted 3 lines

+++ b/drivers/gpu/drm/i915/i915_drv.c

(quoted diff) +0 -0
@@ -419,7 +419,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam(struct drm_device *dev, void *data, · line 422

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +1 -1
 static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
 {
-	dev_priv->bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	uint16_t devfn = PCI_DEVFN(0, 0)

The would have to be "unsigned int" according to the function signature.

Even though the return value is unsigned int, PCI_DEVFN cannot be bigger than 16 bits.

http://elixir.free-electrons.com/linux/v4.14.1/source/include/uapi/linux/pci.h#L31

/*
* The PCI interface treats multi-function devices as independent
* devices. The slot/function address of each device is encoded
* in a single byte as follows:
*
* 7:3 = slot
* 2:0 = function
*/

Quoted 2 lines

It is common practice to use u16 for keeping devfn information in the kernel.

A quick run of 'git grep "PCI_DEVFN" | egrep "(uint|u)(16|32)"' vs. 'git grep "PCI_DEVFN" | grep "unsigned"' didn't indicate that. And following the function signature would be the thing to do, unless there is some compelling reason not to.

But it's not really relevant as a variable is not needed.

Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam(struct drm_device *dev, void *data, · line 424

Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.c +2 -0
+
+	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0, devfn);

But the most straightforward change is to simply convert to:

Quoted 8 lines
Quoted 4 lines
	dev_priv->bridge_dev = pci_get_domain_bus_and_slot(0, 0,
							   PCI_DEVFN(0, 0));

Can you please resend like that.

I did this at the beginning and but, I hit a checkpatch problem with more than 80 characters. That's why, I moved the devfn value assignment to a different line.

It is not longer than 80 characters when you break line before the PCI_DEVFN like I proposed. Or you can break it after the "=", too, either way works fine.

Regards, Joonas

Signature · 3 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
author
#16 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

Quoted 3 lines · Joonas Lahtinen

It is not longer than 80 characters when you break line before the PCI_DEVFN like I proposed. Or you can break it after the "=", too, either way works fine.

I posted V2 with this suggestion.

https://patchwork.kernel.org/patch/10071759/

Let me know what you think about the domain number call here.

u32 domain = pci_domain_nr(dev_priv->drm.pdev->bus);

I don't have a way to test this change. I traced the drm_device's pdev assignment in the code. It should work fine but I don't have a proof.

If you tell me for sure that this driver will never use a non-zero domain or this driver will never run on another architecture, I can hard-code it as 0 as well.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#17 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

Quoted 5 lines · Sinan Kaya
Quoted 3 lines · Joonas Lahtinen

It is not longer than 80 characters when you break line before the PCI_DEVFN like I proposed. Or you can break it after the "=", too, either way works fine.

Quoted 7 lines

I posted V2 with this suggestion.

https://patchwork.kernel.org/patch/10071759/

Let me know what you think about the domain number call here.

u32 domain = pci_domain_nr(dev_priv->drm.pdev->bus);

The function return signature is 'int' as well as the parameter in pci_get_domain_bus_and_slot is type 'int', so why fight it and try to make the variable 'u32'?

Quoted 2 lines

I don't have a way to test this change. I traced the drm_device's pdev assignment in the code. It should work fine but I don't have a proof.

Send the patch to [email protected] and it should get automatically tested by our CI system.

Regards, Joonas

Signature · 3 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
author
#18 lore raw

Re: [PATCH 09/30] drm/i915: deprecate pci_get_bus_and_slot()

Quoted 10 lines · Joonas Lahtinen
Quoted 9 lines · Sinan Kaya
Quoted 3 lines · Joonas Lahtinen

It is not longer than 80 characters when you break line before the PCI_DEVFN like I proposed. Or you can break it after the "=", too, either way works fine.

I posted V2 with this suggestion.

https://patchwork.kernel.org/patch/10071759/

Quoted 7 lines
Quoted 3 lines

Let me know what you think about the domain number call here.

u32 domain = pci_domain_nr(dev_priv->drm.pdev->bus);

The function return signature is 'int' as well as the parameter in pci_get_domain_bus_and_slot is type 'int', so why fight it and try to make the variable 'u32'?

Agreed. I made this change on V3.

Quoted 6 lines
Quoted 3 lines

I don't have a way to test this change. I traced the drm_device's pdev assignment in the code. It should work fine but I don't have a proof.

Send the patch to [email protected] and it should get automatically tested by our CI system.

Thanks, Let me post V3 and put this address on CC.

Quoted 3 lines

Regards, Joonas

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
author
#19 lore raw

PATCH 10/30 drm/nouveau: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/gpu/drm/nouveau/dispnv04/arb.c           | 3 ++-
 drivers/gpu/drm/nouveau/dispnv04/hw.c            | 6 ++++--
 drivers/gpu/drm/nouveau/nouveau_drm.c            | 3 ++-
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/arb.c +2 -1
index 90075b6..729d7d0 100644
@@ -214,7 +214,8 @@ struct nv_sim_state {
 	    (dev->pdev->device & 0xffff) == 0x01f0 /*CHIPSET_NFORCE2*/) {
 		uint32_t type;
 
-		pci_read_config_dword(pci_get_bus_and_slot(0, 1), 0x7c, &type);
+		pci_read_config_dword(pci_get_domain_bus_and_slot(0, 0, 1),
+				      0x7c, &type);
 
 		sim_data.memory_type = (type >> 12) & 1;
 		sim_data.memory_width = 64;
drivers/gpu/drm/nouveau/dispnv04/hw.c +4 -2
index b985990..4b35093 100644
@@ -221,7 +221,8 @@
 	    (dev->pdev->device & 0x0ff0) == CHIPSET_NFORCE) {
 		uint32_t mpllP;
 
-		pci_read_config_dword(pci_get_bus_and_slot(0, 3), 0x6c, &mpllP);
+		pci_read_config_dword(pci_get_domain_bus_and_slot(0, 0, 3),
+				      0x6c, &mpllP);
 		mpllP = (mpllP >> 8) & 0xf;
 		if (!mpllP)
 			mpllP = 4;
@@ -232,7 +233,8 @@
 	    (dev->pdev->device & 0xff0) == CHIPSET_NFORCE2) {
 		uint32_t clock;
 
-		pci_read_config_dword(pci_get_bus_and_slot(0, 5), 0x4c, &clock);
+		pci_read_config_dword(pci_get_domain_bus_and_slot(0, 0, 5),
+				      0x4c, &clock);
 		return clock / 1000;
 	}
 
drivers/gpu/drm/nouveau/nouveau_drm.c +2 -1
index 595630d..0b6c639 100644
@@ -406,7 +406,8 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 	}
 
 	/* subfunction one is a hdmi audio device? */
-	drm->hdmi_device = pci_get_bus_and_slot((unsigned int)pdev->bus->number,
+	drm->hdmi_device = pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
+						(unsigned int)pdev->bus->number,
 						PCI_DEVFN(PCI_SLOT(pdev->devfn), 1));
 
 	if (!drm->hdmi_device) {
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c +1 -1
index 3c6a871..3d2a203 100644
@@ -29,7 +29,7 @@
 	struct pci_dev *bridge;
 	u32 mem, mib;
 
-	bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 1));
+	bridge = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 1));
 	if (!bridge) {
 		nvkm_error(&fb->subdev, "no bridge device\n");
 		return -ENODEV;
Signature · 1 line
1.9.1
author
#20 lore raw

PATCH 11/30 hwmon: (coretemp) deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/hwmon/coretemp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwmon/coretemp.c +2 -1
index c13a4fd..4bdbf77 100644
@@ -246,7 +246,8 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
 	int err;
 	u32 eax, edx;
 	int i;
-	struct pci_dev *host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	u16 devfn = PCI_DEVFN(0, 0);
+	struct pci_dev *host_bridge = pci_get_domain_bus_and_slot(0, 0, devfn);
 
 	/*
 	 * Explicit tjmax table entries override heuristics.
Signature · 1 line
1.9.1
maintainer Applied
#21 lore raw

Re: [11/30] hwmon: (coretemp) deprecate pci_get_bus_and_slot()

Quoted 9 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

Applied to hwmon-next.

Thanks,
Guenter

Quoted 18 lines
---
 drivers/hwmon/coretemp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwmon/coretemp.c +2 -1
index c13a4fd..4bdbf77 100644
@@ -246,7 +246,8 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
 	int err;
 	u32 eax, edx;
 	int i;
-	struct pci_dev *host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	u16 devfn = PCI_DEVFN(0, 0);
+	struct pci_dev *host_bridge = pci_get_domain_bus_and_slot(0, 0, devfn);
 
 	/*
 	 * Explicit tjmax table entries override heuristics.
author
#22 lore raw

PATCH 12/30 Drivers: ide: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/ide/sl82c105.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ide/sl82c105.c +3 -2
index 8755df3..3300dac 100644
@@ -239,8 +239,9 @@ static u8 sl82c105_bridge_revision(struct pci_dev *dev)
 	/*
 	 * The bridge should be part of the same device, but function 0.
 	 */
-	bridge = pci_get_bus_and_slot(dev->bus->number,
-			       PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
+	bridge = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus),
+					dev->bus->number,
+					PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
 	if (!bridge)
 		return -1;
 
Signature · 1 line
1.9.1
maintainer
#23 lore raw

Re: [PATCH 12/30] Drivers: ide: deprecate pci_get_bus_and_slot()

Quoted 7 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

While this is a great generic text, you might want to make it a bit more custom to each specific patch. For example, you don't use a domain of 0 in this one, so the text is a bit wrong and confusing if you look at it stand-alone.

I like the series and the idea, just fix up this text in some of the patches and you should be fine.

thanks,

greg k-h

author
#24 lore raw

Re: [PATCH 12/30] Drivers: ide: deprecate pci_get_bus_and_slot()

Quoted 9 lines · Greg KH
Quoted 7 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

Quoted 7 lines

While this is a great generic text, you might want to make it a bit more custom to each specific patch. For example, you don't use a domain of 0 in this one, so the text is a bit wrong and confusing if you look at it stand-alone.

I like the series and the idea, just fix up this text in some of the patches and you should be fine.

OK. Will do on the next version.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
author
#25 lore raw

PATCH 13/30 iommu/amd: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/iommu/amd_iommu.c      |  3 ++-
 drivers/iommu/amd_iommu_init.c | 10 ++++++----
 drivers/iommu/amd_iommu_v2.c   |  3 ++-
 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/iommu/amd_iommu.c +2 -1
index 8e8874d..2c3452f 100644
@@ -528,7 +528,8 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
 	struct iommu_dev_data *dev_data = NULL;
 	struct pci_dev *pdev;
 
-	pdev = pci_get_bus_and_slot(PCI_BUS_NUM(devid), devid & 0xff);
+	pdev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(devid),
+					   devid & 0xff);
 	if (pdev)
 		dev_data = get_dev_data(&pdev->dev);
 
drivers/iommu/amd_iommu_init.c +6 -4
index 6fe2d03..8d159ff 100644
@@ -1697,8 +1697,8 @@ static int iommu_init_pci(struct amd_iommu *iommu)
 	u32 range, misc, low, high;
 	int ret;
 
-	iommu->dev = pci_get_bus_and_slot(PCI_BUS_NUM(iommu->devid),
-					  iommu->devid & 0xff);
+	iommu->dev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(iommu->devid),
+						 iommu->devid & 0xff);
 	if (!iommu->dev)
 		return -ENODEV;
 
@@ -1763,9 +1763,11 @@ static int iommu_init_pci(struct amd_iommu *iommu)
 
 	if (is_rd890_iommu(iommu->dev)) {
 		int i, j;
+		u16 busnr = iommu->dev->bus->number;
+		u16 devfn = PCI_DEVFN(0, 0);
 
-		iommu->root_pdev = pci_get_bus_and_slot(iommu->dev->bus->number,
-				PCI_DEVFN(0, 0));
+		iommu->root_pdev = pci_get_domain_bus_and_slot(0, busnr,
+							       devfn);
 
 		/*
 		 * Some rd890 systems may not be fully reconfigured by the
drivers/iommu/amd_iommu_v2.c +2 -1
index 7d94e1d..8696382 100644
@@ -564,7 +564,8 @@ static int ppr_notifier(struct notifier_block *nb, unsigned long e, void *data)
 	finish      = (iommu_fault->tag >> 9) & 1;
 
 	devid = iommu_fault->device_id;
-	pdev = pci_get_bus_and_slot(PCI_BUS_NUM(devid), devid & 0xff);
+	pdev = pci_get_domain_bus_and_slot(0, PCI_BUS_NUM(devid),
+					   devid & 0xff);
 	if (!pdev)
 		return -ENODEV;
 	dev_data = get_dev_data(&pdev->dev);
Signature · 1 line
1.9.1
author
#26 lore raw

PATCH 14/30 powerpc/powermac: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/macintosh/via-pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/via-pmu.c +1 -1
index c4c2b3b..3e8b3b6 100644
@@ -1799,7 +1799,7 @@ static int powerbook_sleep_grackle(void)
 	struct adb_request req;
 	struct pci_dev *grackle;
 
-	grackle = pci_get_bus_and_slot(0, 0);
+	grackle = pci_get_domain_bus_and_slot(0, 0, 0);
 	if (!grackle)
 		return -ENODEV;
 
Signature · 1 line
1.9.1
author
#27 lore raw

PATCH 15/30 bnx2x: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 10 +++++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +9 -1
index 9ca994d..9f40c23 100644
@@ -812,7 +812,7 @@ static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp, u8 abs_vfid)
 	if (!vf)
 		return false;
 
-	dev = pci_get_bus_and_slot(vf->bus, vf->devfn);
+	dev = pci_get_domain_bus_and_slot(vf->domain, vf->bus, vf->devfn);
 	if (dev)
 		return bnx2x_is_pcie_pending(dev);
 	return false;
@@ -1041,6 +1041,13 @@ void bnx2x_iov_init_dmae(struct bnx2x *bp)
 		REG_WR(bp, DMAE_REG_BACKWARD_COMP_EN, 0);
 }
 
+static int bnx2x_vf_domain(struct bnx2x *bp, int vfid)
+{
+	struct pci_dev *dev = bp->pdev;
+
+	return pci_domain_nr(dev->bus);
+}
+
 static int bnx2x_vf_bus(struct bnx2x *bp, int vfid)
 {
 	struct pci_dev *dev = bp->pdev;
@@ -1611,6 +1618,7 @@ int bnx2x_iov_nic_init(struct bnx2x *bp)
 		struct bnx2x_virtf *vf = BP_VF(bp, vfid);
 
 		/* fill in the BDF and bars */
+		vf->domain = bnx2x_vf_domain(bp, vfid);
 		vf->bus = bnx2x_vf_bus(bp, vfid);
 		vf->devfn = bnx2x_vf_devfn(bp, vfid);
 		bnx2x_vf_set_bars(bp, vf);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +1 -0
index 53466f6..eb814c6 100644
@@ -182,6 +182,7 @@ struct bnx2x_virtf {
 	u32 error;	/* 0 means all's-well */
 
 	/* BDF */
+	unsigned int domain;
 	unsigned int bus;
 	unsigned int devfn;
 
Signature · 1 line
1.9.1
author
#28 lore raw

PATCH 16/30 pch_gbe: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +5 -2
index 5ae9681..0df94ac 100644
@@ -2560,6 +2560,7 @@ static int pch_gbe_probe(struct pci_dev *pdev,
 {
 	struct net_device *netdev;
 	struct pch_gbe_adapter *adapter;
+	int domainnr, busnr;
 	int ret;
 
 	ret = pcim_enable_device(pdev);
@@ -2603,8 +2604,10 @@ static int pch_gbe_probe(struct pci_dev *pdev,
 	if (adapter->pdata && adapter->pdata->platform_init)
 		adapter->pdata->platform_init(pdev);
 
-	adapter->ptp_pdev = pci_get_bus_and_slot(adapter->pdev->bus->number,
-					       PCI_DEVFN(12, 4));
+	domainnr = pci_domain_nr(adapter->pdev->bus);
+	busnr = adapter->pdev->bus->number
+	adapter->ptp_pdev = pci_get_domain_bus_and_slot(domainnr, busnr,
+							PCI_DEVFN(12, 4));
 
 	netdev->netdev_ops = &pch_gbe_netdev_ops;
 	netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD;
Signature · 1 line
1.9.1
author
#29 lore raw

PATCH 17/30 PCI: cpqhp: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/pci/hotplug/cpqphp_pci.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/pci/hotplug/cpqphp_pci.c +14 -4
index e220d49..8897a77 100644
@@ -89,7 +89,9 @@ int cpqhp_configure_device(struct controller *ctrl, struct pci_func *func)
 	pci_lock_rescan_remove();
 
 	if (func->pci_dev == NULL)
-		func->pci_dev = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, func->function));
+		func->pci_dev = pci_get_domain_bus_and_slot(0, func->bus,
+							PCI_DEVFN(func->device,
+							func->function));
 
 	/* No pci device, we need to create it then */
 	if (func->pci_dev == NULL) {
@@ -99,7 +101,9 @@ int cpqhp_configure_device(struct controller *ctrl, struct pci_func *func)
 		if (num)
 			pci_bus_add_devices(ctrl->pci_dev->bus);
 
-		func->pci_dev = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, func->function));
+		func->pci_dev = pci_get_domain_bus_and_slot(0, func->bus,
+							PCI_DEVFN(func->device,
+							func->function));
 		if (func->pci_dev == NULL) {
 			dbg("ERROR: pci_dev still null\n");
 			goto out;
@@ -129,7 +133,10 @@ int cpqhp_unconfigure_device(struct pci_func *func)
 
 	pci_lock_rescan_remove();
 	for (j = 0; j < 8 ; j++) {
-		struct pci_dev *temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j));
+		struct pci_dev *temp = pci_get_domain_bus_and_slot(0,
+							func->bus,
+							PCI_DEVFN(func->device,
+							j));
 		if (temp) {
 			pci_dev_put(temp);
 			pci_stop_and_remove_bus_device(temp);
@@ -319,6 +326,7 @@ int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug)
 	int cloop = 0;
 	int stop_it;
 	int index;
+	u16 devfn;
 
 	/* Decide which slots are supported */
 
@@ -416,7 +424,9 @@ int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug)
 			new_slot->switch_save = 0x10;
 			/* In case of unsupported board */
 			new_slot->status = DevError;
-			new_slot->pci_dev = pci_get_bus_and_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function);
+			devfn = (new_slot->device << 3) | new_slot->function;
+			new_slot->pci_dev = pci_get_domain_bus_and_slot(0,
+							new_slot->bus, devfn);
 
 			for (cloop = 0; cloop < 0x20; cloop++) {
 				rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), cloop << 2, (u32 *) &(new_slot->config_space[cloop]));
Signature · 1 line
1.9.1
author
#30 lore raw

PATCH 18/30 PCI: ibmphp: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/pci/hotplug/ibmphp_core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pci/hotplug/ibmphp_core.c +4 -3
index 73cf846..92dd882 100644
@@ -707,7 +707,8 @@ static void ibm_unconfigure_device(struct pci_func *func)
 	pci_lock_rescan_remove();
 
 	for (j = 0; j < 0x08; j++) {
-		temp = pci_get_bus_and_slot(func->busno, (func->device << 3) | j);
+		temp = pci_get_domain_bus_and_slot(0, func->busno,
+						   (func->device << 3) | j);
 		if (temp) {
 			pci_stop_and_remove_bus_device(temp);
 			pci_dev_put(temp);
@@ -780,7 +781,7 @@ static int ibm_configure_device(struct pci_func *func)
 	if (!(bus_structure_fixup(func->busno)))
 		flag = 1;
 	if (func->dev == NULL)
-		func->dev = pci_get_bus_and_slot(func->busno,
+		func->dev = pci_get_domain_bus_and_slot(0, func->busno,
 				PCI_DEVFN(func->device, func->function));
 
 	if (func->dev == NULL) {
@@ -793,7 +794,7 @@ static int ibm_configure_device(struct pci_func *func)
 		if (num)
 			pci_bus_add_devices(bus);
 
-		func->dev = pci_get_bus_and_slot(func->busno,
+		func->dev = pci_get_domain_bus_and_slot(0, func->busno,
 				PCI_DEVFN(func->device, func->function));
 		if (func->dev == NULL) {
 			err("ERROR... : pci_dev still NULL\n");
Signature · 1 line
1.9.1
author
#31 lore raw

PATCH 19/30 PCI/quirks: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/pci/quirks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/quirks.c +1 -1
index 911b3b6..85a5308 100644
@@ -2699,7 +2699,7 @@ static void __nv_msi_ht_cap_quirk(struct pci_dev *dev, int all)
 	 * HT MSI mapping should be disabled on devices that are below
 	 * a non-Hypertransport host bridge. Locate the host bridge...
 	 */
-	host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	host_bridge = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
 	if (host_bridge == NULL) {
 		dev_warn(&dev->dev, "nv_msi_ht_cap_quirk didn't locate host bridge\n");
 		return;
Signature · 1 line
1.9.1
author
#32 lore raw

PATCH 20/30 PCI/syscall: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/pci/syscall.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/syscall.c +2 -2
index 83efa00..e725f99 100644
@@ -28,7 +28,7 @@
 		return -EPERM;
 
 	err = -ENODEV;
-	dev = pci_get_bus_and_slot(bus, dfn);
+	dev = pci_get_domain_bus_and_slot(0, bus, dfn);
 	if (!dev)
 		goto error;
 
@@ -96,7 +96,7 @@
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 
-	dev = pci_get_bus_and_slot(bus, dfn);
+	dev = pci_get_domain_bus_and_slot(0, bus, dfn);
 	if (!dev)
 		return -ENODEV;
 
Signature · 1 line
1.9.1
author
#33 lore raw

PATCH 21/30 xen: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/pci/xen-pcifront.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/xen-pcifront.c +2 -1
index 8fc2e95..94b25b5 100644
@@ -595,6 +595,7 @@ static pci_ers_result_t pcifront_common_process(int cmd,
 	struct pci_driver *pdrv;
 	int bus = pdev->sh_info->aer_op.bus;
 	int devfn = pdev->sh_info->aer_op.devfn;
+	int domain = pdev->sh_info->aer_op.domain;
 	struct pci_dev *pcidev;
 	int flag = 0;
 
@@ -603,7 +604,7 @@ static pci_ers_result_t pcifront_common_process(int cmd,
 		cmd, bus, devfn);
 	result = PCI_ERS_RESULT_NONE;
 
-	pcidev = pci_get_bus_and_slot(bus, devfn);
+	pcidev = pci_get_domain_bus_and_slot(domain, bus, devfn);
 	if (!pcidev || !pcidev->driver) {
 		dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
 		pci_dev_put(pcidev);
Signature · 1 line
1.9.1
maintainer Reviewed-by on v1 21/30
#34 lore raw

Re: [PATCH 21/30] xen: deprecate pci_get_bus_and_slot()

Quoted 9 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

Juergen

maintainer Reviewed-by on v1 21/30
#35 lore raw

Re: [PATCH 21/30] xen: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya
Quoted 9 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#36 lore raw

PATCH 22/30 openprom: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/sbus/char/openprom.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/sbus/char/openprom.c +3 -2
index 2c2e6a3..7b31f19 100644
@@ -251,8 +251,9 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
 		struct pci_dev *pdev;
 		struct device_node *dp;
 
-		pdev = pci_get_bus_and_slot (((int *) op->oprom_array)[0],
-				      ((int *) op->oprom_array)[1]);
+		pdev = pci_get_domain_bus_and_slot(0,
+						((int *) op->oprom_array)[0],
+						((int *) op->oprom_array)[1]);
 
 		dp = pci_device_to_OF_node(pdev);
 		data->current_node = dp;
Signature · 1 line
1.9.1
author
#37 lore raw

PATCH 23/30 atomisp: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c               | 2 +-
 drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +1 -1
index 663aa91..95b9c7a 100644
@@ -1233,7 +1233,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	isp->pdev = dev;
 	isp->dev = &dev->dev;
 	isp->sw_contex.power_state = ATOM_ISP_POWER_UP;
-	isp->pci_root = pci_get_bus_and_slot(0, 0);
+	isp->pci_root = pci_get_domain_bus_and_slot(0, 0, 0);
 	if (!isp->pci_root) {
 		dev_err(&dev->dev, "Unable to find PCI host\n");
 		return -ENODEV;
drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c +1 -1
index 4631b1d..51dcef57 100644
@@ -39,7 +39,7 @@ static inline int platform_is(u8 model)
 
 static int intel_mid_msgbus_init(void)
 {
-	pci_root = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+	pci_root = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
 	if (!pci_root) {
 		pr_err("%s: Error: msgbus PCI handle NULL\n", __func__);
 		return -ENODEV;
Signature · 1 line
1.9.1
#38 lore raw

Re: [PATCH 23/30] [media] atomisp: deprecate pci_get_bus_and_slot()

Quoted 5 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
where a PCI device is present. This restricts the device drivers to be
reused for other domain numbers.

The ISP v2 will always been in domain 0.

Alan

author
#39 lore raw

Re: [PATCH 23/30] [media] atomisp: deprecate pci_get_bus_and_slot()

Hi Alex,

Quoted 9 lines · Alan Cox
Quoted 5 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
where a PCI device is present. This restricts the device drivers to be
reused for other domain numbers.

The ISP v2 will always been in domain 0.

Sorry, I didn't get what you mean. Do you mean that you are OK with the change (thus, can I get a reviewed by) or do you mean that I should fix the commit message?

I wrote a generic commit message and applied it to all 30 patches that are more or less similar. I can certainly tailor the message a little bit for atomisp since you confirmed domain 0.

Quoted 3 lines

Alan

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
author
#40 lore raw

Re: [PATCH 23/30] [media] atomisp: deprecate pci_get_bus_and_slot()

Quoted 1 line · Sinan Kaya

Hi Alex,

I tried to mean Alan. Sorry about that.

Apparently, I didn't have enough coffee this morning. I shouldn't touch the code for a few hours.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#41 lore raw

Re: [PATCH 23/30] [media] atomisp: deprecate pci_get_bus_and_slot()

In reply to Alan Cox
Quoted 8 lines · On Wed, 22 Nov 2017 12:20:47 +0000 Alan Cox <[email protected]> wrote:
Quoted 5 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
where a PCI device is present. This restricts the device drivers to be
reused for other domain numbers.

The ISP v2 will always been in domain 0.

For the ISP it doesn't matter - if it cleans up general assumptions then you have my ACK for it.

Alan

author
#42 lore raw

PATCH 24/30 staging: rts5208: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/staging/rts5208/rtsx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rts5208/rtsx.c +1 -1
index 89e2cfe..13b14fe 100644
@@ -281,7 +281,7 @@ int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val)
 	u8 data;
 	u8 devfn = (dev << 3) | func;
 
-	pdev = pci_get_bus_and_slot(bus, devfn);
+	pdev = pci_get_domain_bus_and_slot(0, bus, devfn);
 	if (!pdev)
 		return -1;
 
Signature · 1 line
1.9.1
#43 lore raw

Re: [PATCH 24/30] staging: rts5208: deprecate pci_get_bus_and_slot()

Quoted 18 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/staging/rts5208/rtsx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rts5208/rtsx.c +0 -0
index 89e2cfe..13b14fe 100644

drivers/staging/rts5208/rtsx.c int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val) · line 284

Quoted 5 lines
drivers/staging/rts5208/rtsx.c +1 -1
@@ -281,7 +281,7 @@ int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val)
 	u8 data;
 	u8 devfn = (dev << 3) | func;
 
-	pdev = pci_get_bus_and_slot(bus, devfn);
+	pdev = pci_get_domain_bus_and_slot(0, bus, devfn);

Ugh, this whole function should go away, but it's good enough for now, I'll queue it up after -rc1 is out.

thanks,

greg k-h

author
#44 lore raw

PATCH 25/30 backlight: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/video/backlight/apple_bl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/apple_bl.c +1 -1
index d843296..6a34ab9 100644
@@ -143,7 +143,7 @@ static int apple_bl_add(struct acpi_device *dev)
 	struct pci_dev *host;
 	int intensity;
 
-	host = pci_get_bus_and_slot(0, 0);
+	host = pci_get_domain_bus_and_slot(0, 0, 0);
 
 	if (!host) {
 		pr_err("unable to find PCI host\n");
Signature · 1 line
1.9.1
author
#45 lore raw

PATCH 26/30 video: fbdev: intelfb: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/video/fbdev/intelfb/intelfbhw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/fbdev/intelfb/intelfbhw.c +3 -1
index d31ed4e..496c045 100644
@@ -175,13 +175,15 @@ int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
 {
 	struct pci_dev *bridge_dev;
 	u16 tmp;
+	u16 devfn;
 	int stolen_overhead;
 
 	if (!pdev || !aperture_size || !stolen_size)
 		return 1;
 
+	devfn = PCI_DEVFN(0, 0);
 	/* Find the bridge device.  It is always 0:0.0 */
-	if (!(bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)))) {
+	if (!(bridge_dev = pci_get_domain_bus_and_slot(0, 0, devfn))) {
 		ERR_MSG("cannot find bridge device\n");
 		return 1;
 	}
Signature · 1 line
1.9.1
author
#46 lore raw

PATCH 27/30 video: fbdev: nvidia: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/video/fbdev/nvidia/nv_hw.c    | 10 +++++-----
 drivers/video/fbdev/nvidia/nv_setup.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/video/fbdev/nvidia/nv_hw.c +5 -5
index 81c80ac..3374c5d 100644
@@ -686,7 +686,7 @@ static void nForceUpdateArbitrationSettings(unsigned VClk,
 
 	if ((par->Chipset & 0x0FF0) == 0x01A0) {
 		unsigned int uMClkPostDiv;
-		dev = pci_get_bus_and_slot(0, 3);
+		dev = pci_get_domain_bus_and_slot(0, 0, 3);
 		pci_read_config_dword(dev, 0x6C, &uMClkPostDiv);
 		uMClkPostDiv = (uMClkPostDiv >> 8) & 0xf;
 
@@ -694,7 +694,7 @@ static void nForceUpdateArbitrationSettings(unsigned VClk,
 			uMClkPostDiv = 4;
 		MClk = 400000 / uMClkPostDiv;
 	} else {
-		dev = pci_get_bus_and_slot(0, 5);
+		dev = pci_get_domain_bus_and_slot(0, 0, 5);
 		pci_read_config_dword(dev, 0x4c, &MClk);
 		MClk /= 1000;
 	}
@@ -707,13 +707,13 @@ static void nForceUpdateArbitrationSettings(unsigned VClk,
 	sim_data.pix_bpp = (char)pixelDepth;
 	sim_data.enable_video = 0;
 	sim_data.enable_mp = 0;
-	dev = pci_get_bus_and_slot(0, 1);
+	dev = pci_get_domain_bus_and_slot(0, 0, 1);
 	pci_read_config_dword(dev, 0x7C, &sim_data.memory_type);
 	pci_dev_put(dev);
 	sim_data.memory_type = (sim_data.memory_type >> 12) & 1;
 	sim_data.memory_width = 64;
 
-	dev = pci_get_bus_and_slot(0, 3);
+	dev = pci_get_domain_bus_and_slot(0, 0, 3);
 	pci_read_config_dword(dev, 0, &memctrl);
 	pci_dev_put(dev);
 	memctrl >>= 16;
@@ -721,7 +721,7 @@ static void nForceUpdateArbitrationSettings(unsigned VClk,
 	if ((memctrl == 0x1A9) || (memctrl == 0x1AB) || (memctrl == 0x1ED)) {
 		u32 dimm[3];
 
-		dev = pci_get_bus_and_slot(0, 2);
+		dev = pci_get_domain_bus_and_slot(0, 0, 2);
 		pci_read_config_dword(dev, 0x40, &dimm[0]);
 		dimm[0] = (dimm[0] >> 8) & 0x4f;
 		pci_read_config_dword(dev, 0x44, &dimm[1]);
drivers/video/fbdev/nvidia/nv_setup.c +1 -1
index 2f2e162..79806ff 100644
@@ -264,7 +264,7 @@ static void nv10GetConfig(struct nvidia_par *par)
 	}
 #endif
 
-	dev = pci_get_bus_and_slot(0, 1);
+	dev = pci_get_domain_bus_and_slot(0, 0, 1);
 	if ((par->Chipset & 0xffff) == 0x01a0) {
 		u32 amt;
 
Signature · 1 line
1.9.1
author
#47 lore raw

PATCH 28/30 video: fbdev: riva: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 drivers/video/fbdev/riva/nv_driver.c | 4 ++--
 drivers/video/fbdev/riva/riva_hw.c   | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/video/fbdev/riva/nv_driver.c +2 -2
index f3694cf..d31f51b 100644
@@ -226,12 +226,12 @@ unsigned long riva_get_memlen(struct riva_par *par)
 	case NV_ARCH_30:
 		if(chipset == NV_CHIP_IGEFORCE2) {
 
-			dev = pci_get_bus_and_slot(0, 1);
+			dev = pci_get_domain_bus_and_slot(0, 0, 1);
 			pci_read_config_dword(dev, 0x7C, &amt);
 			pci_dev_put(dev);
 			memlen = (((amt >> 6) & 31) + 1) * 1024;
 		} else if (chipset == NV_CHIP_0x01F0) {
-			dev = pci_get_bus_and_slot(0, 1);
+			dev = pci_get_domain_bus_and_slot(0, 0, 1);
 			pci_read_config_dword(dev, 0x84, &amt);
 			pci_dev_put(dev);
 			memlen = (((amt >> 4) & 127) + 1) * 1024;
drivers/video/fbdev/riva/riva_hw.c +4 -4
index 8bdf37f..29956df 100644
@@ -1117,7 +1117,7 @@ static char nv3_get_param(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_ar
     unsigned int uMClkPostDiv;
     struct pci_dev *dev;
 
-    dev = pci_get_bus_and_slot(0, 3);
+    dev = pci_get_domain_bus_and_slot(0, 0, 3);
     pci_read_config_dword(dev, 0x6C, &uMClkPostDiv);
     pci_dev_put(dev);
     uMClkPostDiv = (uMClkPostDiv >> 8) & 0xf;
@@ -1132,7 +1132,7 @@ static char nv3_get_param(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_ar
     sim_data.enable_video   = 0;
     sim_data.enable_mp      = 0;
 
-    dev = pci_get_bus_and_slot(0, 1);
+    dev = pci_get_domain_bus_and_slot(0, 0, 1);
     pci_read_config_dword(dev, 0x7C, &sim_data.memory_type);
     pci_dev_put(dev);
     sim_data.memory_type    = (sim_data.memory_type >> 12) & 1;
@@ -2118,12 +2118,12 @@ static char nv3_get_param(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_ar
      * Fill in chip configuration.
      */
     if(chipset == NV_CHIP_IGEFORCE2) {
-        dev = pci_get_bus_and_slot(0, 1);
+        dev = pci_get_domain_bus_and_slot(0, 0, 1);
         pci_read_config_dword(dev, 0x7C, &amt);
         pci_dev_put(dev);
         chip->RamAmountKBytes = (((amt >> 6) & 31) + 1) * 1024;
     } else if(chipset == NV_CHIP_0x01F0) {
-        dev = pci_get_bus_and_slot(0, 1);
+        dev = pci_get_domain_bus_and_slot(0, 0, 1);
         pci_read_config_dword(dev, 0x84, &amt);
         pci_dev_put(dev);
         chip->RamAmountKBytes = (((amt >> 4) & 127) + 1) * 1024;
Signature · 1 line
1.9.1
author
#48 lore raw

PATCH 29/30 i7300_idle: deprecate pci_get_bus_and_slot()

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 include/linux/i7300_idle.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/i7300_idle.h +2 -2
index 4dbe651..58cd9c6 100644
@@ -48,7 +48,7 @@ static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
 	int i;
 	struct pci_dev *memdev, *dmadev;
 
-	memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
+	memdev = pci_get_domain_bus_and_slot(0, MEMCTL_BUS, MEMCTL_DEVFN);
 	if (!memdev)
 		return -ENODEV;
 
@@ -61,7 +61,7 @@ static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
 	if (pci_tbl[i].vendor == 0)
 		return -ENODEV;
 
-	dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN);
+	dmadev = pci_get_domain_bus_and_slot(0, IOAT_BUS, IOAT_DEVFN);
 	if (!dmadev)
 		return -ENODEV;
 
Signature · 1 line
1.9.1
#49 lore raw

Re: [PATCH 29/30] i7300_idle: deprecate pci_get_bus_and_slot()

Quoted 18 lines · Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

---
 include/linux/i7300_idle.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/i7300_idle.h +0 -0
index 4dbe651..58cd9c6 100644

include/linux/i7300_idle.h static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev, · line 51

Quoted 5 lines
include/linux/i7300_idle.h +1 -1
@@ -48,7 +48,7 @@ static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
 	int i;
 	struct pci_dev *memdev, *dmadev;
 
-	memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
+	memdev = pci_get_domain_bus_and_slot(0, MEMCTL_BUS, MEMCTL_DEVFN);

You have a pci_dev, why can't you use it here to get the domain?

include/linux/i7300_idle.h static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev, · line 64

Quoted 9 lines
include/linux/i7300_idle.h +1 -1
 	if (!memdev)
 		return -ENODEV;
 
@@ -61,7 +61,7 @@ static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
 	if (pci_tbl[i].vendor == 0)
 		return -ENODEV;
 
-	dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN);
+	dmadev = pci_get_domain_bus_and_slot(0, IOAT_BUS, IOAT_DEVFN);

Same here.

thanks,

greg k-h

author
#50 lore raw

Re: [PATCH 29/30] i7300_idle: deprecate pci_get_bus_and_slot()

Quoted 9 lines · Greg Kroah-Hartman

include/linux/i7300_idle.h static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev, · line 51

Quoted 7 lines

+++ b/include/linux/i7300_idle.h

include/linux/i7300_idle.h +1 -1
@@ -48,7 +48,7 @@ static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
 	int i;
 	struct pci_dev *memdev, *dmadev;
 
-	memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
+	memdev = pci_get_domain_bus_and_slot(0, MEMCTL_BUS, MEMCTL_DEVFN);

You have a pci_dev, why can't you use it here to get the domain?

Both fbd_dev and ioat_dev are output parameters.

dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN); memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);

	for (i = 0; fbd_ioat_list[i].vendor != 0; i++) {
		if (dmadev->vendor == fbd_ioat_list[i].vendor &&
		    dmadev->device == fbd_ioat_list[i].ioat_dev) {
			if (!(fbd_ioat_list[i].enabled || enable_all))
				continue;

			if (fbd_dev)
				*fbd_dev = memdev;
			if (ioat_dev)
				*ioat_dev = dmadev;

Funny thing is nobody is calling this function. Maybe, I should just kill it instead.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#51 lore raw

Re: [PATCH 29/30] i7300_idle: deprecate pci_get_bus_and_slot()

Quoted 27 lines · Sinan Kaya
Quoted 9 lines · Greg Kroah-Hartman

include/linux/i7300_idle.h static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev, · line 51

Quoted 7 lines

+++ b/include/linux/i7300_idle.h

include/linux/i7300_idle.h +1 -1
@@ -48,7 +48,7 @@ static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
 	int i;
 	struct pci_dev *memdev, *dmadev;
 
-	memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
+	memdev = pci_get_domain_bus_and_slot(0, MEMCTL_BUS, MEMCTL_DEVFN);

You have a pci_dev, why can't you use it here to get the domain?

Both fbd_dev and ioat_dev are output parameters.

dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN); memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);

	for (i = 0; fbd_ioat_list[i].vendor != 0; i++) {
		if (dmadev->vendor == fbd_ioat_list[i].vendor &&
		    dmadev->device == fbd_ioat_list[i].ioat_dev) {
			if (!(fbd_ioat_list[i].enabled || enable_all))
				continue;

			if (fbd_dev)
				*fbd_dev = memdev;
			if (ioat_dev)
				*ioat_dev = dmadev;
Quoted 2 lines

Funny thing is nobody is calling this function. Maybe, I should just kill it instead.

Yes, delete it. Why doesn't the build warn about it not being used?

thanks,

greg k-h

author
#52 lore raw

Re: [PATCH 29/30] i7300_idle: deprecate pci_get_bus_and_slot()

Quoted 4 lines · Greg Kroah-Hartman
Quoted 2 lines

Funny thing is nobody is calling this function. Maybe, I should just kill it instead.

Yes, delete it. Why doesn't the build warn about it not being used?

OK. Because it is in a header file that nobody includes.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#53 lore raw

Re: [PATCH 29/30] i7300_idle: deprecate pci_get_bus_and_slot()

Quoted 7 lines · Sinan Kaya
Quoted 4 lines · Greg Kroah-Hartman
Quoted 2 lines

Funny thing is nobody is calling this function. Maybe, I should just kill it instead.

Yes, delete it. Why doesn't the build warn about it not being used?

OK. Because it is in a header file that nobody includes.

Even better, just delete the whole file! :)

author
#54 lore raw

PATCH 30/30 PCI: remove pci_get_bus_and_slot() function

In reply to Sinan Kaya

pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers.

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

Now that all users of pci_get_bus_and_slot() switched to pci_get_domain_bus_and_slot(), it is now safe to remove this function.

---
 include/linux/pci.h | 8 --------
 1 file changed, 8 deletions(-)
include/linux/pci.h +0 -8
index d16a7c0..8c1b650 100644
@@ -957,11 +957,6 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
 struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
 struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
 					    unsigned int devfn);
-static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
-						   unsigned int devfn)
-{
-	return pci_get_domain_bus_and_slot(0, bus, devfn);
-}
 struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
 int pci_dev_present(const struct pci_device_id *ids);
 
@@ -1676,9 +1671,6 @@ static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
 static inline struct pci_dev *pci_get_slot(struct pci_bus *bus,
 						unsigned int devfn)
 { return NULL; }
-static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
-						unsigned int devfn)
-{ return NULL; }
 
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
 static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; }
Signature · 1 line
1.9.1
#55 lore raw

Re: [PATCH 30/30] PCI: remove pci_get_bus_and_slot() function

Quoted 6 lines · Sinan Kaya

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

Now that all users of pci_get_bus_and_slot() switched to pci_get_domain_bus_and_slot(), it is now safe to remove this function.

This doesn't really eliminate pci_get_bus_and_slot(), because it doesn't force developers to support non-zero domains. What's to stop a driver developer from doing this?

#define pci_get_bus_and_slot(b, d) pci_get_domain_bus_and_slot(0, b, d)

thereby completely ignoring what you're trying to do?

Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
author
#56 lore raw

Re: [PATCH 30/30] PCI: remove pci_get_bus_and_slot() function

Quoted 5 lines · Timur Tabi
Quoted 4 lines · Sinan Kaya

Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device.

Quoted 9 lines
Quoted 2 lines

Now that all users of pci_get_bus_and_slot() switched to pci_get_domain_bus_and_slot(), it is now safe to remove this function.

This doesn't really eliminate pci_get_bus_and_slot(), because it doesn't force developers to support non-zero domains.? What's to stop a driver developer from doing this?

#define pci_get_bus_and_slot(b, d) pci_get_domain_bus_and_slot(0, b, d)

thereby completely ignoring what you're trying to do?

Surely, the goal is not to eliminate all domain 0 users/assumptions but open the path for flexibility over time.

There are patches in this series where I hard-coded a value of 0 because domain information was not available.

For places where domain number information is available, I extracted domain number and added into pci_get_domain_bus_and_slot() call such as xen or bn drivers.

This will allow these drivers to be used with non-zero segment numbers. These issues were missed until this refactoring took place.

pci_get_domain_bus_and_slot() function makes the developer think about where to find the domain number as it is mandatory.

I also double checked that all current users of pci_get_domain_bus_and_slot() are actually extracting the domain number correctly along with the bus, device, function.

The assumption at this point is for pci_get_bus_and_slot() usages to be caught in code-review.

This is a best-effort approach towards flexibility.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#57 lore raw

Re: [PATCH 30/30] PCI: remove pci_get_bus_and_slot() function

Quoted 2 lines · Sinan Kaya

For places where domain number information is available, I extracted domain number and added into pci_get_domain_bus_and_slot() call such as xen or bn drivers.

My suggestion is that you restrict your first patch set to only these patches.

Quoted 2 lines

The assumption at this point is for pci_get_bus_and_slot() usages to be caught in code-review.

How about this:

static inline struct pci_dev * __deprecated pci_get_bus_and_slot(unsigned int bus,
unsigned int devfn)

{
	return pci_get_domain_bus_and_slot(0, bus, devfn);
}
Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#58 lore raw

Re: [PATCH 30/30] PCI: remove pci_get_bus_and_slot() function

Quoted 10 lines · Timur Tabi
Quoted 2 lines · Sinan Kaya

For places where domain number information is available, I extracted domain number and added into pci_get_domain_bus_and_slot() call such as xen or bn drivers.

My suggestion is that you restrict your first patch set to only these patches.

Quoted 2 lines

The assumption at this point is for pci_get_bus_and_slot() usages to be caught in code-review.

Quoted 8 lines

How about this:

static inline struct pci_dev * __deprecated pci_get_bus_and_slot(unsigned int bus,
unsigned int devfn)

{
	return pci_get_domain_bus_and_slot(0, bus, devfn);
}

Ick, no, why? What is wrong with removing this function as is? Don't mark something as __depreciated if there are no in-kernel users, just delete it and move on.

If you have out-of-tree drivers, then yes, they can make a wrapper for this function like this if they really feel the need, or they can get their code merged :)

thanks,

greg k-h

#59 lore raw

Re: [PATCH 30/30] PCI: remove pci_get_bus_and_slot() function

Quoted 7 lines · Greg KH

Ick, no, why? What is wrong with removing this function as is? Don't mark something as __depreciated if there are no in-kernel users, just delete it and move on.

If you have out-of-tree drivers, then yes, they can make a wrapper for this function like this if they really feel the need, or they can get their code merged:)

Sorry, I guess I should have been clearer. My suggestion was to fix some of the drivers where the domain can be determined, and for the rest, just mark the old function as deprecated.

If that's still a terrible idea, well, okay. I'm just unsure that simply hard-coding a 0 for the domain for some drivers is really a solution. Don't we really want all drivers to properly support all domains?

Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
#60 lore raw

Re: [PATCH 30/30] PCI: remove pci_get_bus_and_slot() function

Quoted 5 lines · Timur Tabi
Quoted 4 lines · Greg KH

Ick, no, why? What is wrong with removing this function as is? Don't mark something as __depreciated if there are no in-kernel users, just delete it and move on.

Quoted 7 lines
Quoted 3 lines

If you have out-of-tree drivers, then yes, they can make a wrapper for this function like this if they really feel the need, or they can get their code merged:)

Sorry, I guess I should have been clearer. My suggestion was to fix some of the drivers where the domain can be determined, and for the rest, just mark the old function as deprecated.

So the build now gets warnings? That's annoying, and then someone else will have to make the exact same patches that were created here?

Quoted 3 lines

If that's still a terrible idea, well, okay. I'm just unsure that simply hard-coding a 0 for the domain for some drivers is really a solution. Don't we really want all drivers to properly support all domains?

I bet all of those drivers don't care because they are running only in systems with 1 domain, otherwise they would be broken today, right? But really, it shouldn't be that hard to get to the "real" PCI device to provide the correct pointer to the domain for most of these, as I pointed out in one patch review already.

thanks,

greg k-h

author
#61 lore raw

Re: [PATCH 30/30] PCI: remove pci_get_bus_and_slot() function

Quoted 9 lines · Greg KH
Quoted 6 lines
Quoted 3 lines

If you have out-of-tree drivers, then yes, they can make a wrapper for this function like this if they really feel the need, or they can get their code merged:)

Sorry, I guess I should have been clearer. My suggestion was to fix some of the drivers where the domain can be determined, and for the rest, just mark the old function as deprecated.

So the build now gets warnings? That's annoying, and then someone else will have to make the exact same patches that were created here?

Quoted 8 lines
Quoted 3 lines

If that's still a terrible idea, well, okay. I'm just unsure that simply hard-coding a 0 for the domain for some drivers is really a solution. Don't we really want all drivers to properly support all domains?

I bet all of those drivers don't care because they are running only in systems with 1 domain, otherwise they would be broken today, right? But really, it shouldn't be that hard to get to the "real" PCI device to provide the correct pointer to the domain for most of these, as I pointed out in one patch review already.

I agree. Point is 95% drivers do support multiple segments. These are the exceptions.

We should try to fix them as much as we can. (I'll take a look at Greg's suggestion)

In the end, this API is a backdoor and workarounds the proper APIs and usual practices like carrying struct pci_dev pointer.

I'm trying to shoot that API in the foot so that a developer thinks twice before putting number 0 there.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.