/* Helper functions for Thinkpad LED control; * to be included from codec driver */ #if IS_ENABLED(CONFIG_THINKPAD_ACPI) #include #include static int (*led_set_func)(int, bool); static void (*old_vmaster_hook)(void *, int); static bool is_thinkpad(struct hda_codec *codec) { return (codec->core.subsystem_id >> 16 == 0x17aa) && (acpi_dev_found("LEN0068") || acpi_dev_found("LEN0268") || acpi_dev_found("IBM0068")); } static void update_tpacpi_mute_led(void *private_data, int enabled) { if (old_vmaster_hook) old_vmaster_hook(private_data, enabled); if (led_set_func) led_set_func(TPACPI_LED_MUTE, !enabled); } static void update_tpacpi_micmute_led(struct hda_codec *codec, struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { if (!ucontrol || !led_set_func) return; if (strcmp("Capture Switch", ucontrol->id.name) == 0 && ucontrol->id.index == 0) { /* TODO: How do I verify if it's a mono or stereo here? */ bool val = ucontrol->value.integer.value[0] || ucontrol->value.integer.value[1]; led_set_func(TPACPI_LED_MICMUTE, !val); } } static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, const struct hda_fixup *fix, int action) { struct hda_gen_spec *spec = codec->spec; bool removefunc = false; if (action == HDA_FIXUP_ACT_PROBE) { if (!is_thinkpad(codec)) return; if (!led_set_func) led_set_func = symbol_request(tpacpi_led_set); if (!led_set_func) { codec_warn(codec, "Failed to find thinkpad-acpi symbol tpacpi_led_set\n"); return; } removefunc = true; if (led_set_func(TPACPI_LED_MUTE, false) >= 0) { old_vmaster_hook = spec->vmaster_mute.hook; spec->vmaster_mute.hook = update_tpacpi_mute_led; removefunc = false; } if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { if (spec->num_adc_nids > 1 && !spec->dyn_adc_switch) codec_dbg(codec, "Skipping micmute LED control due to several ADCs"); else { spec->cap_sync_hook = update_tpacpi_micmute_led; removefunc = false; } } } if (led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) { symbol_put(tpacpi_led_set); led_set_func = NULL; old_vmaster_hook = NULL; } } #else /* CONFIG_THINKPAD_ACPI */ static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, const struct hda_fixup *fix, int action) { } #endif /* CONFIG_THINKPAD_ACPI */ 98994ce3d5aeca52445d1f5627c4ba'/>
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2017-01-26 23:15:08 +0100
committerIngo Molnar <mingo@kernel.org>2017-01-30 11:41:26 +0100
commit0b3589be9b98994ce3d5aeca52445d1f5627c4ba (patch)
tree85d0d9b3ac902af2c938b19a566884caf8d00323 /tools/perf/arch/x86/util/unwind-libdw.c
parenta76a82a3e38c8d3fb6499e3dfaeb0949241ab588 (diff)
perf/core: Fix PERF_RECORD_MMAP2 prot/flags for anonymous memory
Andres reported that MMAP2 records for anonymous memory always have their protection field 0. Turns out, someone daft put the prot/flags generation code in the file branch, leaving them unset for anonymous memory. Reported-by: Andres Freund <andres@anarazel.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Don Zickus <dzickus@redhat.com Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: acme@kernel.org Cc: anton@ozlabs.org Cc: namhyung@kernel.org Cc: stable@vger.kernel.org # v3.16+ Fixes: f972eb63b100 ("perf: Pass protection and flags bits through mmap2 interface") Link: http://lkml.kernel.org/r/20170126221508.GF6536@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/arch/x86/util/unwind-libdw.c')