From patchwork Mon Oct 30 21:45:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10033301 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 7553B600C5 for ; Mon, 30 Oct 2017 21:45:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66F9D28945 for ; Mon, 30 Oct 2017 21:45:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BF6E28949; Mon, 30 Oct 2017 21:45:20 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D53D028945 for ; Mon, 30 Oct 2017 21:45:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933192AbdJ3VpF (ORCPT ); Mon, 30 Oct 2017 17:45:05 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:56382 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932732AbdJ3VpD (ORCPT ); Mon, 30 Oct 2017 17:45:03 -0400 Received: by mail-pf0-f196.google.com with SMTP id b85so12051178pfj.13 for ; Mon, 30 Oct 2017 14:45:03 -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=eOl23G9ABdraBE6XKSMLueS+sBmKLl0N/tuOcvbke2A=; b=ER88HJ6zw31fa8Zku4k+x5clsVwlc66Evj2Bip+XiijrjUaCWAayXrytx1GhDqgdFt iVG4qb2lfev5Sv07gw8HY1K1HREoQq1PwwNdra4kwdHMAD79t+ZTSEjRn5KmPC/WA3eG vnti9dxQS8pPlegqSH7Srsw2TgcNZC58UgnEc= 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=eOl23G9ABdraBE6XKSMLueS+sBmKLl0N/tuOcvbke2A=; b=cqSbf++MseDT+pG6cyF23BLBP75i21daLsb25zy5dU8/KAo4fsoMC+K0e2P7ERWQqA WxJgs7qNCl2DkVORw4PM+ow0bc+FTROxKxaENoUHhBivj+3AArLbzQyqK6j+m/grwpb1 BcASAtxjDriJiz9si+nKQgciLT9XTdiNTJq0GK41YZb9r16sG8AGHAozUUr1OUn2iC5d 0wvu/KktxALNk6OCBfLhnNhgSI3xk/ea35VNMjglieeA7HrK096+vyIUPRGdArKh0TGG wpAfWwW6CC7oYRGp+Bj+rsrA67U0xVXI9INijQJvWhGG5vUMoMwSTRAhTaIS0n+L8Ao4 7mWg== X-Gm-Message-State: AMCzsaXDgbft9WmgOAQnAO4CjdamdksZkU3+aPh2mTrcUvHggSK0lCvB IKfIM0g4pOBqZ0pKQJK0KSHV5PTVgYM= X-Google-Smtp-Source: ABhQp+R/a6vUaGbvaEv6KGvPh5SOIuUnDXY6/0C/Xh4riTvGtOXzMEKAAzSCenwYCBXJeDoUTLAWvQ== X-Received: by 10.84.210.202 with SMTP id a68mr1563262pli.317.1509399902889; Mon, 30 Oct 2017 14:45:02 -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 m74sm32631908pfi.2.2017.10.30.14.45.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 14:45:01 -0700 (PDT) Date: Mon, 30 Oct 2017 14:45:00 -0700 From: Kees Cook To: Ulf Hansson Cc: Jaehoon Chung , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: dw_mmc: Convert timers to use timer_setup() Message-ID: <20171030214500.GA72041@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.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: Jaehoon Chung Cc: Ulf Hansson Cc: linux-mmc@vger.kernel.org Signed-off-by: Kees Cook --- drivers/mmc/host/dw_mmc.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 37b55b095daf..0aa39975f33b 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2991,9 +2991,9 @@ static void dw_mci_init_dma(struct dw_mci *host) host->use_dma = TRANS_MODE_PIO; } -static void dw_mci_cmd11_timer(unsigned long arg) +static void dw_mci_cmd11_timer(struct timer_list *t) { - struct dw_mci *host = (struct dw_mci *)arg; + struct dw_mci *host = from_timer(host, t, cmd11_timer); if (host->state != STATE_SENDING_CMD11) { dev_warn(host->dev, "Unexpected CMD11 timeout\n"); @@ -3005,9 +3005,9 @@ static void dw_mci_cmd11_timer(unsigned long arg) tasklet_schedule(&host->tasklet); } -static void dw_mci_cto_timer(unsigned long arg) +static void dw_mci_cto_timer(struct timer_list *t) { - struct dw_mci *host = (struct dw_mci *)arg; + struct dw_mci *host = from_timer(host, t, cto_timer); unsigned long irqflags; u32 pending; @@ -3060,9 +3060,9 @@ static void dw_mci_cto_timer(unsigned long arg) spin_unlock_irqrestore(&host->irq_lock, irqflags); } -static void dw_mci_dto_timer(unsigned long arg) +static void dw_mci_dto_timer(struct timer_list *t) { - struct dw_mci *host = (struct dw_mci *)arg; + struct dw_mci *host = from_timer(host, t, dto_timer); unsigned long irqflags; u32 pending; @@ -3257,14 +3257,9 @@ int dw_mci_probe(struct dw_mci *host) } } - setup_timer(&host->cmd11_timer, - dw_mci_cmd11_timer, (unsigned long)host); - - setup_timer(&host->cto_timer, - dw_mci_cto_timer, (unsigned long)host); - - setup_timer(&host->dto_timer, - dw_mci_dto_timer, (unsigned long)host); + timer_setup(&host->cmd11_timer, dw_mci_cmd11_timer, 0); + timer_setup(&host->cto_timer, dw_mci_cto_timer, 0); + timer_setup(&host->dto_timer, dw_mci_dto_timer, 0); spin_lock_init(&host->lock); spin_lock_init(&host->irq_lock);