From patchwork Thu Oct 5 00:53:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9986179 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C4C1860291 for ; Thu, 5 Oct 2017 00:54:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5284228C9 for ; Thu, 5 Oct 2017 00:54:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A996B28C22; Thu, 5 Oct 2017 00:54:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD2C5228C9 for ; Thu, 5 Oct 2017 00:54:10 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B5513267426; Thu, 5 Oct 2017 02:54:07 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 91E4B267439; Thu, 5 Oct 2017 02:53:49 +0200 (CEST) Received: from mail-pg0-f53.google.com (mail-pg0-f53.google.com [74.125.83.53]) by alsa0.perex.cz (Postfix) with ESMTP id 76F5E267419 for ; Thu, 5 Oct 2017 02:53:36 +0200 (CEST) Received: by mail-pg0-f53.google.com with SMTP id i195so7411044pgd.9 for ; Wed, 04 Oct 2017 17:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=bE4AcuGNji2fT+llgSbIKovTgnKC4T54MuhD/++MjTQ=; b=UTEe1SAlqpxtnwnQNgE+9MImXTF6HOYjlgPL1VtP2inoQnWOh27j0/v5WZuIFxp03L GL1fe0fi4TR2En87yhWk5PfvrwF3TKZavkZRIno1On2yFcW5sx57deYXitxfDFwScIHz vrTCH54xC5xSH/qS1JqK3c+ilvobPHa1XGY+A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=bE4AcuGNji2fT+llgSbIKovTgnKC4T54MuhD/++MjTQ=; b=FQOCWmJ1ufM971rQ6B6uIGfV1+YbNItSJgVZjw2I+URqovanGfPTaxp2Y8qUu6fZCv djACl2R7Ftpxj30/iz5sksSwYSwF1Sx4g5YgbW1MwLYjgY/VSkrAZfgGqqQO0tMElAoM PTpDb4lGa4KsHuuvfdzpCzu3GqFv+cLekVLj+nfNZKtC88dNE0QN1HHVT22MiObXS/Zy gIOik0u0tzjEVawHC18KX1VyLj5TA6Yuvu7zlnobravlQHQMWskiB5Z+PTiI9G/xyuZu WyE4aJ3iwU7EwTM2G8xuoTIUsy/bthu/ozsvL7RdJORBzsEwjDd/Ml6Xrt1ZQ9o6ZWy6 s5yw== X-Gm-Message-State: AMCzsaVl/wOPZsoPrIdmBEibN8BKorjzoxHd8I40WIoda1VhW9OTGnPw /DVvUOz+/iUnf8HsA7JWfuQm1KVszKo= X-Google-Smtp-Source: AOwi7QDot3bCCwpxIX6HDy9WsqCxxv03EFe3rKXcqMTnDNEJGtndOGGT7/iRysozZxmbkjoi+8WaiQ== X-Received: by 10.99.5.20 with SMTP id 20mr8913331pgf.177.1507164815454; Wed, 04 Oct 2017 17:53:35 -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 u12sm28770103pfa.153.2017.10.04.17.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:53:34 -0700 (PDT) Date: Wed, 4 Oct 2017 17:53:33 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Message-ID: <20171005005333.GA23782@beast> MIME-Version: 1.0 Content-Disposition: inline Cc: alsa-devel@alsa-project.org, Takashi Iwai , Thomas Gleixner , Ingo Molnar , Dan Carpenter Subject: [alsa-devel] [PATCH] sound/core: Convert timers to use timer_setup() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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. This adds a pointer back to struct snd_timer. Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Ingo Molnar Cc: Dan Carpenter Cc: alsa-devel@alsa-project.org Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- sound/core/timer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/core/timer.c b/sound/core/timer.c index 6cdd04a45962..09acaf2b2e57 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1028,15 +1028,17 @@ EXPORT_SYMBOL(snd_timer_global_register); struct snd_timer_system_private { struct timer_list tlist; + struct snd_timer *snd_timer; unsigned long last_expires; unsigned long last_jiffies; unsigned long correction; }; -static void snd_timer_s_function(unsigned long data) +static void snd_timer_s_function(struct timer_list *t) { - struct snd_timer *timer = (struct snd_timer *)data; - struct snd_timer_system_private *priv = timer->private_data; + struct snd_timer_system_private *priv = from_timer(priv, t, + tlist); + struct snd_timer *timer = priv->snd_timer; unsigned long jiff = jiffies; if (time_after(jiff, priv->last_expires)) priv->correction += (long)jiff - (long)priv->last_expires; @@ -1118,7 +1120,8 @@ static int snd_timer_register_system(void) snd_timer_free(timer); return -ENOMEM; } - setup_timer(&priv->tlist, snd_timer_s_function, (unsigned long) timer); + priv->snd_timer = timer; + timer_setup(&priv->tlist, snd_timer_s_function, 0); timer->private_data = priv; timer->private_free = snd_timer_free_system; return snd_timer_global_register(timer);