diff mbox series

[V2,09/29] drm/i915: deprecate pci_get_bus_and_slot()

Message ID 1511390964-9979-10-git-send-email-okaya@codeaurora.org
State Superseded
Headers show
Series PCI: deprecate pci_get_bus_and_slot() | expand

Commit Message

Sinan Kaya Nov. 22, 2017, 10:49 p.m. UTC
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.

Getting ready to remove pci_get_bus_and_slot() function in favor of
pci_get_domain_bus_and_slot().

Extract the domain number from drm_device and pass it into
pci_get_domain_bus_and_slot() function.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/gpu/drm/i915/i915_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Sinan Kaya Nov. 22, 2017, 11:25 p.m. UTC | #1
On 11/22/2017 5:49 PM, Sinan Kaya wrote:
>  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));
> +	u32 domain = pci_domain_nr(dev_priv->drm.pdev->bus);

I'll convert domain type to int on the next version across the series.

I tried to convert most of the drivers to use pci_domain_nr() per feedback
from Greg KH. I'll hold onto posting a new version until I gather feedback
with the approach I have taken.

I just did a build test with the series.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 9f45cfe..fea2b5e 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -419,7 +419,10 @@  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));
+	u32 domain = pci_domain_nr(dev_priv->drm.pdev->bus);
+
+	dev_priv->bridge_dev =
+		pci_get_domain_bus_and_slot(domain, 0, PCI_DEVFN(0, 0));
 	if (!dev_priv->bridge_dev) {
 		DRM_ERROR("bridge device not found\n");
 		return -1;