Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a83f4340 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman
Browse files

staging/irda/net: Convert timers to use timer_setup()



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.

Cc: Samuel Ortiz <samuel@sortiz.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4bdd439f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -82,9 +82,9 @@ typedef enum {
extern const char *const irlmp_state[];
extern const char *const irlsap_state[];

void irlmp_watchdog_timer_expired(void *data);
void irlmp_discovery_timer_expired(void *data);
void irlmp_idle_timer_expired(void *data);
void irlmp_watchdog_timer_expired(struct timer_list *t);
void irlmp_discovery_timer_expired(struct timer_list *t);
void irlmp_idle_timer_expired(struct timer_list *t);

void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event, 
			struct sk_buff *skb);
+4 −7
Original line number Diff line number Diff line
@@ -72,13 +72,10 @@ struct lap_cb;

#define WATCHDOG_TIMEOUT        (20*HZ)       /* 20 sec */

typedef void (*TIMER_CALLBACK)(void *);

static inline void irda_start_timer(struct timer_list *ptimer, int timeout,
				    void* data, TIMER_CALLBACK callback)
				    void (*callback)(struct timer_list *))
{
	ptimer->function = (void (*)(unsigned long)) callback;
	ptimer->data = (unsigned long) data;
	ptimer->function = (TIMER_FUNC_TYPE) callback;

	/* Set new value for timer (update or add timer).
	 * We use mod_timer() because it's more efficient and also
+3 −4
Original line number Diff line number Diff line
@@ -429,11 +429,11 @@ static void irda_selective_discovery_indication(discinfo_t *discovery,
 * We were waiting for a node to be discovered, but nothing has come up
 * so far. Wake up the user and tell him that we failed...
 */
static void irda_discovery_timeout(u_long priv)
static void irda_discovery_timeout(struct timer_list *t)
{
	struct irda_sock *self;

	self = (struct irda_sock *) priv;
	self = from_timer(self, t, watchdog);
	BUG_ON(self == NULL);

	/* Nothing for the caller */
@@ -2505,8 +2505,7 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,

			/* Set watchdog timer to expire in <val> ms. */
			self->errno = 0;
			setup_timer(&self->watchdog, irda_discovery_timeout,
					(unsigned long)self);
			timer_setup(&self->watchdog, irda_discovery_timeout, 0);
			mod_timer(&self->watchdog,
				  jiffies + msecs_to_jiffies(val));

+1 −1
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ static int ircomm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
		self->max_data_size = IRCOMM_TTY_DATA_UNINITIALISED;

		/* Init some important stuff */
		init_timer(&self->watchdog_timer);
		timer_setup(&self->watchdog_timer, NULL, 0);
		spin_lock_init(&self->spinlock);

		/*
+4 −4
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id,
					struct ias_value *value, void *priv);
static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
					    int timeout);
static void ircomm_tty_watchdog_timer_expired(void *data);
static void ircomm_tty_watchdog_timer_expired(struct timer_list *timer);

static int ircomm_tty_state_idle(struct ircomm_tty_cb *self,
				 IRCOMM_TTY_EVENT event,
@@ -587,7 +587,7 @@ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
	IRDA_ASSERT(self != NULL, return;);
	IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);

	irda_start_timer(&self->watchdog_timer, timeout, (void *) self,
	irda_start_timer(&self->watchdog_timer, timeout,
			 ircomm_tty_watchdog_timer_expired);
}

@@ -597,9 +597,9 @@ static void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self,
 *    Called when the connect procedure have taken to much time.
 *
 */
static void ircomm_tty_watchdog_timer_expired(void *data)
static void ircomm_tty_watchdog_timer_expired(struct timer_list *t)
{
	struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data;
	struct ircomm_tty_cb *self = from_timer(self, t, watchdog_timer);

	IRDA_ASSERT(self != NULL, return;);
	IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
Loading