From patchwork Thu Oct 5 00:53:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9986197 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 F013F60291 for ; Thu, 5 Oct 2017 00:55:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E04AF28C43 for ; Thu, 5 Oct 2017 00:55:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3CBD28C45; Thu, 5 Oct 2017 00:55:04 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,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 0E3CF28C43 for ; Thu, 5 Oct 2017 00:55:03 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5557F26742B; Thu, 5 Oct 2017 02:54:20 +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 AB55A267419; Thu, 5 Oct 2017 02:53:50 +0200 (CEST) Received: from mail-pg0-f54.google.com (mail-pg0-f54.google.com [74.125.83.54]) by alsa0.perex.cz (Postfix) with ESMTP id 83044267428 for ; Thu, 5 Oct 2017 02:53:43 +0200 (CEST) Received: by mail-pg0-f54.google.com with SMTP id b11so7406177pgn.12 for ; Wed, 04 Oct 2017 17:53:43 -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=UbYEKIGRfTvMtKiYMRa/XmCEcjr96Kc4bMvMC/AtMtM=; b=ikDY8mcTtqpBWdFgcsNBKLLGGt0yTRUlWszuTRtLocZOgDdWexAlLh1g0m5KKcRn8E jADM1vwnycKcTmMEpe/q3CWwIfo3UpydLVHrpJzcVwp750yAC+R4ogTn6iS3ytCja6oH KTwz8wgcqqk73yZb804+rwjv/5Ac+GhH5b3IQ= 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=UbYEKIGRfTvMtKiYMRa/XmCEcjr96Kc4bMvMC/AtMtM=; b=dkLhms5Pjr8usX3N9ZlaPIdPSvDV0Kj1WNmNwqAwqRE/DGTAqibN/jf/1w9o7ZDOeS e+u67fGYcES+KiYpgekJmhm10bxT4Jf8S6qSM9K20ZVRGXRDWTkg0bsXL0HR1D6huXJm wJib5e7vCnKqjr8xTXkLeTKALEHfKR6zagFVUnFCTJpu8/9/ycbDOcM3lJy4sSM45KRq A7A0TgaJlRfSHPIkKEaGW/sxEJ9XPK3su0iUfUnYxs7cqVua58vOLA9dkS2Bc9n1OpXM sJmjbgMBhKxX+eFj2peAfQ9JitJxohelkmteTtgesa1fbbh7bdJElRdVN01BjhN3ZPdq 1VIQ== X-Gm-Message-State: AHPjjUgBM42+of3bNaOaFQoDLhXZqd1u3qRKhNiPzExaYP2tNoSUe+QH EVVZEoPyBevbPk16ilKEZUWduJZAY20= X-Google-Smtp-Source: AOwi7QAUo4R9mm75ykkxE0amMZOtuLMEe7aSMSl8jbltC8ysNUhvrvHDywPmJm+rnL0PkuqUiP0LvA== X-Received: by 10.98.20.78 with SMTP id 75mr21576649pfu.239.1507164822275; Wed, 04 Oct 2017 17:53:42 -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 y127sm887691pgb.60.2017.10.04.17.53.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:53:41 -0700 (PDT) Date: Wed, 4 Oct 2017 17:53:40 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Message-ID: <20171005005340.GA23810@beast> MIME-Version: 1.0 Content-Disposition: inline Cc: alsa-devel@alsa-project.org, Thomas Gleixner , Takashi Iwai Subject: [alsa-devel] [PATCH] sound/pci/asihpi: 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. Cc: Jaroslav Kysela Cc: Takashi Iwai 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/pci/asihpi/asihpi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 70d023a85bf5..614322171c79 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -749,9 +749,9 @@ static inline unsigned int modulo_min(unsigned int a, unsigned int b, /** Timer function, equivalent to interrupt service routine for cards */ -static void snd_card_asihpi_timer_function(unsigned long data) +static void snd_card_asihpi_timer_function(struct timer_list *t) { - struct snd_card_asihpi_pcm *dpcm = (struct snd_card_asihpi_pcm *)data; + struct snd_card_asihpi_pcm *dpcm = from_timer(dpcm, t, timer); struct snd_pcm_substream *substream = dpcm->substream; struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime; @@ -948,7 +948,7 @@ static void snd_card_asihpi_int_task(unsigned long data) asihpi = (struct snd_card_asihpi *)a->snd_card->private_data; if (asihpi->llmode_streampriv) snd_card_asihpi_timer_function( - (unsigned long)asihpi->llmode_streampriv); + &asihpi->llmode_streampriv->timer); } static void snd_card_asihpi_isr(struct hpi_adapter *a) @@ -1059,8 +1059,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) If internal and other stream playing, can't switch */ - setup_timer(&dpcm->timer, snd_card_asihpi_timer_function, - (unsigned long) dpcm); + timer_setup(&dpcm->timer, snd_card_asihpi_timer_function, 0); dpcm->substream = substream; runtime->private_data = dpcm; runtime->private_free = snd_card_asihpi_runtime_free; @@ -1240,8 +1239,7 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) if (err) return -EIO; - setup_timer(&dpcm->timer, snd_card_asihpi_timer_function, - (unsigned long) dpcm); + timer_setup(&dpcm->timer, snd_card_asihpi_timer_function, 0); dpcm->substream = substream; runtime->private_data = dpcm; runtime->private_free = snd_card_asihpi_runtime_free;