Skip to content

Commit 36a38c5

Browse files
committed
ALSA: hda: Fix discovery of i915 graphics PCI device
It's been reported that the recent fix for skipping the component-binding with D-GPU caused a regression on some systems; it resulted in the completely missing component binding with i915 GPU. The problem was the use of pci_get_class() function. It matches with the full PCI class bits, while we want to match only partially the PCI base class bits. So, when a system has an i915 graphics device with the PCI class 0380, it won't hit because we're looking for only the PCI class 0300. This patch fixes i915_gfx_present() to look up each PCI device and match with PCI base class explicitly instead of pci_get_class(). Fixes: c9db8a3 ("ALSA: hda/i915 - skip acomp init if no matching display") Reviewed-by: Kai Vehmanen <[email protected]> Tested-by: Kai Vehmanen <[email protected]> Cc: <[email protected]> Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1200611 Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent c7807b2 commit 36a38c5

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

sound/hda/hdac_i915.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,18 @@ static int i915_component_master_match(struct device *dev, int subcomponent,
119119
/* check whether Intel graphics is present and reachable */
120120
static int i915_gfx_present(struct pci_dev *hdac_pci)
121121
{
122-
unsigned int class = PCI_BASE_CLASS_DISPLAY << 16;
123122
struct pci_dev *display_dev = NULL;
124-
bool match = false;
125123

126-
do {
127-
display_dev = pci_get_class(class, display_dev);
128-
129-
if (display_dev && display_dev->vendor == PCI_VENDOR_ID_INTEL &&
124+
for_each_pci_dev(display_dev) {
125+
if (display_dev->vendor == PCI_VENDOR_ID_INTEL &&
126+
(display_dev->class >> 16) == PCI_BASE_CLASS_DISPLAY &&
130127
connectivity_check(display_dev, hdac_pci)) {
131128
pci_dev_put(display_dev);
132-
match = true;
129+
return true;
133130
}
134-
} while (!match && display_dev);
131+
}
135132

136-
return match;
133+
return false;
137134
}
138135

139136
/**

0 commit comments

Comments
 (0)