/* * Helper functions for jack-detection kcontrols * * Copyright (c) 2011 Takashi Iwai * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. */ #include #include #include #include #define jack_detect_kctl_info snd_ctl_boolean_mono_info static int jack_detect_kctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = kcontrol->private_value; return 0; } static struct snd_kcontrol_new jack_detect_kctl = { /* name is filled later */ .iface = SNDRV_CTL_ELEM_IFACE_CARD, .access = SNDRV_CTL_ELEM_ACCESS_READ, .info = jack_detect_kctl_info, .get = jack_detect_kctl_get, }; static int get_available_index(struct snd_card *card, const char *name) { struct snd_ctl_elem_id sid; memset(&sid, 0, sizeof(sid)); sid.index = 0; sid.iface = SNDRV_CTL_ELEM_IFACE_CARD; strlcpy(sid.name, name, sizeof(sid.name)); while (snd_ctl_find_id(card, &sid)) { sid.index++; /* reset numid; otherwise snd_ctl_find_id() hits this again */ sid.numid = 0; } return sid.index; } static void jack_kctl_name_gen(char *name, const char *src_name, int size) { size_t count = strlen(src_name); bool need_cat = true; /* remove redundant " Jack" from src_name */ if (count >= 5) need_cat = strncmp(&src_name[count - 5], " Jack", 5) ? true : false; snprintf(name, size, need_cat ? "%s Jack" : "%s", src_name); } struct snd_kcontrol * snd_kctl_jack_new(const char *name, struct snd_card *card) { struct snd_kcontrol *kctl; kctl = snd_ctl_new1(&jack_detect_kctl, NULL); if (!kctl) return NULL; jack_kctl_name_gen(kctl->id.name, name, sizeof(kctl->id.name)); kctl->id.index = get_available_index(card, kctl->id.name); kctl->private_value = 0; return kctl; } void snd_kctl_jack_report(struct snd_card *card, struct snd_kcontrol *kctl, bool status) { if (kctl->private_value == status) return; kctl->private_value = status; snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); } nux/net-next.git/log/tools/perf/arch/arm64'>
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-01 12:27:05 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-01 12:27:05 -0800
commit4759d386d55fef452d692bf101167914437e848e (patch)
treee7109c192ec589fcea2a98f9702aa3c0e4009581 /tools/perf/arch/arm64
parent238d1d0f79f619d75c2cc741d6770fb0986aef24 (diff)
parent1db175428ee374489448361213e9c3b749d14900 (diff)
Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull DAX updates from Dan Williams: "The completion of Jan's DAX work for 4.10. As I mentioned in the libnvdimm-for-4.10 pull request, these are some final fixes for the DAX dirty-cacheline-tracking invalidation work that was merged through the -mm, ext4, and xfs trees in -rc1. These patches were prepared prior to the merge window, but we waited for 4.10-rc1 to have a stable merge base after all the prerequisites were merged. Quoting Jan on the overall changes in these patches: "So I'd like all these 6 patches to go for rc2. The first three patches fix invalidation of exceptional DAX entries (a bug which is there for a long time) - without these patches data loss can occur on power failure even though user called fsync(2). The other three patches change locking of DAX faults so that ->iomap_begin() is called in a more relaxed locking context and we are safe to start a transaction there for ext4" These have received a build success notification from the kbuild robot, and pass the latest libnvdimm unit tests. There have not been any -next releases since -rc1, so they have not appeared there" * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: ext4: Simplify DAX fault path dax: Call ->iomap_begin without entry lock during dax fault dax: Finish fault completely when loading holes dax: Avoid page invalidation races and unnecessary radix tree traversals mm: Invalidate DAX radix tree entries only if appropriate ext2: Return BH_New buffers for zeroed blocks
Diffstat (limited to 'tools/perf/arch/arm64')