* [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci
From: Sui Jingfeng <suijingfeng@loongson.cn>
There is no function that can be used to get all PCI(e) devices in a
system by matching against its the PCI base class code only, while keep
the sub-class code and the programming interface ignored. Therefore, add
the pci_get_base_class() function to suit the need.
For example, if an application want to process all PCI(e) display devices
in a system, it can achieve such goal by writing the code as following:
pdev = NULL;
do {
pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
if (!pdev)
break;
do_something_for_pci_display_device(pdev);
} while (1);
Sui Jingfeng (5):
PCI: Add the pci_get_base_class() helper
ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
drm/nouveau: Use pci_get_base_class() to reduce duplicated code
drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
drm/radeon: Use pci_get_base_class() to reduce duplicated code
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
drivers/pci/search.c | 31 ++++++++++++++++++++++++
include/linux/pci.h | 5 ++++
sound/pci/hda/hda_intel.c | 16 ++++--------
7 files changed, 59 insertions(+), 55 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: amd-gfx, dri-devel, linux-kernel, nouveau, linux-pci, alsa-devel,
Sui Jingfeng
From: Sui Jingfeng <suijingfeng@loongson.cn>
There is no function that can be used to get all PCI(e) devices in a
system by matching against its the PCI base class code only, while keep
the sub-class code and the programming interface ignored. Therefore, add
the pci_get_base_class() function to suit the need.
For example, if an application want to process all PCI(e) display devices
in a system, it can achieve such goal by writing the code as following:
pdev = NULL;
do {
pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
if (!pdev)
break;
do_something_for_pci_display_device(pdev);
} while (1);
Sui Jingfeng (5):
PCI: Add the pci_get_base_class() helper
ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
drm/nouveau: Use pci_get_base_class() to reduce duplicated code
drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
drm/radeon: Use pci_get_base_class() to reduce duplicated code
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
drivers/pci/search.c | 31 ++++++++++++++++++++++++
include/linux/pci.h | 5 ++++
sound/pci/hda/hda_intel.c | 16 ++++--------
7 files changed, 59 insertions(+), 55 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Nouveau] [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci
From: Sui Jingfeng <suijingfeng@loongson.cn>
There is no function that can be used to get all PCI(e) devices in a
system by matching against its the PCI base class code only, while keep
the sub-class code and the programming interface ignored. Therefore, add
the pci_get_base_class() function to suit the need.
For example, if an application want to process all PCI(e) display devices
in a system, it can achieve such goal by writing the code as following:
pdev = NULL;
do {
pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
if (!pdev)
break;
do_something_for_pci_display_device(pdev);
} while (1);
Sui Jingfeng (5):
PCI: Add the pci_get_base_class() helper
ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
drm/nouveau: Use pci_get_base_class() to reduce duplicated code
drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
drm/radeon: Use pci_get_base_class() to reduce duplicated code
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
drivers/pci/search.c | 31 ++++++++++++++++++++++++
include/linux/pci.h | 5 ++++
sound/pci/hda/hda_intel.c | 16 ++++--------
7 files changed, 59 insertions(+), 55 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 1/5] PCI: Add the pci_get_base_class() helper
2023-08-25 6:27 ` Sui Jingfeng
(?)
@ 2023-08-25 6:27 ` Sui Jingfeng
-1 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci
From: Sui Jingfeng <suijingfeng@loongson.cn>
There is no function that can be used to get all PCI(e) devices in a
system by matching against its the PCI base class code only, while keep
the sub-class code and the programming interface ignored. Therefore, add
the pci_get_base_class() function to suit the need.
For example, if an application want to process all PCI(e) display devices
in a system, it can achieve such goal by writing the code as following:
pdev = NULL;
do {
pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
if (!pdev)
break;
do_something_for_pci_display_device(pdev);
} while (1);
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/pci/search.c | 31 +++++++++++++++++++++++++++++++
include/linux/pci.h | 5 +++++
2 files changed, 36 insertions(+)
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index b4c138a6ec02..53840634fbfc 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -363,6 +363,37 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from)
}
EXPORT_SYMBOL(pci_get_class);
+/**
+ * pci_get_base_class - searching for a PCI device by matching against the base class code only
+ * @class: search for a PCI device with this base class code
+ * @from: Previous PCI device found in search, or %NULL for new search.
+ *
+ * Iterates through the list of known PCI devices. If a PCI device is found
+ * with a matching base class code, the reference count to the device is
+ * incremented. See pci_match_one_device() to figure out how does this works.
+ * A new search is initiated by passing %NULL as the @from argument.
+ * Otherwise if @from is not %NULL, searches continue from next device on the
+ * global list. The reference count for @from is always decremented if it is
+ * not %NULL.
+ *
+ * Returns:
+ * A pointer to a matched PCI device, %NULL Otherwise.
+ */
+struct pci_dev *pci_get_base_class(unsigned int class, struct pci_dev *from)
+{
+ struct pci_device_id id = {
+ .vendor = PCI_ANY_ID,
+ .device = PCI_ANY_ID,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
+ .class_mask = 0xFF0000,
+ .class = class << 16,
+ };
+
+ return pci_get_dev_by_id(&id, from);
+}
+EXPORT_SYMBOL(pci_get_base_class);
+
/**
* pci_dev_present - Returns 1 if device matching the device list is present, 0 if not.
* @ids: A pointer to a null terminated list of struct pci_device_id structures
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 71c85380676c..486ad959e1f9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1180,6 +1180,8 @@ struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
unsigned int devfn);
struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
+struct pci_dev *pci_get_base_class(unsigned int class, struct pci_dev *from);
+
int pci_dev_present(const struct pci_device_id *ids);
int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
@@ -1896,6 +1898,9 @@ static inline struct pci_dev *pci_get_class(unsigned int class,
struct pci_dev *from)
{ return NULL; }
+static inline struct pci_dev *pci_get_base_class(unsigned int class,
+ struct pci_dev *from)
+{ return NULL; }
static inline int pci_dev_present(const struct pci_device_id *ids)
{ return 0; }
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 1/5] PCI: Add the pci_get_base_class() helper
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: amd-gfx, dri-devel, linux-kernel, nouveau, linux-pci, alsa-devel,
Sui Jingfeng
From: Sui Jingfeng <suijingfeng@loongson.cn>
There is no function that can be used to get all PCI(e) devices in a
system by matching against its the PCI base class code only, while keep
the sub-class code and the programming interface ignored. Therefore, add
the pci_get_base_class() function to suit the need.
For example, if an application want to process all PCI(e) display devices
in a system, it can achieve such goal by writing the code as following:
pdev = NULL;
do {
pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
if (!pdev)
break;
do_something_for_pci_display_device(pdev);
} while (1);
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/pci/search.c | 31 +++++++++++++++++++++++++++++++
include/linux/pci.h | 5 +++++
2 files changed, 36 insertions(+)
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index b4c138a6ec02..53840634fbfc 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -363,6 +363,37 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from)
}
EXPORT_SYMBOL(pci_get_class);
+/**
+ * pci_get_base_class - searching for a PCI device by matching against the base class code only
+ * @class: search for a PCI device with this base class code
+ * @from: Previous PCI device found in search, or %NULL for new search.
+ *
+ * Iterates through the list of known PCI devices. If a PCI device is found
+ * with a matching base class code, the reference count to the device is
+ * incremented. See pci_match_one_device() to figure out how does this works.
+ * A new search is initiated by passing %NULL as the @from argument.
+ * Otherwise if @from is not %NULL, searches continue from next device on the
+ * global list. The reference count for @from is always decremented if it is
+ * not %NULL.
+ *
+ * Returns:
+ * A pointer to a matched PCI device, %NULL Otherwise.
+ */
+struct pci_dev *pci_get_base_class(unsigned int class, struct pci_dev *from)
+{
+ struct pci_device_id id = {
+ .vendor = PCI_ANY_ID,
+ .device = PCI_ANY_ID,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
+ .class_mask = 0xFF0000,
+ .class = class << 16,
+ };
+
+ return pci_get_dev_by_id(&id, from);
+}
+EXPORT_SYMBOL(pci_get_base_class);
+
/**
* pci_dev_present - Returns 1 if device matching the device list is present, 0 if not.
* @ids: A pointer to a null terminated list of struct pci_device_id structures
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 71c85380676c..486ad959e1f9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1180,6 +1180,8 @@ struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
unsigned int devfn);
struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
+struct pci_dev *pci_get_base_class(unsigned int class, struct pci_dev *from);
+
int pci_dev_present(const struct pci_device_id *ids);
int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
@@ -1896,6 +1898,9 @@ static inline struct pci_dev *pci_get_class(unsigned int class,
struct pci_dev *from)
{ return NULL; }
+static inline struct pci_dev *pci_get_base_class(unsigned int class,
+ struct pci_dev *from)
+{ return NULL; }
static inline int pci_dev_present(const struct pci_device_id *ids)
{ return 0; }
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [Nouveau] [PATCH 1/5] PCI: Add the pci_get_base_class() helper
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci
From: Sui Jingfeng <suijingfeng@loongson.cn>
There is no function that can be used to get all PCI(e) devices in a
system by matching against its the PCI base class code only, while keep
the sub-class code and the programming interface ignored. Therefore, add
the pci_get_base_class() function to suit the need.
For example, if an application want to process all PCI(e) display devices
in a system, it can achieve such goal by writing the code as following:
pdev = NULL;
do {
pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
if (!pdev)
break;
do_something_for_pci_display_device(pdev);
} while (1);
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/pci/search.c | 31 +++++++++++++++++++++++++++++++
include/linux/pci.h | 5 +++++
2 files changed, 36 insertions(+)
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index b4c138a6ec02..53840634fbfc 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -363,6 +363,37 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from)
}
EXPORT_SYMBOL(pci_get_class);
+/**
+ * pci_get_base_class - searching for a PCI device by matching against the base class code only
+ * @class: search for a PCI device with this base class code
+ * @from: Previous PCI device found in search, or %NULL for new search.
+ *
+ * Iterates through the list of known PCI devices. If a PCI device is found
+ * with a matching base class code, the reference count to the device is
+ * incremented. See pci_match_one_device() to figure out how does this works.
+ * A new search is initiated by passing %NULL as the @from argument.
+ * Otherwise if @from is not %NULL, searches continue from next device on the
+ * global list. The reference count for @from is always decremented if it is
+ * not %NULL.
+ *
+ * Returns:
+ * A pointer to a matched PCI device, %NULL Otherwise.
+ */
+struct pci_dev *pci_get_base_class(unsigned int class, struct pci_dev *from)
+{
+ struct pci_device_id id = {
+ .vendor = PCI_ANY_ID,
+ .device = PCI_ANY_ID,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
+ .class_mask = 0xFF0000,
+ .class = class << 16,
+ };
+
+ return pci_get_dev_by_id(&id, from);
+}
+EXPORT_SYMBOL(pci_get_base_class);
+
/**
* pci_dev_present - Returns 1 if device matching the device list is present, 0 if not.
* @ids: A pointer to a null terminated list of struct pci_device_id structures
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 71c85380676c..486ad959e1f9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1180,6 +1180,8 @@ struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
unsigned int devfn);
struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
+struct pci_dev *pci_get_base_class(unsigned int class, struct pci_dev *from);
+
int pci_dev_present(const struct pci_device_id *ids);
int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
@@ -1896,6 +1898,9 @@ static inline struct pci_dev *pci_get_class(unsigned int class,
struct pci_dev *from)
{ return NULL; }
+static inline struct pci_dev *pci_get_base_class(unsigned int class,
+ struct pci_dev *from)
+{ return NULL; }
static inline int pci_dev_present(const struct pci_device_id *ids)
{ return 0; }
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 2/5] ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
2023-08-25 6:27 ` Sui Jingfeng
(?)
@ 2023-08-25 6:27 ` Sui Jingfeng
-1 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Pierre-Louis Bossart, alsa-devel, Sui Jingfeng, Kai Vehmanen,
nouveau, Takashi Iwai, linux-kernel, dri-devel, Jaroslav Kysela,
Fred Oh, amd-gfx, linux-pci
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);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 2/5] ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: amd-gfx, dri-devel, linux-kernel, nouveau, linux-pci, alsa-devel,
Sui Jingfeng, Jaroslav Kysela, Takashi Iwai, Fred Oh,
Pierre-Louis Bossart, Kai Vehmanen
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);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [Nouveau] [PATCH 2/5] ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Pierre-Louis Bossart, alsa-devel, Sui Jingfeng, Kai Vehmanen,
nouveau, Takashi Iwai, linux-kernel, dri-devel, Jaroslav Kysela,
Fred Oh, amd-gfx, linux-pci
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);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 3/5] drm/nouveau: Use pci_get_base_class() to reduce duplicated code
2023-08-25 6:27 ` Sui Jingfeng
(?)
(?)
@ 2023-08-25 6:27 ` Sui Jingfeng
-1 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, Karol Herbst, nouveau, linux-kernel,
dri-devel, amd-gfx, linux-pci, Ben Skeggs
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index a2ae8c21e4dc..8f0c69aad248 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -284,14 +284,11 @@ static bool nouveau_dsm_detect(void)
printk("MXM: GUID detected in BIOS\n");
/* now do DSM detection */
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
- vga_count++;
-
- nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,
- &has_optimus_flags, &has_power_resources);
- }
+ while ((pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev))) {
+ if ((pdev->class != PCI_CLASS_DISPLAY_VGA << 8) &&
+ (pdev->class != PCI_CLASS_DISPLAY_3D << 8))
+ continue;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_3D << 8, pdev)) != NULL) {
vga_count++;
nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 3/5] drm/nouveau: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: amd-gfx, dri-devel, linux-kernel, nouveau, linux-pci, alsa-devel,
Sui Jingfeng, Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
Daniel Vetter
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index a2ae8c21e4dc..8f0c69aad248 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -284,14 +284,11 @@ static bool nouveau_dsm_detect(void)
printk("MXM: GUID detected in BIOS\n");
/* now do DSM detection */
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
- vga_count++;
-
- nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,
- &has_optimus_flags, &has_power_resources);
- }
+ while ((pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev))) {
+ if ((pdev->class != PCI_CLASS_DISPLAY_VGA << 8) &&
+ (pdev->class != PCI_CLASS_DISPLAY_3D << 8))
+ continue;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_3D << 8, pdev)) != NULL) {
vga_count++;
nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [Nouveau] [PATCH 3/5] drm/nouveau: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, Daniel Vetter, linux-pci, Ben Skeggs
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index a2ae8c21e4dc..8f0c69aad248 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -284,14 +284,11 @@ static bool nouveau_dsm_detect(void)
printk("MXM: GUID detected in BIOS\n");
/* now do DSM detection */
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
- vga_count++;
-
- nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,
- &has_optimus_flags, &has_power_resources);
- }
+ while ((pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev))) {
+ if ((pdev->class != PCI_CLASS_DISPLAY_VGA << 8) &&
+ (pdev->class != PCI_CLASS_DISPLAY_3D << 8))
+ continue;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_3D << 8, pdev)) != NULL) {
vga_count++;
nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 3/5] drm/nouveau: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, Karol Herbst, nouveau, linux-kernel,
dri-devel, amd-gfx, Daniel Vetter, linux-pci, David Airlie,
Ben Skeggs
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index a2ae8c21e4dc..8f0c69aad248 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -284,14 +284,11 @@ static bool nouveau_dsm_detect(void)
printk("MXM: GUID detected in BIOS\n");
/* now do DSM detection */
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
- vga_count++;
-
- nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,
- &has_optimus_flags, &has_power_resources);
- }
+ while ((pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev))) {
+ if ((pdev->class != PCI_CLASS_DISPLAY_VGA << 8) &&
+ (pdev->class != PCI_CLASS_DISPLAY_3D << 8))
+ continue;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_3D << 8, pdev)) != NULL) {
vga_count++;
nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 4/5] drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
2023-08-25 6:27 ` Sui Jingfeng
(?)
@ 2023-08-25 6:27 ` Sui Jingfeng
-1 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci, Alex Deucher
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 ++++-------
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 +++++---------------
2 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index a5a2b06c6588..4f18af877105 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -1389,14 +1389,11 @@ void amdgpu_acpi_detect(void)
struct pci_dev *pdev = NULL;
int ret;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
- if (!atif->handle)
- amdgpu_atif_pci_probe_handle(pdev);
- if (!atcs->handle)
- amdgpu_atcs_pci_probe_handle(pdev);
- }
+ 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;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
if (!atif->handle)
amdgpu_atif_pci_probe_handle(pdev);
if (!atcs->handle)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 38ccec913f00..5bbb23e102ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -287,7 +287,11 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
if (adev->flags & AMD_IS_APU)
return false;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 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)
continue;
@@ -299,20 +303,6 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
}
}
- if (!found) {
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
- dhandle = ACPI_HANDLE(&pdev->dev);
- if (!dhandle)
- continue;
-
- status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
- if (ACPI_SUCCESS(status)) {
- found = true;
- break;
- }
- }
- }
-
if (!found)
return false;
pci_dev_put(pdev);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 4/5] drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: amd-gfx, dri-devel, linux-kernel, nouveau, linux-pci, alsa-devel,
Sui Jingfeng, Alex Deucher
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 ++++-------
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 +++++---------------
2 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index a5a2b06c6588..4f18af877105 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -1389,14 +1389,11 @@ void amdgpu_acpi_detect(void)
struct pci_dev *pdev = NULL;
int ret;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
- if (!atif->handle)
- amdgpu_atif_pci_probe_handle(pdev);
- if (!atcs->handle)
- amdgpu_atcs_pci_probe_handle(pdev);
- }
+ 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;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
if (!atif->handle)
amdgpu_atif_pci_probe_handle(pdev);
if (!atcs->handle)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 38ccec913f00..5bbb23e102ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -287,7 +287,11 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
if (adev->flags & AMD_IS_APU)
return false;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 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)
continue;
@@ -299,20 +303,6 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
}
}
- if (!found) {
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
- dhandle = ACPI_HANDLE(&pdev->dev);
- if (!dhandle)
- continue;
-
- status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
- if (ACPI_SUCCESS(status)) {
- found = true;
- break;
- }
- }
- }
-
if (!found)
return false;
pci_dev_put(pdev);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [Nouveau] [PATCH 4/5] drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci, Alex Deucher
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 ++++-------
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 +++++---------------
2 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index a5a2b06c6588..4f18af877105 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -1389,14 +1389,11 @@ void amdgpu_acpi_detect(void)
struct pci_dev *pdev = NULL;
int ret;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
- if (!atif->handle)
- amdgpu_atif_pci_probe_handle(pdev);
- if (!atcs->handle)
- amdgpu_atcs_pci_probe_handle(pdev);
- }
+ 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;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
if (!atif->handle)
amdgpu_atif_pci_probe_handle(pdev);
if (!atcs->handle)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 38ccec913f00..5bbb23e102ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -287,7 +287,11 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
if (adev->flags & AMD_IS_APU)
return false;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 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)
continue;
@@ -299,20 +303,6 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
}
}
- if (!found) {
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
- dhandle = ACPI_HANDLE(&pdev->dev);
- if (!dhandle)
- continue;
-
- status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
- if (ACPI_SUCCESS(status)) {
- found = true;
- break;
- }
- }
- }
-
if (!found)
return false;
pci_dev_put(pdev);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 5/5] drm/radeon: Use pci_get_base_class() to reduce duplicated code
2023-08-25 6:27 ` Sui Jingfeng
(?)
@ 2023-08-25 6:27 ` Sui Jingfeng
-1 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci, Alex Deucher
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/radeon/radeon_bios.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 63bdc9f6fc24..3a8c5199a0fe 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -199,7 +199,11 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
if (rdev->flags & RADEON_IS_IGP)
return false;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 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)
continue;
@@ -211,20 +215,6 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
}
}
- if (!found) {
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
- dhandle = ACPI_HANDLE(&pdev->dev);
- if (!dhandle)
- continue;
-
- status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
- if (ACPI_SUCCESS(status)) {
- found = true;
- break;
- }
- }
- }
-
if (!found)
return false;
pci_dev_put(pdev);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 5/5] drm/radeon: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: amd-gfx, dri-devel, linux-kernel, nouveau, linux-pci, alsa-devel,
Sui Jingfeng, Alex Deucher
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/radeon/radeon_bios.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 63bdc9f6fc24..3a8c5199a0fe 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -199,7 +199,11 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
if (rdev->flags & RADEON_IS_IGP)
return false;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 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)
continue;
@@ -211,20 +215,6 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
}
}
- if (!found) {
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
- dhandle = ACPI_HANDLE(&pdev->dev);
- if (!dhandle)
- continue;
-
- status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
- if (ACPI_SUCCESS(status)) {
- found = true;
- break;
- }
- }
- }
-
if (!found)
return false;
pci_dev_put(pdev);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [Nouveau] [PATCH 5/5] drm/radeon: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 6:27 ` Sui Jingfeng
0 siblings, 0 replies; 31+ messages in thread
From: Sui Jingfeng @ 2023-08-25 6:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci, Alex Deucher
From: Sui Jingfeng <suijingfeng@loongson.cn>
Should be no functional change.
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/radeon/radeon_bios.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 63bdc9f6fc24..3a8c5199a0fe 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -199,7 +199,11 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
if (rdev->flags & RADEON_IS_IGP)
return false;
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 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)
continue;
@@ -211,20 +215,6 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
}
}
- if (!found) {
- while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
- dhandle = ACPI_HANDLE(&pdev->dev);
- if (!dhandle)
- continue;
-
- status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
- if (ACPI_SUCCESS(status)) {
- found = true;
- break;
- }
- }
- }
-
if (!found)
return false;
pci_dev_put(pdev);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 2/5] ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
2023-08-25 6:27 ` Sui Jingfeng
(?)
@ 2023-08-25 7:48 ` Takashi Iwai
-1 siblings, 0 replies; 31+ messages in thread
From: Takashi Iwai @ 2023-08-25 7:48 UTC (permalink / raw)
To: Sui Jingfeng
Cc: Bjorn Helgaas, amd-gfx, dri-devel, linux-kernel, nouveau,
linux-pci, alsa-devel, Sui Jingfeng, Jaroslav Kysela,
Takashi Iwai, Fred Oh, Pierre-Louis Bossart, Kai Vehmanen
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [Nouveau] [PATCH 2/5] ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 7:48 ` Takashi Iwai
0 siblings, 0 replies; 31+ messages in thread
From: Takashi Iwai @ 2023-08-25 7:48 UTC (permalink / raw)
To: Sui Jingfeng
Cc: Pierre-Louis Bossart, alsa-devel, Sui Jingfeng, Kai Vehmanen,
nouveau, Takashi Iwai, linux-kernel, dri-devel, Jaroslav Kysela,
Fred Oh, amd-gfx, linux-pci, Bjorn Helgaas
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 2/5] ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
@ 2023-08-25 7:48 ` Takashi Iwai
0 siblings, 0 replies; 31+ messages in thread
From: Takashi Iwai @ 2023-08-25 7:48 UTC (permalink / raw)
To: Sui Jingfeng
Cc: Pierre-Louis Bossart, alsa-devel, Sui Jingfeng, Kai Vehmanen,
nouveau, Takashi Iwai, linux-kernel, dri-devel, Jaroslav Kysela,
Fred Oh, amd-gfx, linux-pci, Bjorn Helgaas
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH 0/5] Add the pci_get_base_class() helper and use it
2023-08-25 6:27 ` Sui Jingfeng
(?)
@ 2023-08-25 13:18 ` Deucher, Alexander
-1 siblings, 0 replies; 31+ messages in thread
From: Deucher, Alexander @ 2023-08-25 13:18 UTC (permalink / raw)
To: Sui Jingfeng, Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci
[Public]
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Sui
> Jingfeng
> Sent: Friday, August 25, 2023 2:27 AM
> To: Bjorn Helgaas <bhelgaas@google.com>
> Cc: alsa-devel@alsa-project.org; Sui Jingfeng <suijingfeng@loongson.cn>;
> nouveau@lists.freedesktop.org; linux-kernel@vger.kernel.org; dri-
> devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux-
> pci@vger.kernel.org
> Subject: [PATCH 0/5] Add the pci_get_base_class() helper and use it
>
> From: Sui Jingfeng <suijingfeng@loongson.cn>
>
> There is no function that can be used to get all PCI(e) devices in a system by
> matching against its the PCI base class code only, while keep the sub-class code
> and the programming interface ignored. Therefore, add the
> pci_get_base_class() function to suit the need.
>
> For example, if an application want to process all PCI(e) display devices in a
> system, it can achieve such goal by writing the code as following:
>
> pdev = NULL;
> do {
> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
> if (!pdev)
> break;
>
> do_something_for_pci_display_device(pdev);
> } while (1);
>
> Sui Jingfeng (5):
> PCI: Add the pci_get_base_class() helper
> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>
Series is:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
> drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
> drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
> drivers/pci/search.c | 31 ++++++++++++++++++++++++
> include/linux/pci.h | 5 ++++
> sound/pci/hda/hda_intel.c | 16 ++++--------
> 7 files changed, 59 insertions(+), 55 deletions(-)
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [Nouveau] [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-08-25 13:18 ` Deucher, Alexander
0 siblings, 0 replies; 31+ messages in thread
From: Deucher, Alexander @ 2023-08-25 13:18 UTC (permalink / raw)
To: Sui Jingfeng, Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, amd-gfx,
dri-devel, linux-pci
[Public]
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Sui
> Jingfeng
> Sent: Friday, August 25, 2023 2:27 AM
> To: Bjorn Helgaas <bhelgaas@google.com>
> Cc: alsa-devel@alsa-project.org; Sui Jingfeng <suijingfeng@loongson.cn>;
> nouveau@lists.freedesktop.org; linux-kernel@vger.kernel.org; dri-
> devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux-
> pci@vger.kernel.org
> Subject: [PATCH 0/5] Add the pci_get_base_class() helper and use it
>
> From: Sui Jingfeng <suijingfeng@loongson.cn>
>
> There is no function that can be used to get all PCI(e) devices in a system by
> matching against its the PCI base class code only, while keep the sub-class code
> and the programming interface ignored. Therefore, add the
> pci_get_base_class() function to suit the need.
>
> For example, if an application want to process all PCI(e) display devices in a
> system, it can achieve such goal by writing the code as following:
>
> pdev = NULL;
> do {
> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
> if (!pdev)
> break;
>
> do_something_for_pci_display_device(pdev);
> } while (1);
>
> Sui Jingfeng (5):
> PCI: Add the pci_get_base_class() helper
> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>
Series is:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
> drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
> drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
> drivers/pci/search.c | 31 ++++++++++++++++++++++++
> include/linux/pci.h | 5 ++++
> sound/pci/hda/hda_intel.c | 16 ++++--------
> 7 files changed, 59 insertions(+), 55 deletions(-)
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-08-25 13:18 ` Deucher, Alexander
0 siblings, 0 replies; 31+ messages in thread
From: Deucher, Alexander @ 2023-08-25 13:18 UTC (permalink / raw)
To: Sui Jingfeng, Bjorn Helgaas
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, amd-gfx,
dri-devel, linux-pci
[Public]
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Sui
> Jingfeng
> Sent: Friday, August 25, 2023 2:27 AM
> To: Bjorn Helgaas <bhelgaas@google.com>
> Cc: alsa-devel@alsa-project.org; Sui Jingfeng <suijingfeng@loongson.cn>;
> nouveau@lists.freedesktop.org; linux-kernel@vger.kernel.org; dri-
> devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux-
> pci@vger.kernel.org
> Subject: [PATCH 0/5] Add the pci_get_base_class() helper and use it
>
> From: Sui Jingfeng <suijingfeng@loongson.cn>
>
> There is no function that can be used to get all PCI(e) devices in a system by
> matching against its the PCI base class code only, while keep the sub-class code
> and the programming interface ignored. Therefore, add the
> pci_get_base_class() function to suit the need.
>
> For example, if an application want to process all PCI(e) display devices in a
> system, it can achieve such goal by writing the code as following:
>
> pdev = NULL;
> do {
> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
> if (!pdev)
> break;
>
> do_something_for_pci_display_device(pdev);
> } while (1);
>
> Sui Jingfeng (5):
> PCI: Add the pci_get_base_class() helper
> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>
Series is:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
> drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
> drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
> drivers/pci/search.c | 31 ++++++++++++++++++++++++
> include/linux/pci.h | 5 ++++
> sound/pci/hda/hda_intel.c | 16 ++++--------
> 7 files changed, 59 insertions(+), 55 deletions(-)
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 0/5] Add the pci_get_base_class() helper and use it
2023-08-25 13:18 ` [Nouveau] " Deucher, Alexander
(?)
@ 2023-09-20 2:46 ` suijingfeng
-1 siblings, 0 replies; 31+ messages in thread
From: suijingfeng @ 2023-09-20 2:46 UTC (permalink / raw)
To: Deucher, Alexander, Sui Jingfeng, Bjorn Helgaas
Cc: alsa-devel, nouveau, linux-kernel, dri-devel, amd-gfx, linux-pci
Hi,
On 2023/8/25 21:18, Deucher, Alexander wrote:
> [Public]
>
>> -----Original Message-----
>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Sui
>> Jingfeng
>> Sent: Friday, August 25, 2023 2:27 AM
>> To: Bjorn Helgaas <bhelgaas@google.com>
>> Cc: alsa-devel@alsa-project.org; Sui Jingfeng <suijingfeng@loongson.cn>;
>> nouveau@lists.freedesktop.org; linux-kernel@vger.kernel.org; dri-
>> devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux-
>> pci@vger.kernel.org
>> Subject: [PATCH 0/5] Add the pci_get_base_class() helper and use it
>>
>> From: Sui Jingfeng <suijingfeng@loongson.cn>
>>
>> There is no function that can be used to get all PCI(e) devices in a system by
>> matching against its the PCI base class code only, while keep the sub-class code
>> and the programming interface ignored. Therefore, add the
>> pci_get_base_class() function to suit the need.
>>
>> For example, if an application want to process all PCI(e) display devices in a
>> system, it can achieve such goal by writing the code as following:
>>
>> pdev = NULL;
>> do {
>> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
>> if (!pdev)
>> break;
>>
>> do_something_for_pci_display_device(pdev);
>> } while (1);
>>
>> Sui Jingfeng (5):
>> PCI: Add the pci_get_base_class() helper
>> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
>> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
>> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
>> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>>
> Series is:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Thanks a lot.
What to do next then?
By the way, Bjorn, what's your opinion?
I'm ask because I don't know what to do next with this series.
As they belong to different system of Linux kernel,
the rest of patch (0002 ~ 0005) depend on the first one.
I think, merge the 0001-patch firstly, then wait it arrive at drm-misc, alsa branch.
Or, to do something else?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [Nouveau] [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-09-20 2:46 ` suijingfeng
0 siblings, 0 replies; 31+ messages in thread
From: suijingfeng @ 2023-09-20 2:46 UTC (permalink / raw)
To: Deucher, Alexander, Sui Jingfeng, Bjorn Helgaas
Cc: alsa-devel, nouveau, linux-kernel, amd-gfx, dri-devel, linux-pci
Hi,
On 2023/8/25 21:18, Deucher, Alexander wrote:
> [Public]
>
>> -----Original Message-----
>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Sui
>> Jingfeng
>> Sent: Friday, August 25, 2023 2:27 AM
>> To: Bjorn Helgaas <bhelgaas@google.com>
>> Cc: alsa-devel@alsa-project.org; Sui Jingfeng <suijingfeng@loongson.cn>;
>> nouveau@lists.freedesktop.org; linux-kernel@vger.kernel.org; dri-
>> devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux-
>> pci@vger.kernel.org
>> Subject: [PATCH 0/5] Add the pci_get_base_class() helper and use it
>>
>> From: Sui Jingfeng <suijingfeng@loongson.cn>
>>
>> There is no function that can be used to get all PCI(e) devices in a system by
>> matching against its the PCI base class code only, while keep the sub-class code
>> and the programming interface ignored. Therefore, add the
>> pci_get_base_class() function to suit the need.
>>
>> For example, if an application want to process all PCI(e) display devices in a
>> system, it can achieve such goal by writing the code as following:
>>
>> pdev = NULL;
>> do {
>> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
>> if (!pdev)
>> break;
>>
>> do_something_for_pci_display_device(pdev);
>> } while (1);
>>
>> Sui Jingfeng (5):
>> PCI: Add the pci_get_base_class() helper
>> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
>> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
>> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
>> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>>
> Series is:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Thanks a lot.
What to do next then?
By the way, Bjorn, what's your opinion?
I'm ask because I don't know what to do next with this series.
As they belong to different system of Linux kernel,
the rest of patch (0002 ~ 0005) depend on the first one.
I think, merge the 0001-patch firstly, then wait it arrive at drm-misc, alsa branch.
Or, to do something else?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-09-20 2:46 ` suijingfeng
0 siblings, 0 replies; 31+ messages in thread
From: suijingfeng @ 2023-09-20 2:46 UTC (permalink / raw)
To: Deucher, Alexander, Sui Jingfeng, Bjorn Helgaas
Cc: alsa-devel, nouveau, linux-kernel, amd-gfx, dri-devel, linux-pci
Hi,
On 2023/8/25 21:18, Deucher, Alexander wrote:
> [Public]
>
>> -----Original Message-----
>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Sui
>> Jingfeng
>> Sent: Friday, August 25, 2023 2:27 AM
>> To: Bjorn Helgaas <bhelgaas@google.com>
>> Cc: alsa-devel@alsa-project.org; Sui Jingfeng <suijingfeng@loongson.cn>;
>> nouveau@lists.freedesktop.org; linux-kernel@vger.kernel.org; dri-
>> devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; linux-
>> pci@vger.kernel.org
>> Subject: [PATCH 0/5] Add the pci_get_base_class() helper and use it
>>
>> From: Sui Jingfeng <suijingfeng@loongson.cn>
>>
>> There is no function that can be used to get all PCI(e) devices in a system by
>> matching against its the PCI base class code only, while keep the sub-class code
>> and the programming interface ignored. Therefore, add the
>> pci_get_base_class() function to suit the need.
>>
>> For example, if an application want to process all PCI(e) display devices in a
>> system, it can achieve such goal by writing the code as following:
>>
>> pdev = NULL;
>> do {
>> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
>> if (!pdev)
>> break;
>>
>> do_something_for_pci_display_device(pdev);
>> } while (1);
>>
>> Sui Jingfeng (5):
>> PCI: Add the pci_get_base_class() helper
>> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
>> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
>> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
>> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>>
> Series is:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Thanks a lot.
What to do next then?
By the way, Bjorn, what's your opinion?
I'm ask because I don't know what to do next with this series.
As they belong to different system of Linux kernel,
the rest of patch (0002 ~ 0005) depend on the first one.
I think, merge the 0001-patch firstly, then wait it arrive at drm-misc, alsa branch.
Or, to do something else?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 0/5] Add the pci_get_base_class() helper and use it
2023-08-25 6:27 ` Sui Jingfeng
(?)
@ 2023-09-28 21:56 ` Bjorn Helgaas
-1 siblings, 0 replies; 31+ messages in thread
From: Bjorn Helgaas @ 2023-09-28 21:56 UTC (permalink / raw)
To: Sui Jingfeng
Cc: Bjorn Helgaas, amd-gfx, dri-devel, linux-kernel, nouveau,
linux-pci, alsa-devel, Sui Jingfeng
On Fri, Aug 25, 2023 at 02:27:09PM +0800, Sui Jingfeng wrote:
> From: Sui Jingfeng <suijingfeng@loongson.cn>
>
> There is no function that can be used to get all PCI(e) devices in a
> system by matching against its the PCI base class code only, while keep
> the sub-class code and the programming interface ignored. Therefore, add
> the pci_get_base_class() function to suit the need.
>
> For example, if an application want to process all PCI(e) display devices
> in a system, it can achieve such goal by writing the code as following:
>
> pdev = NULL;
> do {
> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
> if (!pdev)
> break;
>
> do_something_for_pci_display_device(pdev);
> } while (1);
>
> Sui Jingfeng (5):
> PCI: Add the pci_get_base_class() helper
> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
> drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
> drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
> drivers/pci/search.c | 31 ++++++++++++++++++++++++
> include/linux/pci.h | 5 ++++
> sound/pci/hda/hda_intel.c | 16 ++++--------
> 7 files changed, 59 insertions(+), 55 deletions(-)
Applied to pci/enumeration for v6.7, thanks.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-09-28 21:56 ` Bjorn Helgaas
0 siblings, 0 replies; 31+ messages in thread
From: Bjorn Helgaas @ 2023-09-28 21:56 UTC (permalink / raw)
To: Sui Jingfeng
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci, Bjorn Helgaas
On Fri, Aug 25, 2023 at 02:27:09PM +0800, Sui Jingfeng wrote:
> From: Sui Jingfeng <suijingfeng@loongson.cn>
>
> There is no function that can be used to get all PCI(e) devices in a
> system by matching against its the PCI base class code only, while keep
> the sub-class code and the programming interface ignored. Therefore, add
> the pci_get_base_class() function to suit the need.
>
> For example, if an application want to process all PCI(e) display devices
> in a system, it can achieve such goal by writing the code as following:
>
> pdev = NULL;
> do {
> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
> if (!pdev)
> break;
>
> do_something_for_pci_display_device(pdev);
> } while (1);
>
> Sui Jingfeng (5):
> PCI: Add the pci_get_base_class() helper
> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
> drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
> drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
> drivers/pci/search.c | 31 ++++++++++++++++++++++++
> include/linux/pci.h | 5 ++++
> sound/pci/hda/hda_intel.c | 16 ++++--------
> 7 files changed, 59 insertions(+), 55 deletions(-)
Applied to pci/enumeration for v6.7, thanks.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [Nouveau] [PATCH 0/5] Add the pci_get_base_class() helper and use it
@ 2023-09-28 21:56 ` Bjorn Helgaas
0 siblings, 0 replies; 31+ messages in thread
From: Bjorn Helgaas @ 2023-09-28 21:56 UTC (permalink / raw)
To: Sui Jingfeng
Cc: alsa-devel, Sui Jingfeng, nouveau, linux-kernel, dri-devel,
amd-gfx, linux-pci, Bjorn Helgaas
On Fri, Aug 25, 2023 at 02:27:09PM +0800, Sui Jingfeng wrote:
> From: Sui Jingfeng <suijingfeng@loongson.cn>
>
> There is no function that can be used to get all PCI(e) devices in a
> system by matching against its the PCI base class code only, while keep
> the sub-class code and the programming interface ignored. Therefore, add
> the pci_get_base_class() function to suit the need.
>
> For example, if an application want to process all PCI(e) display devices
> in a system, it can achieve such goal by writing the code as following:
>
> pdev = NULL;
> do {
> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
> if (!pdev)
> break;
>
> do_something_for_pci_display_device(pdev);
> } while (1);
>
> Sui Jingfeng (5):
> PCI: Add the pci_get_base_class() helper
> ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
> drm/nouveau: Use pci_get_base_class() to reduce duplicated code
> drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
> drm/radeon: Use pci_get_base_class() to reduce duplicated code
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++------
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ++++-----------
> drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++------
> drivers/gpu/drm/radeon/radeon_bios.c | 20 ++++-----------
> drivers/pci/search.c | 31 ++++++++++++++++++++++++
> include/linux/pci.h | 5 ++++
> sound/pci/hda/hda_intel.c | 16 ++++--------
> 7 files changed, 59 insertions(+), 55 deletions(-)
Applied to pci/enumeration for v6.7, thanks.
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2023-09-28 21:56 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-25 6:27 [PATCH 0/5] Add the pci_get_base_class() helper and use it Sui Jingfeng
2023-08-25 6:27 ` [Nouveau] " Sui Jingfeng
2023-08-25 6:27 ` Sui Jingfeng
2023-08-25 6:27 ` [PATCH 1/5] PCI: Add the pci_get_base_class() helper Sui Jingfeng
2023-08-25 6:27 ` [Nouveau] " Sui Jingfeng
2023-08-25 6:27 ` Sui Jingfeng
2023-08-25 6:27 ` [PATCH 2/5] ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code Sui Jingfeng
2023-08-25 6:27 ` [Nouveau] " Sui Jingfeng
2023-08-25 6:27 ` Sui Jingfeng
2023-08-25 7:48 ` Takashi Iwai
2023-08-25 7:48 ` Takashi Iwai
2023-08-25 7:48 ` [Nouveau] " Takashi Iwai
2023-08-25 6:27 ` [PATCH 3/5] drm/nouveau: " Sui Jingfeng
2023-08-25 6:27 ` Sui Jingfeng
2023-08-25 6:27 ` [Nouveau] " Sui Jingfeng
2023-08-25 6:27 ` Sui Jingfeng
2023-08-25 6:27 ` [PATCH 4/5] drm/amdgpu: " Sui Jingfeng
2023-08-25 6:27 ` [Nouveau] " Sui Jingfeng
2023-08-25 6:27 ` Sui Jingfeng
2023-08-25 6:27 ` [PATCH 5/5] drm/radeon: " Sui Jingfeng
2023-08-25 6:27 ` [Nouveau] " Sui Jingfeng
2023-08-25 6:27 ` Sui Jingfeng
2023-08-25 13:18 ` [PATCH 0/5] Add the pci_get_base_class() helper and use it Deucher, Alexander
2023-08-25 13:18 ` Deucher, Alexander
2023-08-25 13:18 ` [Nouveau] " Deucher, Alexander
2023-09-20 2:46 ` suijingfeng
2023-09-20 2:46 ` suijingfeng
2023-09-20 2:46 ` [Nouveau] " suijingfeng
2023-09-28 21:56 ` Bjorn Helgaas
2023-09-28 21:56 ` [Nouveau] " Bjorn Helgaas
2023-09-28 21:56 ` Bjorn Helgaas
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.