From patchwork Sun May 26 15:53:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2616981 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 88C093FD4E for ; Sun, 26 May 2013 21:45:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4EF1AE5FFA for ; Sun, 26 May 2013 14:45:19 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F601E5C52 for ; Sun, 26 May 2013 08:58:56 -0700 (PDT) Received: by mail-pa0-f45.google.com with SMTP id tj12so1048006pac.32 for ; Sun, 26 May 2013 08:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=WIdCIgFAQkeuq74+K3owk8mYP7KG7zlZ2Ul5FhovZLw=; b=jMgzrFvmn5Xgukb5i/uyKQZ1thVzQvmTyLQF4q6lstbYod57riTPdELCb8F8GgJS3T 36JyQkfgfxUN/aR9Jr6FJ5iUEqYomFQg4fSXU/i2zUWkb71LKl6Fw9TSzJSnYQdcas0u nWHR/+cmekyT2G4jj/H6piwhDOTDyNBPqmCmxJgAUmlDrecHeIo26tY7RDqAs6aDqeAb q8xI2eMOT/lmFEZqrMQg1ly5W3dUdkcCc2JarXAseSeOBxriTeQRKBIK4zw225scVnRt g6OWSDzxXIdLuKaT482fa1KAeqG08a40JqmAranKtH1VwkzO1Wba2DTW2I0mYAY0sY2G 2G4w== X-Received: by 10.68.222.74 with SMTP id qk10mr25901539pbc.58.1369583935938; Sun, 26 May 2013 08:58:55 -0700 (PDT) Received: from localhost.localdomain ([111.196.197.202]) by mx.google.com with ESMTPSA id ze11sm26603189pab.22.2013.05.26.08.58.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 26 May 2013 08:58:55 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Yinghai Lu Subject: [PATCH v3, part2 14/20] PCI, DRM: use hotplug-safe iterators to walk PCI buses Date: Sun, 26 May 2013 23:53:11 +0800 Message-Id: <1369583597-3801-15-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1369583597-3801-1-git-send-email-jiang.liu@huawei.com> References: <1369583597-3801-1-git-send-email-jiang.liu@huawei.com> X-Mailman-Approved-At: Sun, 26 May 2013 14:45:02 -0700 Cc: Toshi Kani , Jiang Liu , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, "Rafael J . Wysocki" , Yijing Wang , linux-pci@vger.kernel.org, Gu Zheng , Myron Stowe , Jiang Liu X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Enhance DRM drvier to use hotplug-safe iterators to walk PCI buses. Signed-off-by: Jiang Liu Cc: David Airlie 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(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 429e07d..dc8c40b 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -359,9 +359,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