From patchwork Tue May 14 16:51:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2570031 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id CD2D7DF2A2 for ; Wed, 15 May 2013 06:15:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE516E61A2 for ; Tue, 14 May 2013 23:15:59 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B8E7E5DC7 for ; Tue, 14 May 2013 09:53:30 -0700 (PDT) Received: by mail-pb0-f42.google.com with SMTP id up7so591012pbc.15 for ; Tue, 14 May 2013 09:53:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=O2BT4roxqEQlBjWFCA5NVtmx9Cy4cMAgbIULWA1wUE4=; b=nVoragtuVWdG5Md+TmkU5TzTXXOWbHhaa34UJLpL2gq4HOP5KK7idxtrzNVmmpUPZ1 pSBsnXFtbCmyd/EBYzUgda7YGyF0LioBe10wmungNKLUBaCauVCkCqoAc+QILcZhM5Vo OkmXTM77Cj45hqonFszWChD5deJVkjg56Repb+OrMkae2h6K2ClgDF2Cx/rDn24BRpYn +j94DlZ5cOrePtKx4z5VQuOiiGXArcr/iE+3JrJc6sJ+J/VcWbABOy0Mjf60W9M9yY77 qnhXLvcU4wHtsQLvRK3OatbuqI1CkDRyOiAWDcpOcGleOHBCl0O/5o6lTTZ3OmW0M9Q7 s3MA== X-Received: by 10.68.78.37 with SMTP id y5mr34624739pbw.28.1368550409804; Tue, 14 May 2013 09:53:29 -0700 (PDT) Received: from localhost.localdomain ([120.196.98.100]) by mx.google.com with ESMTPSA id v5sm18919924pbz.4.2013.05.14.09.53.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 May 2013 09:53:28 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Yinghai Lu Subject: [RFC PATCH v2, part 2 13/18] PCI, DRM: use hotplug-safe iterators to walk PCI buses Date: Wed, 15 May 2013 00:51:57 +0800 Message-Id: <1368550322-1045-13-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1368550322-1045-1-git-send-email-jiang.liu@huawei.com> References: <1368550322-1045-1-git-send-email-jiang.liu@huawei.com> X-Mailman-Approved-At: Tue, 14 May 2013 22:41:15 -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 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