/** * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved. * * This source file is released under GPL v2 license (no other versions). * See the COPYING file included in the main directory of this source * distribution for the license terms and conditions. * * @File ctimap.c * * @Brief * This file contains the implementation of generic input mapper operations * for input mapper management. * * @Author Liu Chun * @Date May 23 2008 * */ #include "ctimap.h" #include int input_mapper_add(struct list_head *mappers, struct imapper *entry, int (*map_op)(void *, struct imapper *), void *data) { struct list_head *pos, *pre, *head; struct imapper *pre_ent, *pos_ent; head = mappers; if (list_empty(head)) { entry->next = entry->addr; map_op(data, entry); list_add(&entry->list, head); return 0; } list_for_each(pos, head) { pos_ent = list_entry(pos, struct imapper, list); if (pos_ent->slot > entry->slot) { /* found a position in list */ break; } } if (pos != head) { pre = pos->prev; if (pre == head) pre = head->prev; __list_add(&entry->list, pos->prev, pos); } else { pre = head->prev; pos = head->next; list_add_tail(&entry->list, head); } pre_ent = list_entry(pre, struct imapper, list); pos_ent = list_entry(pos, struct imapper, list); entry->next = pos_ent->addr; map_op(data, entry); pre_ent->next = entry->addr; map_op(data, pre_ent); return 0; } int input_mapper_delete(struct list_head *mappers, struct imapper *entry, int (*map_op)(void *, struct imapper *), void *data) { struct list_head *next, *pre, *head; struct imapper *pre_ent, *next_ent; head = mappers; if (list_empty(head)) return 0; pre = (entry->list.prev == head) ? head->prev : entry->list.prev; next = (entry->list.next == head) ? head->next : entry->list.next; if (pre == &entry->list) { /* entry is the only one node in mappers list */ entry->next = entry->addr = entry->user = entry->slot = 0; map_op(data, entry); list_del(&entry->list); return 0; } pre_ent = list_entry(pre, struct imapper, list); next_ent = list_entry(next, struct imapper, list); pre_ent->next = next_ent->addr; map_op(data, pre_ent); list_del(&entry->list); return 0; } void free_input_mapper_list(struct list_head *head) { struct imapper *entry; struct list_head *pos; while (!list_empty(head)) { pos = head->next; list_del(pos); entry = list_entry(pos, struct imapper, list); kfree(entry); } } gi/linux/net-next.git/log/tools/build/feature/test-libpython-version.c'>
path: root/tools/build/feature/test-libpython-version.c
diff options
context:
space:
mode:
authorMarkus Mayer <mmayer@broadcom.com>2016-12-19 12:10:28 -0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-01-27 11:43:49 +0100
commit3c223c19aea85d3dda1416c187915f4a30b04b1f (patch)
tree2d2021f8161db3e9ed38b9a966a225b66dff8e58 /tools/build/feature/test-libpython-version.c
parent9b02c54bc951fca884ba5719f42a27e8240965bf (diff)
cpufreq: brcmstb-avs-cpufreq: properly retrieve P-state upon suspend
The AVS GET_PMAP command does return a P-state along with the P-map information. However, that P-state is the initial P-state when the P-map was first downloaded to AVS. It is *not* the current P-state. Therefore, we explicitly retrieve the P-state using the GET_PSTATE command. Signed-off-by: Markus Mayer <mmayer@broadcom.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'tools/build/feature/test-libpython-version.c')