aboutsummaryrefslogtreecommitdiff
path: root/hardinfo/gpu_util.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2020-01-10 10:46:07 -0600
committerLeandro A. F. Pereira <leandro@hardinfo.org>2020-01-17 16:14:30 -0800
commit7114175cdb6ff611dfb164959c5aec2099f9e887 (patch)
tree3a4b654ff073049804cbb21a98703d6f4a0ffb85 /hardinfo/gpu_util.c
parent1b66b4442410ef6a7f9939845977d0fd9d840f71 (diff)
pci_util: use GSList for pcid_list
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'hardinfo/gpu_util.c')
-rw-r--r--hardinfo/gpu_util.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/hardinfo/gpu_util.c b/hardinfo/gpu_util.c
index b203b426..d7b31d4d 100644
--- a/hardinfo/gpu_util.c
+++ b/hardinfo/gpu_util.c
@@ -397,15 +397,15 @@ gpud *gpu_get_device_list() {
gpud *list = NULL;
/* Can we just ask DRM someway? ... */
+ /* TODO: yes. /sys/class/drm/card* */
/* Try PCI ... */
- pcid *pci_list = pci_get_device_list(0x300,0x3ff);
- pcid *curr = pci_list;
+ pcid_list pci_list = pci_get_device_list(0x300,0x3ff);
+ GSList *l = pci_list;
- int c = pcid_list_count(pci_list);
-
- if (c > 0) {
- while(curr) {
+ if (l) {
+ while(l) {
+ pcid *curr = (pcid*)l->data;
char *pci_loc = NULL;
gpud *new_gpu = gpud_new();
new_gpu->pci_dev = curr;
@@ -457,10 +457,11 @@ gpud *gpu_get_device_list() {
gpud_list_append(list, new_gpu);
free(pci_loc);
- curr=curr->next;
+ l=l->next;
}
/* don't pcid_list_free(pci_list); They will be freed by gpud_free() */
+ g_slist_free(pci_list); /* just the linking data */
return list;
}