summaryrefslogtreecommitdiff
path: root/lib/igt_chamelium.c
diff options
context:
space:
mode:
authorArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-11-11 10:30:54 +0200
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-11-12 17:45:47 +0200
commit602003c3d751c72fc309a0e64d4193f6da720f6b (patch)
tree5e29d9b685f8268a9ad56f52ad788f4300ddc289 /lib/igt_chamelium.c
parent5997df31db10f190fe8b70d920b6a6b8d3b24126 (diff)
lib/igt_list: Update, clean-up and document igt_list
Our list was something between Wayland and Linux Kernel list implementations, right in the uncanny valley. On top of that it falsely claimed that it's a straight copy from the Wayland project. Let's make our impl more akin to the kernel one to ease the cognitive dissonance for the developers working on all those projects. This patch: * mimics the current kernel list interface * separates IGT helpers in the source files * adds brief explanation and code example for igt-doc * introduces igt_list.c as static inlines are not visible in the docs v2: mimic the kernel instead of wayland (Chris) - _head suffix for the sentinel/link struct - _entry_ in iterator names that go over the elements v3: I forgot to merge this in time and there was another call site that had to be converted in gem_spin_batch.c Cc: Petri Latvala <petri.latvala@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/igt_chamelium.c')
-rw-r--r--lib/igt_chamelium.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 1b03a103..9971f51d 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -87,7 +87,7 @@ struct chamelium_edid {
struct edid *base;
struct edid *raw[CHAMELIUM_MAX_PORTS];
int ids[CHAMELIUM_MAX_PORTS];
- struct igt_list link;
+ struct igt_list_head link;
};
struct chamelium_port {
@@ -122,7 +122,7 @@ struct chamelium {
int drm_fd;
- struct igt_list edids;
+ struct igt_list_head edids;
struct chamelium_port ports[CHAMELIUM_MAX_PORTS];
int port_count;
};
@@ -2336,7 +2336,7 @@ struct chamelium *chamelium_init(int drm_fd)
memset(chamelium, 0, sizeof(*chamelium));
chamelium->drm_fd = drm_fd;
- igt_list_init(&chamelium->edids);
+ IGT_INIT_LIST_HEAD(&chamelium->edids);
/* Setup the libxmlrpc context */
xmlrpc_env_init(&chamelium->env);
@@ -2388,7 +2388,7 @@ void chamelium_deinit(struct chamelium *chamelium)
chamelium_plug(chamelium, &chamelium->ports[i]);
/* Destroy any EDIDs we created to make sure we don't leak them */
- igt_list_for_each_safe(pos, tmp, &chamelium->edids, link) {
+ igt_list_for_each_entry_safe(pos, tmp, &chamelium->edids, link) {
for (i = 0; i < CHAMELIUM_MAX_PORTS; i++) {
if (pos->ids[i])
chamelium_destroy_edid(chamelium, pos->ids[i]);