- Backport upstream fixes: surround41/50 chmap fix, UCM documents, config string fix, PCM timestamp query API, replacement of list.h with LGPL: 0023-surround41-50.conf-Use-chmap-syntax-for-better-flexi.patch 0024-ucm-docs-fix-doxygen-exclude-patch-for-UCM-local-hea.patch 0025-ucm-docs-Fix-doxygen-formatting-for-UCM-main-page.patch 0026-docs-Add-UCM-link-to-main-doxygen-page.patch 0027-Replace-unsafe-characters-with-_-in-card-name.patch 0028-pcm-add-helper-functions-to-query-timestamping-capab.patch 0029-pcm-add-support-for-get-set_audio_htstamp_config.patch 0030-pcm-add-support-for-new-STATUS_EXT-ioctl.patch 0031-test-fix-audio_time-with-new-get-set-audio_tstamp_co.patch 0032-test-audio_time-show-report-validity-and-accuracy.patch 0033-pcm-restore-hw-params-on-set-latency-failed.patch 0034-Replace-list.h-with-its-own-version.patch - Backport topology API addition patches: 0035-topology-uapi-Add-UAPI-headers-for-topology-ABI.patch 0036-topology-Add-topology-core-parser.patch 0037-topology-Add-text-section-parser.patch 0038-topology-Add-PCM-parser.patch 0039-topology-Add-operations-parser.patch 0040-topology-Add-private-data-parser.patch 0041-topology-Add-DAPM-object-parser.patch 0042-topology-Add-CTL-parser.patch 0043-topology-Add-Channel-map-parser.patch 0044-topology-Add-binary-file-builder.patch 0045-topology-autotools-Add-build-support-for-topology-co.patch 0046-topology-doxygen-Add-doxygen-support-for-topology-co.patch 0047-conf-topology-Add-topology-file-for-broadwell-audio-.patch 0048-topology-Fix-missing-inclusion-of-ctype.h.patch OBS-URL: https://build.opensuse.org/request/show/320429 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=186
275 lines
8.3 KiB
Diff
275 lines
8.3 KiB
Diff
From d0e13f87742e923edfb638d4b16b69b8dc2136d8 Mon Sep 17 00:00:00 2001
|
|
From: Takashi Iwai <tiwai@suse.de>
|
|
Date: Mon, 27 Jul 2015 12:32:37 +0200
|
|
Subject: [PATCH 34/49] Replace list.h with its own version
|
|
|
|
We copied include/list.h from Linux kernel, and it's of course in
|
|
GPLv2. This has raised concerns to many people, as it's not clear
|
|
whether such a code is considered to be completely trivial, thus it
|
|
might be seen as a derivative work, which takes effect in GPL, as
|
|
suggested by Clemens.
|
|
|
|
For clearing the situation, this patch replaces the existing list.h
|
|
implementation from a new version. The API is kept to be compatible,
|
|
but the codes were written from full scratch under LGPL, to be aligned
|
|
with other alsa-lib codes.
|
|
|
|
Reported-by: Clemens Lang <clemens.lang@bmw-carit.de>
|
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
---
|
|
include/list.h | 212 +++++++++++++++++++--------------------------------------
|
|
1 file changed, 70 insertions(+), 142 deletions(-)
|
|
|
|
diff --git a/include/list.h b/include/list.h
|
|
index 4d9895feba05..947c1f8411e2 100644
|
|
--- a/include/list.h
|
|
+++ b/include/list.h
|
|
@@ -1,174 +1,102 @@
|
|
+/* Doubly linked list macros compatible with Linux kernel's version
|
|
+ * Copyright (c) 2015 by Takashi Iwai <tiwai@suse.de>
|
|
+ *
|
|
+ * This library is free software; you can redistribute it and/or modify
|
|
+ * it under the terms of the GNU Lesser General Public License as
|
|
+ * published by the Free Software Foundation; either version 2.1 of
|
|
+ * the License, or (at your option) any later version.
|
|
+ *
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
+ * GNU Lesser General Public License for more details.
|
|
+ */
|
|
+
|
|
#ifndef _LIST_H
|
|
#define _LIST_H
|
|
|
|
-/*
|
|
- * This code was taken from the Linux 2.4.0 kernel. [jaroslav]
|
|
- */
|
|
+#include <stddef.h>
|
|
|
|
-/*
|
|
- * Simple doubly linked list implementation.
|
|
- *
|
|
- * Some of the internal functions ("__xxx") are useful when
|
|
- * manipulating whole lists rather than single entries, as
|
|
- * sometimes we already know the next/prev entries and we can
|
|
- * generate better code by using them directly rather than
|
|
- * using the generic single-entry routines.
|
|
- */
|
|
-
|
|
-#ifndef LIST_HEAD_IS_DEFINED
|
|
struct list_head {
|
|
- struct list_head *next, *prev;
|
|
+ struct list_head *next;
|
|
+ struct list_head *prev;
|
|
};
|
|
-#endif
|
|
-
|
|
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
|
|
|
-#define LIST_HEAD(name) \
|
|
- struct list_head name = LIST_HEAD_INIT(name)
|
|
+/* one-shot definition of a list head */
|
|
+#define LIST_HEAD(x) \
|
|
+ struct list_head x = { &x, &x }
|
|
|
|
-#define INIT_LIST_HEAD(ptr) do { \
|
|
- (ptr)->next = (ptr); (ptr)->prev = (ptr); \
|
|
-} while (0)
|
|
-
|
|
-/*
|
|
- * Insert a new entry between two known consecutive entries.
|
|
- *
|
|
- * This is only for internal list manipulation where we know
|
|
- * the prev/next entries already!
|
|
- */
|
|
-static __inline__ void __list_add(struct list_head * _new,
|
|
- struct list_head * prev,
|
|
- struct list_head * next)
|
|
+/* initialize a list head explicitly */
|
|
+static inline void INIT_LIST_HEAD(struct list_head *p)
|
|
{
|
|
- next->prev = _new;
|
|
- _new->next = next;
|
|
- _new->prev = prev;
|
|
- prev->next = _new;
|
|
+ p->next = p->prev = p;
|
|
}
|
|
|
|
-/**
|
|
- * list_add - add a new entry
|
|
- * @new: new entry to be added
|
|
- * @head: list head to add it after
|
|
- *
|
|
- * Insert a new entry after the specified head.
|
|
- * This is good for implementing stacks.
|
|
+#define list_entry_offset(p, type, offset) \
|
|
+ ((type *)((char *)(p) - (offset)))
|
|
+
|
|
+/* list_entry - retrieve the original struct from list_head
|
|
+ * @p: list_head pointer
|
|
+ * @type: struct type
|
|
+ * @member: struct field member containing the list_head
|
|
*/
|
|
-static __inline__ void list_add(struct list_head *_new, struct list_head *head)
|
|
-{
|
|
- __list_add(_new, head, head->next);
|
|
-}
|
|
+#define list_entry(p, type, member) \
|
|
+ list_entry_offset(p, type, offsetof(type, member))
|
|
|
|
-/**
|
|
- * list_add_tail - add a new entry
|
|
- * @new: new entry to be added
|
|
- * @head: list head to add it before
|
|
- *
|
|
- * Insert a new entry before the specified head.
|
|
- * This is useful for implementing queues.
|
|
+/* list_for_each - iterate over the linked list
|
|
+ * @p: iterator, a list_head pointer variable
|
|
+ * @list: list_head pointer containing the list
|
|
*/
|
|
-static __inline__ void list_add_tail(struct list_head *_new, struct list_head *head)
|
|
-{
|
|
- __list_add(_new, head->prev, head);
|
|
-}
|
|
+#define list_for_each(p, list) \
|
|
+ for (p = (list)->next; p != (list); p = p->next)
|
|
|
|
-/*
|
|
- * Delete a list entry by making the prev/next entries
|
|
- * point to each other.
|
|
- *
|
|
- * This is only for internal list manipulation where we know
|
|
- * the prev/next entries already!
|
|
+/* list_for_each_safe - iterate over the linked list, safe to delete
|
|
+ * @p: iterator, a list_head pointer variable
|
|
+ * @s: a temporary variable to keep the next, a list_head pointer, too
|
|
+ * @list: list_head pointer containing the list
|
|
*/
|
|
-static __inline__ void __list_del(struct list_head * prev,
|
|
- struct list_head * next)
|
|
-{
|
|
- next->prev = prev;
|
|
- prev->next = next;
|
|
-}
|
|
+#define list_for_each_safe(p, s, list) \
|
|
+ for (p = (list)->next; s = p->next, p != (list); p = s)
|
|
|
|
-/**
|
|
- * list_del - deletes entry from list.
|
|
- * @entry: the element to delete from the list.
|
|
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
|
|
+/* list_add - prepend a list entry at the head
|
|
+ * @p: the new list entry to add
|
|
+ * @list: the list head
|
|
*/
|
|
-static __inline__ void list_del(struct list_head *entry)
|
|
+static inline void list_add(struct list_head *p, struct list_head *list)
|
|
{
|
|
- __list_del(entry->prev, entry->next);
|
|
+ struct list_head *first = list->next;
|
|
+
|
|
+ p->next = first;
|
|
+ first->prev = p;
|
|
+ list->next = p;
|
|
+ p->prev = list;
|
|
}
|
|
|
|
-/**
|
|
- * list_del_init - deletes entry from list and reinitialize it.
|
|
- * @entry: the element to delete from the list.n
|
|
+/* list_add_tail - append a list entry at the tail
|
|
+ * @p: the new list entry to add
|
|
+ * @list: the list head
|
|
*/
|
|
-static __inline__ void list_del_init(struct list_head *entry)
|
|
+static inline void list_add_tail(struct list_head *p, struct list_head *list)
|
|
{
|
|
- __list_del(entry->prev, entry->next);
|
|
- INIT_LIST_HEAD(entry);
|
|
+ struct list_head *last = list->prev;
|
|
+
|
|
+ last->next = p;
|
|
+ p->prev = last;
|
|
+ p->next = list;
|
|
+ list->prev = p;
|
|
}
|
|
|
|
-/**
|
|
- * list_empty - tests whether a list is empty
|
|
- * @head: the list to test.
|
|
- */
|
|
-static __inline__ int list_empty(struct list_head *head)
|
|
+/* list_del - delete the given list entry */
|
|
+static inline void list_del(struct list_head *p)
|
|
{
|
|
- return head->next == head;
|
|
+ p->prev->next = p->next;
|
|
+ p->next->prev = p->prev;
|
|
}
|
|
|
|
-/**
|
|
- * list_splice - join two lists
|
|
- * @list: the new list to add.
|
|
- * @head: the place to add it in the first list.
|
|
- */
|
|
-static __inline__ void list_splice(struct list_head *list, struct list_head *head)
|
|
+/* list_empty - returns 1 if the given list is empty */
|
|
+static inline int list_empty(const struct list_head *p)
|
|
{
|
|
- struct list_head *first = list->next;
|
|
-
|
|
- if (first != list) {
|
|
- struct list_head *last = list->prev;
|
|
- struct list_head *at = head->next;
|
|
-
|
|
- first->prev = head;
|
|
- head->next = first;
|
|
-
|
|
- last->next = at;
|
|
- at->prev = last;
|
|
- }
|
|
+ return p->next == p;
|
|
}
|
|
|
|
-/**
|
|
- * list_for_each - iterate over a list
|
|
- * @pos: the &struct list_head to use as a loop counter.
|
|
- * @head: the head for your list.
|
|
- */
|
|
-#define list_for_each(pos, head) \
|
|
- for (pos = (head)->next ; pos != (head); pos = pos->next)
|
|
-
|
|
-/**
|
|
- * list_for_each_safe - iterate over a list safely (actual pointer can be invalidated)
|
|
- * @pos: the &struct list_head to use as a loop counter.
|
|
- * @next: the &struct list_head to use to save next.
|
|
- * @head: the head for your list.
|
|
- */
|
|
-#define list_for_each_safe(pos, npos, head) \
|
|
- for (pos = (head)->next, npos = pos->next ; pos != (head); pos = npos, npos = pos->next)
|
|
-
|
|
-/**
|
|
- * list_entry - get the struct for this entry
|
|
- * @ptr: the &struct list_head pointer.
|
|
- * @type: the type of the struct this is embedded in.
|
|
- * @member: the name of the list_struct within the struct.
|
|
- */
|
|
-#define list_entry(ptr, type, member) \
|
|
- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
|
|
-
|
|
-/**
|
|
- * list_entry - get the struct for this entry
|
|
- * @ptr: the &struct list_head pointer.
|
|
- * @type: the type of the struct this is embedded in.
|
|
- * @offset: offset of entry inside a struct
|
|
- */
|
|
-#define list_entry_offset(ptr, type, offset) \
|
|
- ((type *)((char *)(ptr)-(offset)))
|
|
-
|
|
#endif /* _LIST_H */
|
|
--
|
|
2.5.0
|
|
|