Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251970
b: refs/heads/master
c: 3f397c2
h: refs/heads/master
v: v3
  • Loading branch information
Uwe Kleine-König authored and Grant Likely committed May 20, 2011
1 parent 5ab4f84 commit 9607e6e
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc300d9ead66235e23c674babb8a4ae4ad4c9db8
refs/heads/master: 3f397c2144e46d9127662fdb6314f21960d8563d
18 changes: 16 additions & 2 deletions trunk/drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <linux/idr.h>
#include <linux/slab.h>

#define CREATE_TRACE_POINTS
#include <trace/events/gpio.h>

/* Optional implementation infrastructure for GPIO interfaces.
*
Expand Down Expand Up @@ -1405,6 +1407,8 @@ int gpio_direction_input(unsigned gpio)
status = chip->direction_input(chip, gpio);
if (status == 0)
clear_bit(FLAG_IS_OUT, &desc->flags);

trace_gpio_direction(chip->base + gpio, 1, status);
lose:
return status;
fail:
Expand Down Expand Up @@ -1458,6 +1462,8 @@ int gpio_direction_output(unsigned gpio, int value)
status = chip->direction_output(chip, gpio, value);
if (status == 0)
set_bit(FLAG_IS_OUT, &desc->flags);
trace_gpio_value(chip->base + gpio, 0, value);
trace_gpio_direction(chip->base + gpio, 0, status);
lose:
return status;
fail:
Expand Down Expand Up @@ -1547,10 +1553,13 @@ EXPORT_SYMBOL_GPL(gpio_set_debounce);
int __gpio_get_value(unsigned gpio)
{
struct gpio_chip *chip;
int value;

chip = gpio_to_chip(gpio);
WARN_ON(chip->can_sleep);
return chip->get ? chip->get(chip, gpio - chip->base) : 0;
value = chip->get ? chip->get(chip, gpio - chip->base) : 0;
trace_gpio_value(gpio, 1, value);
return value;
}
EXPORT_SYMBOL_GPL(__gpio_get_value);

Expand All @@ -1569,6 +1578,7 @@ void __gpio_set_value(unsigned gpio, int value)

chip = gpio_to_chip(gpio);
WARN_ON(chip->can_sleep);
trace_gpio_value(gpio, 0, value);
chip->set(chip, gpio - chip->base, value);
}
EXPORT_SYMBOL_GPL(__gpio_set_value);
Expand Down Expand Up @@ -1619,10 +1629,13 @@ EXPORT_SYMBOL_GPL(__gpio_to_irq);
int gpio_get_value_cansleep(unsigned gpio)
{
struct gpio_chip *chip;
int value;

might_sleep_if(extra_checks);
chip = gpio_to_chip(gpio);
return chip->get ? chip->get(chip, gpio - chip->base) : 0;
value = chip->get ? chip->get(chip, gpio - chip->base) : 0;
trace_gpio_value(gpio, 1, value);
return value;
}
EXPORT_SYMBOL_GPL(gpio_get_value_cansleep);

Expand All @@ -1632,6 +1645,7 @@ void gpio_set_value_cansleep(unsigned gpio, int value)

might_sleep_if(extra_checks);
chip = gpio_to_chip(gpio);
trace_gpio_value(gpio, 0, value);
chip->set(chip, gpio - chip->base, value);
}
EXPORT_SYMBOL_GPL(gpio_set_value_cansleep);
Expand Down
56 changes: 56 additions & 0 deletions trunk/include/trace/events/gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM gpio

#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_GPIO_H

#include <linux/tracepoint.h>

TRACE_EVENT(gpio_direction,

TP_PROTO(unsigned gpio, int in, int err),

TP_ARGS(gpio, in, err),

TP_STRUCT__entry(
__field(unsigned, gpio)
__field(int, in)
__field(int, err)
),

TP_fast_assign(
__entry->gpio = gpio;
__entry->in = in;
__entry->err = err;
),

TP_printk("%u %3s (%d)", __entry->gpio,
__entry->in ? "in" : "out", __entry->err)
);

TRACE_EVENT(gpio_value,

TP_PROTO(unsigned gpio, int get, int value),

TP_ARGS(gpio, get, value),

TP_STRUCT__entry(
__field(unsigned, gpio)
__field(int, get)
__field(int, value)
),

TP_fast_assign(
__entry->gpio = gpio;
__entry->get = get;
__entry->value = value;
),

TP_printk("%u %3s %d", __entry->gpio,
__entry->get ? "get" : "set", __entry->value)
);

#endif /* if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ) */

/* This part must be outside protection */
#include <trace/define_trace.h>

0 comments on commit 9607e6e

Please sign in to comment.