Message ID | 20230608114322.604887-4-15330273260@189.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp228999vqr; Thu, 8 Jun 2023 05:05:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6URBdP1m9mCinq3u2qd/u9+VRtaRzjER+jTEcLko4o52g68GbbJLc2FUG+SJG9LyvGfBlV X-Received: by 2002:a17:90b:23d1:b0:253:74f8:1e31 with SMTP id md17-20020a17090b23d100b0025374f81e31mr7078311pjb.39.1686225936800; Thu, 08 Jun 2023 05:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686225936; cv=none; d=google.com; s=arc-20160816; b=kFn8URG+8ZyjC/OJP4GpTwdmK11pll1ADQNpLuCwWyv11Jc0V1nkoMTCvr1GQgsNjg 4ua1sAglmCK1Atf4ObaArc4mdc7UbQJmcsKonAvG5SOuCTaKUwKxXJNL/7IQEXFMpSOR w9fwQ1WsHHBVOlT+WcuHB6OKj/LtHU1hdYnKLb9qJopseWucFOOtIgD3FsKV6j8z2AUu TrEAEMJZWAvaBqIYmp+ch76vpOLNi5c1CG6XulxJsFFxiLTfWTeFDtaPb56AcRP/WgyU F5HVq1oh2eA/eOmi/NBPU9BpKfXzQ2Q6aHSIbc77OASjgVMo3j/rV0PWnH4fV5qY+nyr 3PIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :hmm_source_type:hmm_attache_num:hmm_source_ip; bh=4R3N8k9NeCzZGoVzdhd0fwtNFcJ7xwElurykvOQ12e8=; b=OyXPb7LM+4nhz4wg6aN38ov0s7r0u5bQTaoILSu6Zbx/iVVJs1XEdQuOPA1ww7YsK1 +jsvVKTZMJmEuu98QWNl0gDhs2yKmU4ykW94cVdMWvjj+gRymy69mQ/+2HHHkzauVnCF wF7d4BGIBwTM3lrsfNmlz3vf4WCyo/grLBPfol9f5e4BE27+iymzL3ndER4dbL09P/i/ dee/Uu+pJscZTXQwadWwFCbeVY6T4rdZ/MhJ0GFcV7Br2OGW1FblEDm/FxnksFFhk6yn Y74tLyUVjlwvzkkGu3aGzCRpEdCsFnOM3hIBBOHXBFzs1CbTTdK01NfS+w4AlJ+/Byta RUeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p14-20020a17090a348e00b002472cd8ded6si2674355pjb.103.2023.06.08.05.05.04; Thu, 08 Jun 2023 05:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236476AbjFHLnu (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Thu, 8 Jun 2023 07:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236406AbjFHLnl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 8 Jun 2023 07:43:41 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7CB692700; Thu, 8 Jun 2023 04:43:39 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.41:48916.660287130 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id CC14D1002A6; Thu, 8 Jun 2023 19:43:35 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-75648544bd-xwndj with ESMTP id 2966c463e9d240d7a1935434913645a0 for alexander.deucher@amd.com; Thu, 08 Jun 2023 19:43:38 CST X-Transaction-ID: 2966c463e9d240d7a1935434913645a0 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn From: Sui Jingfeng <15330273260@189.cn> To: Alex Deucher <alexander.deucher@amd.com>, Christian Konig <christian.koenig@amd.com>, Pan Xinhui <Xinhui.Pan@amd.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>, Ben Skeggs <bskeggs@redhat.com>, Karol Herbst <kherbst@redhat.com>, Lyude Paul <lyude@redhat.com>, Bjorn Helgaas <bhelgaas@google.com>, Alex Williamson <alex.williamson@redhat.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, Hawking Zhang <Hawking.Zhang@amd.com>, Mario Limonciello <mario.limonciello@amd.com>, Lijo Lazar <lijo.lazar@amd.com>, YiPeng Chai <YiPeng.Chai@amd.com>, Andrey Grodzovsky <andrey.grodzovsky@amd.com>, Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>, Bokun Zhang <Bokun.Zhang@amd.com>, Ville Syrjala <ville.syrjala@linux.intel.com>, Li Yi <liyi@loongson.cn>, Sui Jingfeng <suijingfeng@loongson.cn>, Jason Gunthorpe <jgg@ziepe.ca>, Kevin Tian <kevin.tian@intel.com>, Cornelia Huck <cohuck@redhat.com>, Yishai Hadas <yishaih@nvidia.com>, Abhishek Sahu <abhsahu@nvidia.com>, Yi Liu <yi.l.liu@intel.com> Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v3 3/4] PCI/VGA: only deal with VGA class devices Date: Thu, 8 Jun 2023 19:43:21 +0800 Message-Id: <20230608114322.604887-4-15330273260@189.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230608114322.604887-1-15330273260@189.cn> References: <20230608114322.604887-1-15330273260@189.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FROM_LOCAL_DIGITS, FROM_LOCAL_HEX,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768136047922070947?= X-GMAIL-MSGID: =?utf-8?q?1768136047922070947?= |
Series |
PCI/VGA: introduce is_boot_device function callback to vga_client_register
|
|
Commit Message
Sui Jingfeng
June 8, 2023, 11:43 a.m. UTC
From: Sui Jingfeng <suijingfeng@loongson.cn> vgaarb only deal with the VGA devcie(pdev->class == 0x0300), so replace the pci_get_subsys() function with pci_get_class(). Filter the non pci display device out. There no need to process the non display PCI device. Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> --- drivers/pci/vgaarb.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
Comments
Start with verb and capitalize to match ("Deal only with ...") On Thu, Jun 08, 2023 at 07:43:21PM +0800, Sui Jingfeng wrote: > From: Sui Jingfeng <suijingfeng@loongson.cn> > > vgaarb only deal with the VGA devcie(pdev->class == 0x0300), so replace the > pci_get_subsys() function with pci_get_class(). Filter the non pci display > device out. There no need to process the non display PCI device. s/non pci/non-PCI/ s/non display/non-display/ This is fine, and I'll merge this, but someday I would like to get rid of the bus_register_notifier() and call vga_arbiter_add_pci_device() and vga_arbiter_del_pci_device() directly from the PCI core. Or if you wanted to do that now, that would be even better :) Bjorn > Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> > --- > drivers/pci/vgaarb.c | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > > diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c > index 7f0347f4f6fd..b0bf4952a95d 100644 > --- a/drivers/pci/vgaarb.c > +++ b/drivers/pci/vgaarb.c > @@ -756,10 +756,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) > struct pci_dev *bridge; > u16 cmd; > > - /* Only deal with VGA class devices */ > - if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) > - return false; > - > /* Allocate structure */ > vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL); > if (vgadev == NULL) { > @@ -1499,7 +1495,9 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, > struct pci_dev *pdev = to_pci_dev(dev); > bool notify = false; > > - vgaarb_dbg(dev, "%s\n", __func__); > + /* Only deal with VGA class devices */ > + if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) > + return 0; > > /* For now we're only intereted in devices added and removed. I didn't > * test this thing here, so someone needs to double check for the > @@ -1509,6 +1507,8 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, > else if (action == BUS_NOTIFY_DEL_DEVICE) > notify = vga_arbiter_del_pci_device(pdev); > > + vgaarb_dbg(dev, "%s: action = %lu\n", __func__, action); > + > if (notify) > vga_arbiter_notify_clients(); > return 0; > @@ -1533,8 +1533,8 @@ static struct miscdevice vga_arb_device = { > > static int __init vga_arb_device_init(void) > { > + struct pci_dev *pdev = NULL; > int rc; > - struct pci_dev *pdev; > > rc = misc_register(&vga_arb_device); > if (rc < 0) > @@ -1545,11 +1545,13 @@ static int __init vga_arb_device_init(void) > /* We add all PCI devices satisfying VGA class in the arbiter by > * default > */ > - pdev = NULL; > - while ((pdev = > - pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, > - PCI_ANY_ID, pdev)) != NULL) > + while (1) { > + pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev); > + if (!pdev) > + break; > + > vga_arbiter_add_pci_device(pdev); > + }; > > pr_info("loaded\n"); > return rc; > -- > 2.25.1 >
Hi, On 2023/6/9 03:12, Bjorn Helgaas wrote: > Start with verb and capitalize to match ("Deal only with ...") > > On Thu, Jun 08, 2023 at 07:43:21PM +0800, Sui Jingfeng wrote: >> From: Sui Jingfeng <suijingfeng@loongson.cn> >> >> vgaarb only deal with the VGA devcie(pdev->class == 0x0300), so replace the >> pci_get_subsys() function with pci_get_class(). Filter the non pci display >> device out. There no need to process the non display PCI device. > s/non pci/non-PCI/ > s/non display/non-display/ Will be fixed at next version, thanks for the strict checking, I will try to bring this rigorous to the other patch of myself in the future. > This is fine, and I'll merge this, but someday I would like to get rid > of the bus_register_notifier() and call vga_arbiter_add_pci_device() > and vga_arbiter_del_pci_device() directly from the PCI core. > > Or if you wanted to do that now, that would be even better :) I think, I probably should only do what I'm good at. The "good at" here means that It's under prepared, already matured with thinking(or consideration) by myself. And also including testing(on two or three architecture). That idea is belong to you, I would like to see how does it going to happen only. > Bjorn > >> Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> >> --- >> drivers/pci/vgaarb.c | 22 ++++++++++++---------- >> 1 file changed, 12 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c >> index 7f0347f4f6fd..b0bf4952a95d 100644 >> --- a/drivers/pci/vgaarb.c >> +++ b/drivers/pci/vgaarb.c >> @@ -756,10 +756,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) >> struct pci_dev *bridge; >> u16 cmd; >> >> - /* Only deal with VGA class devices */ >> - if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) >> - return false; >> - >> /* Allocate structure */ >> vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL); >> if (vgadev == NULL) { >> @@ -1499,7 +1495,9 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, >> struct pci_dev *pdev = to_pci_dev(dev); >> bool notify = false; >> >> - vgaarb_dbg(dev, "%s\n", __func__); >> + /* Only deal with VGA class devices */ >> + if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) >> + return 0; >> >> /* For now we're only intereted in devices added and removed. I didn't >> * test this thing here, so someone needs to double check for the >> @@ -1509,6 +1507,8 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, >> else if (action == BUS_NOTIFY_DEL_DEVICE) >> notify = vga_arbiter_del_pci_device(pdev); >> >> + vgaarb_dbg(dev, "%s: action = %lu\n", __func__, action); >> + >> if (notify) >> vga_arbiter_notify_clients(); >> return 0; >> @@ -1533,8 +1533,8 @@ static struct miscdevice vga_arb_device = { >> >> static int __init vga_arb_device_init(void) >> { >> + struct pci_dev *pdev = NULL; >> int rc; >> - struct pci_dev *pdev; >> >> rc = misc_register(&vga_arb_device); >> if (rc < 0) >> @@ -1545,11 +1545,13 @@ static int __init vga_arb_device_init(void) >> /* We add all PCI devices satisfying VGA class in the arbiter by >> * default >> */ >> - pdev = NULL; >> - while ((pdev = >> - pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, >> - PCI_ANY_ID, pdev)) != NULL) >> + while (1) { >> + pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev); >> + if (!pdev) >> + break; >> + >> vga_arbiter_add_pci_device(pdev); >> + }; >> >> pr_info("loaded\n"); >> return rc; >> -- >> 2.25.1 >>
Hi, On 2023/6/9 03:12, Bjorn Helgaas wrote: > Start with verb and capitalize to match ("Deal only with ...") > > On Thu, Jun 08, 2023 at 07:43:21PM +0800, Sui Jingfeng wrote: >> From: Sui Jingfeng <suijingfeng@loongson.cn> >> >> vgaarb only deal with the VGA devcie(pdev->class == 0x0300), so replace the >> pci_get_subsys() function with pci_get_class(). Filter the non pci display >> device out. There no need to process the non display PCI device. > s/non pci/non-PCI/ > s/non display/non-display/ > > This is fine, and I'll merge this, but someday I would like to get rid > of the bus_register_notifier() and call vga_arbiter_add_pci_device() > and vga_arbiter_del_pci_device() directly from the PCI core. Nice idea! But I'm wondering there are traps in this. The pci_notifier in vgaarb.c is still need on Mips platform. Because of loading order problems. On MIPS system, PCI devices are enumerated by pcibios_init(), which runs after vga_arb_device_init(). This is true until now. When vga_arb_device_init() function get called, it will capture nothing. On that time, the system have no PCI device enumerated. Because of this, there are various problems in the past. This is the reason we still need the notifier, we need a way to capture the PCI display device after vgaarb already loaded(finished). On complex case, there are ASpeed BMC, loongson integrated display controller, and radeon discrete video card co-exist on Loongson 3B4000 server. I have fixed various bug at our downstream(linux-4.19) environment. I have fixed a bug on downstream involved with aspeed bmc, by workaround[1]. Chen Huacai grabbing my patch[1] and rewrite it, submit together with him-self's. Its fine, but those patch still look paleness in the front of Loongson integrated display controller. Loongson integrated display controller don't has a dedicated VRAM bar. vga_is_firmware_default() will lose its effectiveness then. This is the reason we reveal our patch(0004 in this series) to face upstream. Its not only for loongson integrated display controller through. Its not uncommon that ARM servers have A aspeed BMC and discrete amdgpu or old radeon card. Let the device drivers gave us a hint probably can help to resolve multi-video card co-exist problem. Consider that sometime user want to use integrate gpu, sometime user want to use discrete gpu. Also, during driver developing(or debugging), driver writer may want override the default boot device. vgaarb probable shouldn't make the decision without giving the device driver a chance to override. Beside, vga_is_firmware_default() only apply for PCI display device. On ARM64 system, there are a lot of platform device. If we move this function back to the device driver, it probably applicable for a platform display controller + one/two PCI display devices case. We find a method at downstream during we get efifb works LoongArch platform. We can utilize the screen_info, screen_info say where's the firmware framebuffer is located at. Drivers for specific hardware platform perhaps know more clearly than vgaarb. if it is the default boot device. [1] https://lore.kernel.org/all/20210514080025.1828197-6-chenhuacai@loongson.cn/ > Or if you wanted to do that now, that would be even better :) > > Bjorn > >> Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> >> --- >> drivers/pci/vgaarb.c | 22 ++++++++++++---------- >> 1 file changed, 12 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c >> index 7f0347f4f6fd..b0bf4952a95d 100644 >> --- a/drivers/pci/vgaarb.c >> +++ b/drivers/pci/vgaarb.c >> @@ -756,10 +756,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) >> struct pci_dev *bridge; >> u16 cmd; >> >> - /* Only deal with VGA class devices */ >> - if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) >> - return false; >> - >> /* Allocate structure */ >> vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL); >> if (vgadev == NULL) { >> @@ -1499,7 +1495,9 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, >> struct pci_dev *pdev = to_pci_dev(dev); >> bool notify = false; >> >> - vgaarb_dbg(dev, "%s\n", __func__); >> + /* Only deal with VGA class devices */ >> + if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) >> + return 0; >> >> /* For now we're only intereted in devices added and removed. I didn't >> * test this thing here, so someone needs to double check for the >> @@ -1509,6 +1507,8 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, >> else if (action == BUS_NOTIFY_DEL_DEVICE) >> notify = vga_arbiter_del_pci_device(pdev); >> >> + vgaarb_dbg(dev, "%s: action = %lu\n", __func__, action); >> + >> if (notify) >> vga_arbiter_notify_clients(); >> return 0; >> @@ -1533,8 +1533,8 @@ static struct miscdevice vga_arb_device = { >> >> static int __init vga_arb_device_init(void) >> { >> + struct pci_dev *pdev = NULL; >> int rc; >> - struct pci_dev *pdev; >> >> rc = misc_register(&vga_arb_device); >> if (rc < 0) >> @@ -1545,11 +1545,13 @@ static int __init vga_arb_device_init(void) >> /* We add all PCI devices satisfying VGA class in the arbiter by >> * default >> */ >> - pdev = NULL; >> - while ((pdev = >> - pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, >> - PCI_ANY_ID, pdev)) != NULL) >> + while (1) { >> + pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev); >> + if (!pdev) >> + break; >> + >> vga_arbiter_add_pci_device(pdev); >> + }; >> >> pr_info("loaded\n"); >> return rc; >> -- >> 2.25.1 >>
diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 7f0347f4f6fd..b0bf4952a95d 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -756,10 +756,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) struct pci_dev *bridge; u16 cmd; - /* Only deal with VGA class devices */ - if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) - return false; - /* Allocate structure */ vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL); if (vgadev == NULL) { @@ -1499,7 +1495,9 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, struct pci_dev *pdev = to_pci_dev(dev); bool notify = false; - vgaarb_dbg(dev, "%s\n", __func__); + /* Only deal with VGA class devices */ + if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) + return 0; /* For now we're only intereted in devices added and removed. I didn't * test this thing here, so someone needs to double check for the @@ -1509,6 +1507,8 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, else if (action == BUS_NOTIFY_DEL_DEVICE) notify = vga_arbiter_del_pci_device(pdev); + vgaarb_dbg(dev, "%s: action = %lu\n", __func__, action); + if (notify) vga_arbiter_notify_clients(); return 0; @@ -1533,8 +1533,8 @@ static struct miscdevice vga_arb_device = { static int __init vga_arb_device_init(void) { + struct pci_dev *pdev = NULL; int rc; - struct pci_dev *pdev; rc = misc_register(&vga_arb_device); if (rc < 0) @@ -1545,11 +1545,13 @@ static int __init vga_arb_device_init(void) /* We add all PCI devices satisfying VGA class in the arbiter by * default */ - pdev = NULL; - while ((pdev = - pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, - PCI_ANY_ID, pdev)) != NULL) + while (1) { + pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev); + if (!pdev) + break; + vga_arbiter_add_pci_device(pdev); + }; pr_info("loaded\n"); return rc;