diff options
author | Sui Jingfeng <[email protected]> | 2023-08-25 14:27:11 +0800 |
---|---|---|
committer | Bjorn Helgaas <[email protected]> | 2023-09-28 16:54:43 -0500 |
commit | 9ed8fcfd7f17152e6ff5711bb3ddca82f75a38d4 (patch) | |
tree | 0e0a5486631ac96d2aeee2b1aefdf08524e32acd | |
parent | d427da2323b093a65d8317783e76ab8fad2e2ef0 (diff) |
ALSA: hda: Use pci_get_base_class() to reduce duplicated code
Use pci_get_base_class() to reduce duplicated code. No functional change
intended.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sui Jingfeng <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Reviewed-by: Takashi Iwai <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Fred Oh <[email protected]>
Cc: Pierre-Louis Bossart <[email protected]>
Cc: Kai Vehmanen <[email protected]>
-rw-r--r-- | sound/pci/hda/hda_intel.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 765d95e79861..0b5136fddbca 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1417,17 +1417,11 @@ static bool atpx_present(void) acpi_handle dhandle, atpx_handle; acpi_status status; - while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { - dhandle = ACPI_HANDLE(&pdev->dev); - if (dhandle) { - status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); - if (ACPI_SUCCESS(status)) { - pci_dev_put(pdev); - return true; - } - } - } - while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { + while ((pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev))) { + if ((pdev->class != PCI_CLASS_DISPLAY_VGA << 8) && + (pdev->class != PCI_CLASS_DISPLAY_OTHER << 8)) + continue; + dhandle = ACPI_HANDLE(&pdev->dev); if (dhandle) { status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); |