From patchwork Tue Oct 17 00:29:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 826597 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="SB/JZF0V"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yGGPQ2vCBz9s0Z for ; Tue, 17 Oct 2017 11:32:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754043AbdJQAcs (ORCPT ); Mon, 16 Oct 2017 20:32:48 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:47393 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933274AbdJQAaM (ORCPT ); Mon, 16 Oct 2017 20:30:12 -0400 Received: by mail-pg0-f47.google.com with SMTP id r25so47454pgn.4 for ; Mon, 16 Oct 2017 17:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nLgxgJ+ZP6G+Vkw1htUisQXLNufWu5lrGpta2MHcxL4=; b=SB/JZF0VG04Ht7xYSLNFKKrHy+2uvAcTaUJgoCih7XVKz0I2W5bvEccs+5aHJkE4Ab vHb8crIdGNoJvzLPLcDRyxImqYcpQL4TnfJCR1QYCmCYhjQprRDxhTfJJeerC6oi4KAa IfjARKT5tkIRYIAO4871Kbe5jNd6oOZLPb6Jg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nLgxgJ+ZP6G+Vkw1htUisQXLNufWu5lrGpta2MHcxL4=; b=RJ9tcO+wT1C+VgIO+D7EJF9mkVhpUxPUzItIDeGF3HRDSIwf7b5ssljrEN/OYnsPtK VAA8L4x5keotEwvFFbRoG481XgqjcmXFKKlip3bruohuFghWzLzmoDIU6tdLpHdTbNzO KG7fWbJZzITRL18v99EB5sXaHzlPfcohjucPiqAMwCLLvgtNXSrNkKIbASjmINMNLmSp Ar0L9XcJGO4HTx3dpxJUQTkisDqupQhD0pKiVyVKhC0QMMShkFlK0ebTrMNJFHon8Rlv hFB4f69sX6wNF5QhYDMfyQhoFRYetNOZQpPYWk6xcJMVEhdYweKLucemj/+54ynR9XyW XVYw== X-Gm-Message-State: AMCzsaVd+q0COukvCMeSJKitdn7+Ce3SaAWvL1OUyKadbSDhjE+6M1q3 2uafPhwdIO5ZMpEzKeMN+Z+nsQ== X-Google-Smtp-Source: AOwi7QBlIAnNqLeYXojHKr1EeM6nOWaEfAXfJkPd1Zu7lnQie1o8ArifaWy62zN6WlsWXCun6mZpoQ== X-Received: by 10.84.130.108 with SMTP id 99mr10443219plc.343.1508200212052; Mon, 16 Oct 2017 17:30:12 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id 84sm1413611pfy.179.2017.10.16.17.30.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 17:30:04 -0700 (PDT) From: Kees Cook To: "David S. Miller" Cc: Kees Cook , Karsten Keil , Al Viro , Stephen Hemminger , Arnd Bergmann , Johannes Berg , netdev@vger.kernel.org, Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH 42/58] isdnloop: Convert timers to use timer_setup() Date: Mon, 16 Oct 2017 17:29:26 -0700 Message-Id: <1508200182-104605-43-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508200182-104605-1-git-send-email-keescook@chromium.org> References: <1508200182-104605-1-git-send-email-keescook@chromium.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. Added missing initialization for rb_timer. Cc: Karsten Keil Cc: "David S. Miller" Cc: Al Viro Cc: Stephen Hemminger Cc: Arnd Bergmann Cc: Johannes Berg Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook --- drivers/isdn/isdnloop/isdnloop.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index e97232646ba1..a4597e96c916 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c @@ -90,9 +90,9 @@ isdnloop_bchan_send(isdnloop_card *card, int ch) * data = pointer to card struct, set by kernel timer.data */ static void -isdnloop_pollbchan(unsigned long data) +isdnloop_pollbchan(struct timer_list *t) { - isdnloop_card *card = (isdnloop_card *) data; + isdnloop_card *card = from_timer(card, t, rb_timer); unsigned long flags; if (card->flags & ISDNLOOP_FLAGS_B1ACTIVE) @@ -305,9 +305,9 @@ isdnloop_putmsg(isdnloop_card *card, unsigned char c) * data = pointer to card struct */ static void -isdnloop_polldchan(unsigned long data) +isdnloop_polldchan(struct timer_list *t) { - isdnloop_card *card = (isdnloop_card *) data; + isdnloop_card *card = from_timer(card, t, st_timer); struct sk_buff *skb; int avail; int left; @@ -373,8 +373,6 @@ isdnloop_polldchan(unsigned long data) card->flags |= ISDNLOOP_FLAGS_RBTIMER; spin_lock_irqsave(&card->isdnloop_lock, flags); del_timer(&card->rb_timer); - card->rb_timer.function = isdnloop_pollbchan; - card->rb_timer.data = (unsigned long) card; card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; add_timer(&card->rb_timer); spin_unlock_irqrestore(&card->isdnloop_lock, flags); @@ -588,9 +586,10 @@ isdnloop_atimeout(isdnloop_card *card, int ch) * Wrapper for isdnloop_atimeout(). */ static void -isdnloop_atimeout0(unsigned long data) +isdnloop_atimeout0(struct timer_list *t) { - isdnloop_card *card = (isdnloop_card *) data; + isdnloop_card *card = from_timer(card, t, c_timer[0]); + isdnloop_atimeout(card, 0); } @@ -598,9 +597,10 @@ isdnloop_atimeout0(unsigned long data) * Wrapper for isdnloop_atimeout(). */ static void -isdnloop_atimeout1(unsigned long data) +isdnloop_atimeout1(struct timer_list *t) { - isdnloop_card *card = (isdnloop_card *) data; + isdnloop_card *card = from_timer(card, t, c_timer[1]); + isdnloop_atimeout(card, 1); } @@ -617,13 +617,9 @@ isdnloop_start_ctimer(isdnloop_card *card, int ch) unsigned long flags; spin_lock_irqsave(&card->isdnloop_lock, flags); - init_timer(&card->c_timer[ch]); + timer_setup(&card->c_timer[ch], ch ? isdnloop_atimeout1 + : isdnloop_atimeout0, 0); card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT; - if (ch) - card->c_timer[ch].function = isdnloop_atimeout1; - else - card->c_timer[ch].function = isdnloop_atimeout0; - card->c_timer[ch].data = (unsigned long) card; add_timer(&card->c_timer[ch]); spin_unlock_irqrestore(&card->isdnloop_lock, flags); } @@ -1113,10 +1109,9 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp) sdef.ptype); return -EINVAL; } - init_timer(&card->st_timer); + timer_setup(&card->rb_timer, isdnloop_pollbchan, 0); + timer_setup(&card->st_timer, isdnloop_polldchan, 0); card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; - card->st_timer.function = isdnloop_polldchan; - card->st_timer.data = (unsigned long) card; add_timer(&card->st_timer); card->flags |= ISDNLOOP_FLAGS_RUNNING; spin_unlock_irqrestore(&card->isdnloop_lock, flags);