Message ID | 20230825062714.6325-3-sui.jingfeng@linux.dev (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add the pci_get_base_class() helper and use it | expand |
On Fri, 25 Aug 2023 08:27:11 +0200, Sui Jingfeng wrote: > > From: Sui Jingfeng <suijingfeng@loongson.cn> > > Should be no functional change > > Cc: Jaroslav Kysela <perex@perex.cz> > Cc: Takashi Iwai <tiwai@suse.com> > Cc: Fred Oh <fred.oh@linux.intel.com> > Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com> > Cc: Bjorn Helgaas <bhelgaas@google.com> > Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> > --- > sound/pci/hda/hda_intel.c | 16 +++++----------- > 1 file changed, 5 insertions(+), 11 deletions(-) > > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c > index a21b61ad08d1..811a149584f2 100644 > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c > @@ -1429,17 +1429,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); Reviewed-by: Takashi Iwai <tiwai@suse.de> thanks, Takashi
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index a21b61ad08d1..811a149584f2 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1429,17 +1429,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);