From patchwork Tue Oct 24 14:18:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10024677 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 27A2C6035E for ; Tue, 24 Oct 2017 14:19:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1806927F54 for ; Tue, 24 Oct 2017 14:19:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07A2E2862D; Tue, 24 Oct 2017 14:19:33 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5803328520 for ; Tue, 24 Oct 2017 14:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=cODSfC5jtm3Zbp233GGCoMpE2zDpW2rO597dyxX3su0=; b=EaOX98QlLHbpHW fdegLp3bvVnf35iOhPIE/8Eu/dMiHLJdR/lWTci3gghcb7c/9ilDvNJDhEr7wFt2gU0qQj63wbjlJ i8ZVfANxrZgHr3qfbQRNJEejAUTsHz05puxde/EapOOdj8lRQOcyF7B4hB1/xtcucvYyUvHEqSpir EIcz8ogTXpwXJQvsWlNE5gjsvVj3rKy4emaTfaPkOdiBIAq1wv+0+HFtE79kisKE+tIEBLrPgAxgh BfNioMTeuY24vLUnOrB+MJc8TBUiunB5qGKQPpoB2tfvNezwCKuFrXKTAoagtB9TAoqKe0A/QK4lZ fK/KlfhRNW02upt+eLeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e703C-0006zm-6q; Tue, 24 Oct 2017 14:19:26 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e7037-0006ov-Kr for linux-arm-kernel@lists.infradead.org; Tue, 24 Oct 2017 14:19:24 +0000 Received: by mail-pf0-x242.google.com with SMTP id t188so19793174pfd.10 for ; Tue, 24 Oct 2017 07:19:00 -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=mkIELtF/p7XdzDOIDoMABKAsf7lnZtxjJJpbZS3TvUg=; b=dkHquhdKA12ZKEvngbrJ9IjdBawsaRSKdvEEEXRv9sH7viF+jVVIbIUdiRPcLOISEV tT4hp2prf0jIE2C7j+lVjpFoWIDu1+wFf4yVGeZArf+uW+5LDrpEDtvYawfy9m2Bu8r/ ZSncuzH+WrIB43Z0BWN0eK906Zf0efSTfF0l0= 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=mkIELtF/p7XdzDOIDoMABKAsf7lnZtxjJJpbZS3TvUg=; b=Duf9gpVeKg7DhTQjrSlp2XruUlaZjzzMmOCmqBcWzty9z0Vf2B7Z8As8tSm2tV18iT XD0V/srMZuwe35PY1vlDGO08sFDs1hWfa9dcgw70VRP/ic8W8mCYdl3bgixH+Tk/enKI Pn2Cd9Fd1IdWjn9HDfKkB93HuqtW+UzVIHtWEnF/HkhK/yIp9l7uh3ghzwQIihwGIkuw Wctjui66zg4w9VGd74kMDJmt/LBefO6YXN1Dq9EtdeTCRUsjF18FSW4jMT4JO0ngup+t NjXAJD+ePgILoX38bx3gB9d6wjPPK4KP4LFZEmnYe3Ul4f8HZAyH2+cV2wsw3WxLtx3O PQ4A== X-Gm-Message-State: AMCzsaU9Rl7Iku15jUgiCLqf2mNtW24JBC0v6KJpijK3kaY0qgUYRNvW 1iiX7eW5ELMhW0/DQmxF7k4GOg== X-Google-Smtp-Source: ABhQp+Rrgg2zGb+QxUkQkpXQdoLNhBxC5vs7SS2Pmen5TLAwzhrp4Tz7wfOqXJ2iPxZQ8s2jMwsm+w== X-Received: by 10.99.127.89 with SMTP id p25mr14774523pgn.196.1508854740445; Tue, 24 Oct 2017 07:19:00 -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 q13sm660928pgt.87.2017.10.24.07.18.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 07:18:59 -0700 (PDT) Date: Tue, 24 Oct 2017 07:18:58 -0700 From: Kees Cook To: Dmitry Torokhov Subject: [PATCH] Input: touchscreen: Convert timers to use timer_setup() Message-ID: <20171024141858.GA78061@beast> MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171024_071921_799293_C5D19F59 X-CRM114-Status: GOOD ( 13.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ferruh Yigit , Michael Hennerich , Wan ZongShun , linux-kernel@vger.kernel.org, Guenter Roeck , linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: Michael Hennerich Cc: Dmitry Torokhov Cc: Ferruh Yigit Cc: Wan ZongShun Cc: Guenter Roeck Cc: linux-input@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook --- drivers/input/touchscreen/ad7877.c | 6 +++--- drivers/input/touchscreen/ad7879.c | 6 +++--- drivers/input/touchscreen/atmel-wm97xx.c | 10 ++++++---- drivers/input/touchscreen/cyttsp4_core.c | 7 +++---- drivers/input/touchscreen/tsc200x-core.c | 6 +++--- drivers/input/touchscreen/w90p910_ts.c | 7 +++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index 9c250ae780d9..0381c7809d1b 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c @@ -385,9 +385,9 @@ static inline void ad7877_ts_event_release(struct ad7877 *ts) input_sync(input_dev); } -static void ad7877_timer(unsigned long handle) +static void ad7877_timer(struct timer_list *t) { - struct ad7877 *ts = (void *)handle; + struct ad7877 *ts = from_timer(ts, t, timer); unsigned long flags; spin_lock_irqsave(&ts->lock, flags); @@ -718,7 +718,7 @@ static int ad7877_probe(struct spi_device *spi) ts->spi = spi; ts->input = input_dev; - setup_timer(&ts->timer, ad7877_timer, (unsigned long) ts); + timer_setup(&ts->timer, ad7877_timer, 0); mutex_init(&ts->mutex); spin_lock_init(&ts->lock); diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 7d74a0ae2c94..6bad23ee47a1 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -237,9 +237,9 @@ static void ad7879_ts_event_release(struct ad7879 *ts) input_sync(input_dev); } -static void ad7879_timer(unsigned long handle) +static void ad7879_timer(struct timer_list *t) { - struct ad7879 *ts = (void *)handle; + struct ad7879 *ts = from_timer(ts, t, timer); ad7879_ts_event_release(ts); } @@ -570,7 +570,7 @@ int ad7879_probe(struct device *dev, struct regmap *regmap, ts->irq = irq; ts->regmap = regmap; - setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts); + timer_setup(&ts->timer, ad7879_timer, 0); snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev)); input_dev->name = "AD7879 Touchscreen"; diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c index 8cf0b2be2df4..9140a43cfe20 100644 --- a/drivers/input/touchscreen/atmel-wm97xx.c +++ b/drivers/input/touchscreen/atmel-wm97xx.c @@ -208,9 +208,12 @@ static void atmel_wm97xx_acc_pen_up(struct wm97xx *wm) } } -static void atmel_wm97xx_pen_timer(unsigned long data) +static void atmel_wm97xx_pen_timer(struct timer_list *t) { - atmel_wm97xx_acc_pen_up((struct wm97xx *)data); + struct atmel_wm97xx *atmel_wm97xx = from_timer(atmel_wm97xx, t, + pen_timer); + + atmel_wm97xx_acc_pen_up(atmel_wm97xx->wm); } static int atmel_wm97xx_acc_startup(struct wm97xx *wm) @@ -348,8 +351,7 @@ static int __init atmel_wm97xx_probe(struct platform_device *pdev) atmel_wm97xx->gpio_pen = atmel_gpio_line; atmel_wm97xx->gpio_irq = gpio_to_irq(atmel_wm97xx->gpio_pen); - setup_timer(&atmel_wm97xx->pen_timer, atmel_wm97xx_pen_timer, - (unsigned long)wm); + timer_setup(&atmel_wm97xx->pen_timer, atmel_wm97xx_pen_timer, 0); ret = request_irq(atmel_wm97xx->ac97c_irq, atmel_wm97xx_channel_b_interrupt, diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index beaf61ce775b..e7710397e0ad 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1237,9 +1237,9 @@ static void cyttsp4_stop_wd_timer(struct cyttsp4 *cd) del_timer_sync(&cd->watchdog_timer); } -static void cyttsp4_watchdog_timer(unsigned long handle) +static void cyttsp4_watchdog_timer(struct timer_list *t) { - struct cyttsp4 *cd = (struct cyttsp4 *)handle; + struct cyttsp4 *cd = from_timer(cd, t, watchdog_timer); dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__); @@ -2074,8 +2074,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops, } /* Setup watchdog timer */ - setup_timer(&cd->watchdog_timer, cyttsp4_watchdog_timer, - (unsigned long)cd); + timer_setup(&cd->watchdog_timer, cyttsp4_watchdog_timer, 0); /* * call startup directly to ensure that the device diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index 88ea5e1b72ae..542db26d7fd0 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c @@ -202,9 +202,9 @@ static irqreturn_t tsc200x_irq_thread(int irq, void *_ts) return IRQ_HANDLED; } -static void tsc200x_penup_timer(unsigned long data) +static void tsc200x_penup_timer(struct timer_list *t) { - struct tsc200x *ts = (struct tsc200x *)data; + struct tsc200x *ts = from_timer(ts, t, penup_timer); unsigned long flags; spin_lock_irqsave(&ts->lock, flags); @@ -506,7 +506,7 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, mutex_init(&ts->mutex); spin_lock_init(&ts->lock); - setup_timer(&ts->penup_timer, tsc200x_penup_timer, (unsigned long)ts); + timer_setup(&ts->penup_timer, tsc200x_penup_timer, 0); INIT_DELAYED_WORK(&ts->esd_work, tsc200x_esd_work); diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c index da6004e97753..638c1d78ca3a 100644 --- a/drivers/input/touchscreen/w90p910_ts.c +++ b/drivers/input/touchscreen/w90p910_ts.c @@ -146,9 +146,9 @@ static irqreturn_t w90p910_ts_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static void w90p910_check_pen_up(unsigned long data) +static void w90p910_check_pen_up(struct timer_list *t) { - struct w90p910_ts *w90p910_ts = (struct w90p910_ts *) data; + struct w90p910_ts *w90p910_ts = from_timer(w90p910_ts, t, timer); unsigned long flags; spin_lock_irqsave(&w90p910_ts->lock, flags); @@ -232,8 +232,7 @@ static int w90x900ts_probe(struct platform_device *pdev) w90p910_ts->input = input_dev; w90p910_ts->state = TS_IDLE; spin_lock_init(&w90p910_ts->lock); - setup_timer(&w90p910_ts->timer, w90p910_check_pen_up, - (unsigned long)w90p910_ts); + timer_setup(&w90p910_ts->timer, w90p910_check_pen_up, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) {