/** * 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); } }
path: root/sound/soc/pxa/pxa2xx-ac97.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-02-01 17:45:02 +0000
committerIngo Molnar <mingo@kernel.org>2017-02-01 21:17:49 +0100
commitc8f325a59cfc718d13a50fbc746ed9b415c25e92 (patch)
treed53fbdac9d0781e39a13b2ac6b2bd258cf3b4140 /sound/soc/pxa/pxa2xx-ac97.c
parentbf29bddf0417a4783da3b24e8c9e017ac649326f (diff)
efi/fdt: Avoid FDT manipulation after ExitBootServices()
Some AArch64 UEFI implementations disable the MMU in ExitBootServices(), after which unaligned accesses to RAM are no longer supported. Commit: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") fixed an issue in the memory map handling of the stub FDT code, but inadvertently created an issue with such firmware, by moving some of the FDT manipulation to after the invocation of ExitBootServices(). Given that the stub's libfdt implementation uses the ordinary, accelerated string functions, which rely on hardware handling of unaligned accesses, manipulating the FDT with the MMU off may result in alignment faults. So fix the situation by moving the update_fdt_memmap() call into the callback function invoked by efi_exit_boot_services() right before it calls the ExitBootServices() UEFI service (which is arguably a better place for it anyway) Note that disabling the MMU in ExitBootServices() is not compliant with the UEFI spec, and carries great risk due to the fact that switching from cached to uncached memory accesses halfway through compiler generated code (i.e., involving a stack) can never be done in a way that is architecturally safe. Fixes: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Riku Voipio <riku.voipio@linaro.org> Cc: <stable@vger.kernel.org> Cc: mark.rutland@arm.com Cc: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk Cc: leif.lindholm@linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1485971102-23330-2-git-send-email-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'sound/soc/pxa/pxa2xx-ac97.c')