/** * 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 cthardware.c * * @Brief * This file contains the implementation of hardware access methord. * * @Author Liu Chun * @Date Jun 26 2008 * */ #include "cthardware.h" #include "cthw20k1.h" #include "cthw20k2.h" #include int create_hw_obj(struct pci_dev *pci, enum CHIPTYP chip_type, enum CTCARDS model, struct hw **rhw) { int err; switch (chip_type) { case ATC20K1: err = create_20k1_hw_obj(rhw); break; case ATC20K2: err = create_20k2_hw_obj(rhw); break; default: err = -ENODEV; break; } if (err) return err; (*rhw)->pci = pci; (*rhw)->chip_type = chip_type; (*rhw)->model = model; return 0; } int destroy_hw_obj(struct hw *hw) { int err; switch (hw->pci->device) { case 0x0005: /* 20k1 device */ err = destroy_20k1_hw_obj(hw); break; case 0x000B: /* 20k2 device */ err = destroy_20k2_hw_obj(hw); break; default: err = -ENODEV; break; } return err; } unsigned int get_field(unsigned int data, unsigned int field) { int i; if (WARN_ON(!field)) return 0; /* @field should always be greater than 0 */ for (i = 0; !(field & (1 << i)); ) i++; return (data & field) >> i; } void set_field(unsigned int *data, unsigned int field, unsigned int value) { int i; if (WARN_ON(!field)) return; /* @field should always be greater than 0 */ for (i = 0; !(field & (1 << i)); ) i++; *data = (*data & (~field)) | ((value << i) & field); } x/net-next.git/log/tools/perf/scripts/python'>logtreecommitdiff
path: root/tools/perf/scripts/python
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/scripts/python
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/scripts/python')