Skip to content

Commit 4cfea08

Browse files
keesdavem330
authored andcommitted
isdn/gigaset: 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: Paul Bolle <pebolle@tiscali.nl> Cc: Karsten Keil <isdn@linux-pingi.de> Cc: "David S. Miller" <davem@davemloft.net> Cc: Johan Hovold <johan@kernel.org> Cc: gigaset307x-common@lists.sourceforge.net Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c788dd2 commit 4cfea08

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

drivers/isdn/gigaset/bas-gigaset.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,11 @@ static void check_pending(struct bas_cardstate *ucs)
433433
* argument:
434434
* controller state structure
435435
*/
436-
static void cmd_in_timeout(unsigned long data)
436+
static void cmd_in_timeout(struct timer_list *t)
437437
{
438-
struct cardstate *cs = (struct cardstate *) data;
439-
struct bas_cardstate *ucs = cs->hw.bas;
438+
struct bas_cardstate *ucs = from_timer(ucs, t, timer_cmd_in);
439+
struct urb *urb = ucs->urb_int_in;
440+
struct cardstate *cs = urb->context;
440441
int rc;
441442

442443
if (!ucs->rcvbuf_size) {
@@ -639,10 +640,11 @@ static void int_in_work(struct work_struct *work)
639640
* argument:
640641
* controller state structure
641642
*/
642-
static void int_in_resubmit(unsigned long data)
643+
static void int_in_resubmit(struct timer_list *t)
643644
{
644-
struct cardstate *cs = (struct cardstate *) data;
645-
struct bas_cardstate *ucs = cs->hw.bas;
645+
struct bas_cardstate *ucs = from_timer(ucs, t, timer_int_in);
646+
struct urb *urb = ucs->urb_int_in;
647+
struct cardstate *cs = urb->context;
646648
int rc;
647649

648650
if (ucs->retry_int_in++ >= BAS_RETRY) {
@@ -1441,10 +1443,11 @@ static void read_iso_tasklet(unsigned long data)
14411443
* argument:
14421444
* controller state structure
14431445
*/
1444-
static void req_timeout(unsigned long data)
1446+
static void req_timeout(struct timer_list *t)
14451447
{
1446-
struct cardstate *cs = (struct cardstate *) data;
1447-
struct bas_cardstate *ucs = cs->hw.bas;
1448+
struct bas_cardstate *ucs = from_timer(ucs, t, timer_ctrl);
1449+
struct urb *urb = ucs->urb_int_in;
1450+
struct cardstate *cs = urb->context;
14481451
int pending;
14491452
unsigned long flags;
14501453

@@ -1837,10 +1840,11 @@ static void write_command_callback(struct urb *urb)
18371840
* argument:
18381841
* controller state structure
18391842
*/
1840-
static void atrdy_timeout(unsigned long data)
1843+
static void atrdy_timeout(struct timer_list *t)
18411844
{
1842-
struct cardstate *cs = (struct cardstate *) data;
1843-
struct bas_cardstate *ucs = cs->hw.bas;
1845+
struct bas_cardstate *ucs = from_timer(ucs, t, timer_atrdy);
1846+
struct urb *urb = ucs->urb_int_in;
1847+
struct cardstate *cs = urb->context;
18441848

18451849
dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n");
18461850

@@ -2213,10 +2217,10 @@ static int gigaset_initcshw(struct cardstate *cs)
22132217
}
22142218

22152219
spin_lock_init(&ucs->lock);
2216-
setup_timer(&ucs->timer_ctrl, req_timeout, (unsigned long) cs);
2217-
setup_timer(&ucs->timer_atrdy, atrdy_timeout, (unsigned long) cs);
2218-
setup_timer(&ucs->timer_cmd_in, cmd_in_timeout, (unsigned long) cs);
2219-
setup_timer(&ucs->timer_int_in, int_in_resubmit, (unsigned long) cs);
2220+
timer_setup(&ucs->timer_ctrl, req_timeout, 0);
2221+
timer_setup(&ucs->timer_atrdy, atrdy_timeout, 0);
2222+
timer_setup(&ucs->timer_cmd_in, cmd_in_timeout, 0);
2223+
timer_setup(&ucs->timer_int_in, int_in_resubmit, 0);
22202224
init_waitqueue_head(&ucs->waitqueue);
22212225
INIT_WORK(&ucs->int_in_wq, int_in_work);
22222226

drivers/isdn/gigaset/common.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ static int test_timeout(struct at_state_t *at_state)
153153
return 1;
154154
}
155155

156-
static void timer_tick(unsigned long data)
156+
static void timer_tick(struct timer_list *t)
157157
{
158-
struct cardstate *cs = (struct cardstate *) data;
158+
struct cardstate *cs = from_timer(cs, t, timer);
159159
unsigned long flags;
160160
unsigned channel;
161161
struct at_state_t *at_state;
@@ -687,7 +687,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
687687
cs->ignoreframes = ignoreframes;
688688
INIT_LIST_HEAD(&cs->temp_at_states);
689689
cs->running = 0;
690-
init_timer(&cs->timer); /* clear next & prev */
690+
timer_setup(&cs->timer, timer_tick, 0);
691691
spin_lock_init(&cs->ev_lock);
692692
cs->ev_tail = 0;
693693
cs->ev_head = 0;
@@ -768,7 +768,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
768768
spin_lock_irqsave(&cs->lock, flags);
769769
cs->running = 1;
770770
spin_unlock_irqrestore(&cs->lock, flags);
771-
setup_timer(&cs->timer, timer_tick, (unsigned long) cs);
772771
cs->timer.expires = jiffies + msecs_to_jiffies(GIG_TICK);
773772
add_timer(&cs->timer);
774773

0 commit comments

Comments
 (0)