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: 2567861 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 E21A5DF24C for ; Tue, 14 May 2013 16:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758221Ab3ENQxc (ORCPT ); Tue, 14 May 2013 12:53:32 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:33182 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758213Ab3ENQxa (ORCPT ); Tue, 14 May 2013 12:53:30 -0400 Received: by mail-pa0-f43.google.com with SMTP id hz10so691818pad.30 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 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: [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> 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 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