All of lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH] ALSA: hda/hdmi - fix atpx_present when CLASS is not VGA
@ 2019-12-21  0:17 ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2019-12-21  0:17 UTC (permalink / raw)
  To: amd-gfx, alsa-devel, tiwai; +Cc: Alex Deucher

You can't use PCI_BASE_CLASS with pci_get_class().  This
happens to work by luck on devices with PCI_CLASS_DISPLAY_VGA, but
misses PCI_CLASS_DISPLAY_OTHER.  Add a check for those as well.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 sound/pci/hda/hda_intel.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b856b89378ac..f69c8de64bd6 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1410,7 +1410,17 @@ static bool atpx_present(void)
 	acpi_handle dhandle, atpx_handle;
 	acpi_status status;
 
-	while ((pdev = pci_get_class(PCI_BASE_CLASS_DISPLAY << 16, pdev)) != NULL) {
+	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_FAILURE(status)) {
+				pci_dev_put(pdev);
+				return true;
+			}
+		}
+	}
+	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
 		dhandle = ACPI_HANDLE(&pdev->dev);
 		if (dhandle) {
 			status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
-- 
2.24.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ALSA: hda/hdmi - fix atpx_present when CLASS is not VGA
@ 2019-12-21  0:17 ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2019-12-21  0:17 UTC (permalink / raw)
  To: amd-gfx, alsa-devel, tiwai; +Cc: Alex Deucher

You can't use PCI_BASE_CLASS with pci_get_class().  This
happens to work by luck on devices with PCI_CLASS_DISPLAY_VGA, but
misses PCI_CLASS_DISPLAY_OTHER.  Add a check for those as well.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 sound/pci/hda/hda_intel.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b856b89378ac..f69c8de64bd6 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1410,7 +1410,17 @@ static bool atpx_present(void)
 	acpi_handle dhandle, atpx_handle;
 	acpi_status status;
 
-	while ((pdev = pci_get_class(PCI_BASE_CLASS_DISPLAY << 16, pdev)) != NULL) {
+	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_FAILURE(status)) {
+				pci_dev_put(pdev);
+				return true;
+			}
+		}
+	}
+	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
 		dhandle = ACPI_HANDLE(&pdev->dev);
 		if (dhandle) {
 			status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [alsa-devel] [PATCH] ALSA: hda/hdmi - fix atpx_present when CLASS is not VGA
  2019-12-21  0:17 ` Alex Deucher
@ 2019-12-21  8:29   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2019-12-21  8:29 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Alex Deucher, alsa-devel, amd-gfx

On Sat, 21 Dec 2019 01:17:02 +0100,
Alex Deucher wrote:
> 
> You can't use PCI_BASE_CLASS with pci_get_class().  This
> happens to work by luck on devices with PCI_CLASS_DISPLAY_VGA, but
> misses PCI_CLASS_DISPLAY_OTHER.  Add a check for those as well.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Applied, thanks.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: hda/hdmi - fix atpx_present when CLASS is not VGA
@ 2019-12-21  8:29   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2019-12-21  8:29 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Alex Deucher, alsa-devel, amd-gfx

On Sat, 21 Dec 2019 01:17:02 +0100,
Alex Deucher wrote:
> 
> You can't use PCI_BASE_CLASS with pci_get_class().  This
> happens to work by luck on devices with PCI_CLASS_DISPLAY_VGA, but
> misses PCI_CLASS_DISPLAY_OTHER.  Add a check for those as well.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Applied, thanks.


Takashi
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-21  8:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-21  0:17 [alsa-devel] [PATCH] ALSA: hda/hdmi - fix atpx_present when CLASS is not VGA Alex Deucher
2019-12-21  0:17 ` Alex Deucher
2019-12-21  8:29 ` [alsa-devel] " Takashi Iwai
2019-12-21  8:29   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.