~ubuntu-branches/ubuntu/precise/linux-linaro-u8500/precise

« back to all changes in this revision

Viewing changes to samples/markers/probe-example.c

  • Committer: Bazaar Package Importer
  • Author(s): John Rigby, Upstream Fixes, Andy Green, John Rigby
  • Date: 2011-04-14 12:16:06 UTC
  • Revision ID: james.westby@ubuntu.com-20110414121606-b77podkyqgr2oix7
Tags: 2.6.38-1002.3
[ Upstream Fixes ]

* MUSB: shutdown: Make sure block is awake before doing shutdown
  - LP: #745737
* Fixed gpio polarity of gpio USB-phy reset.
  - LP: #747639

[ Andy Green ]

* LINARO: SAUCE: disable CONFIG_OMAP_RESET_CLOCKS
  - LP: #752900

[ John Rigby ]

* Rebase to new upstreams:
  Linux v2.6.38.1
  linaro-linux-2.6.38-upstream-29Mar2011
  Ubuntu-2.6.38-7.35
* SAUCE: OMAP4: clock: wait for module to become accessible on
  a clk enable
  - LP: #745737
* Rebase to new upstreams:
  Linux v2.6.38.2
  linaro-linux-2.6.38-upstream-5Apr2011
  Ubuntu-2.6.38-8.41
  - LP: #732842
* Update configs for device tree, dvfs and lttng
* LINARO: add building of dtb's
* LINARO: SAUCE: Disable lowest operating freqs on omap34xx
  - LP: #732912

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* probe-example.c
 
2
 *
 
3
 * Connects two functions to marker call sites.
 
4
 *
 
5
 * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
 
6
 *
 
7
 * This file is released under the GPLv2.
 
8
 * See the file COPYING for more details.
 
9
 */
 
10
 
 
11
#include <linux/sched.h>
 
12
#include <linux/kernel.h>
 
13
#include <linux/module.h>
 
14
#include <linux/marker.h>
 
15
#include <asm/atomic.h>
 
16
 
 
17
struct probe_data {
 
18
        const char *name;
 
19
        const char *format;
 
20
        marker_probe_func *probe_func;
 
21
};
 
22
 
 
23
static void probe_subsystem_event(const struct marker *mdata,
 
24
        void *probe_data, void *call_data,
 
25
        const char *format, va_list *args)
 
26
{
 
27
        /* Declare args */
 
28
        unsigned int value;
 
29
        const char *mystr;
 
30
 
 
31
        /* Assign args */
 
32
        value = va_arg(*args, typeof(value));
 
33
        mystr = va_arg(*args, typeof(mystr));
 
34
 
 
35
        /* Call printk */
 
36
        printk(KERN_INFO "Value %u, string %s\n", value, mystr);
 
37
 
 
38
        /* or count, check rights, serialize data in a buffer */
 
39
}
 
40
 
 
41
atomic_t eventb_count = ATOMIC_INIT(0);
 
42
 
 
43
static void probe_subsystem_eventb(const struct marker *mdata,
 
44
        void *probe_data, void *call_data,
 
45
        const char *format, va_list *args)
 
46
{
 
47
        /* Increment counter */
 
48
        atomic_inc(&eventb_count);
 
49
}
 
50
 
 
51
static struct probe_data probe_array[] =
 
52
{
 
53
        {       .name = "subsystem_event",
 
54
                .format = "integer %d string %s",
 
55
                .probe_func = probe_subsystem_event },
 
56
        {       .name = "subsystem_eventb",
 
57
                .format = MARK_NOARGS,
 
58
                .probe_func = probe_subsystem_eventb },
 
59
};
 
60
 
 
61
static int __init probe_init(void)
 
62
{
 
63
        int result;
 
64
        int i;
 
65
 
 
66
        for (i = 0; i < ARRAY_SIZE(probe_array); i++) {
 
67
                result = marker_probe_register("samples", probe_array[i].name,
 
68
                                probe_array[i].format,
 
69
                                probe_array[i].probe_func, &probe_array[i]);
 
70
                if (result)
 
71
                        printk(KERN_INFO "Unable to register probe %s\n",
 
72
                                probe_array[i].name);
 
73
        }
 
74
        return 0;
 
75
}
 
76
 
 
77
static void __exit probe_fini(void)
 
78
{
 
79
        int i;
 
80
 
 
81
        for (i = 0; i < ARRAY_SIZE(probe_array); i++)
 
82
                marker_probe_unregister("samples", probe_array[i].name,
 
83
                        probe_array[i].probe_func, &probe_array[i]);
 
84
        printk(KERN_INFO "Number of event b : %u\n",
 
85
                        atomic_read(&eventb_count));
 
86
        marker_synchronize_unregister();
 
87
}
 
88
 
 
89
module_init(probe_init);
 
90
module_exit(probe_fini);
 
91
 
 
92
MODULE_LICENSE("GPL");
 
93
MODULE_AUTHOR("Mathieu Desnoyers");
 
94
MODULE_DESCRIPTION("SUBSYSTEM Probe");