Skip to content

Commit

Permalink
samples: Convert timers to use timer_setup()
Browse files Browse the repository at this point in the history
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Jonathan Corbet <[email protected]>
  • Loading branch information
kees authored and Jonathan Corbet committed Oct 19, 2017
1 parent 7d7363e commit 0d69423
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions samples/connector/cn_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ static int cn_test_want_notify(void)
#endif

static u32 cn_test_timer_counter;
static void cn_test_timer_func(unsigned long __data)
static void cn_test_timer_func(struct timer_list *unused)
{
struct cn_msg *m;
char data[32];

pr_debug("%s: timer fired with data %lu\n", __func__, __data);
pr_debug("%s: timer fired\n", __func__);

m = kzalloc(sizeof(*m) + sizeof(data), GFP_ATOMIC);
if (m) {
Expand Down Expand Up @@ -168,7 +168,7 @@ static int cn_test_init(void)
goto err_out;
}

setup_timer(&cn_test_timer, cn_test_timer_func, 0);
timer_setup(&cn_test_timer, cn_test_timer_func, 0);
mod_timer(&cn_test_timer, jiffies + msecs_to_jiffies(1000));

pr_info("initialized with id={%u.%u}\n",
Expand Down

0 comments on commit 0d69423

Please sign in to comment.