Patchwork [RFC,v2,part,2,13/18] PCI, DRM: use hotplug-safe iterators to walk PCI buses

login
register
mail settings
Submitter Jiang Liu
Date May 14, 2013, 4:51 p.m.
Message ID <1368550322-1045-13-git-send-email-jiang.liu@huawei.com>
Download mbox | patch
Permalink /patch/243774/
State Superseded
Headers show

Comments

Jiang Liu - May 14, 2013, 4:51 p.m.
Enhance DRM drvier to use hotplug-safe iterators to walk PCI buses.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpu/drm/drm_fops.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 13fdcd1..04f3bcd 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -357,9 +357,11 @@  static int drm_open_helper(struct inode *inode, struct file *filp,
 			pci_dev_put(pci_dev);
 		}
 		if (!dev->hose) {
-			struct pci_bus *b = pci_bus_b(pci_root_buses.next);
-			if (b)
+			struct pci_bus *b = pci_get_next_root_bus(NULL);
+			if (b) {
 				dev->hose = b->sysdata;
+				pci_bus_put(b);
+			}
 		}
 	}
 #endif