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: 2616551 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9E18FDFB79 for ; Sun, 26 May 2013 16:00:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754484Ab3EZP66 (ORCPT ); Sun, 26 May 2013 11:58:58 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:56799 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754380Ab3EZP64 (ORCPT ); Sun, 26 May 2013 11:58:56 -0400 Received: by mail-pa0-f48.google.com with SMTP id kp6so5983646pab.21 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 Cc: Jiang Liu , "Rafael J . Wysocki" , Greg Kroah-Hartman , Gu Zheng , Toshi Kani , Myron Stowe , Yijing Wang , Jiang Liu , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, David Airlie , dri-devel@lists.freedesktop.org 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> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.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