Received: by 10.223.164.221 with SMTP id h29csp405156wrb; Tue, 24 Oct 2017 02:37:23 -0700 (PDT) X-Received: by 10.84.240.6 with SMTP id y6mr12201068plk.78.1508837843159; Tue, 24 Oct 2017 02:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508837843; cv=none; d=google.com; s=arc-20160816; b=iftN9SwNeMFioXeqO8Ch76ayxUVZ+UsS/09cXzDWBebTYdO05t0zB4iZ/WJB2UUXQP ta82mlm9g2ncuUhytM7Hhn96H0udCuy2jkKmtsFTVjnMYuJsF1/TybHB5dm/kOMDdpLE 8os3mhfyD9zeMh2nZp3/jN0rzQvnbPiFYSwRrsO2Gi8ogbxFD5CGjEVuz4sbl/pFao61 uNEfWVfuR6ZDqS32N69Z+zKxCu611BsQEOfRCteqhNSwZ6jLjzG21v37f8/LK1ykOVDg JKuMmZlqO23Oq9sFL7SCsbDp/0zydo6NWeE2rgQBZwjbB9Ays7/KNumK02NPLAJ/H9VE JzXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=lRI2X27yBLAt+0CtDNePjfuQn1ktQT0NIINRWL+rt+w=; b=RHLxNbDCZoHmFHqBqVzSmxf5kKGTUFEGcG7cMfjn7FUlPteojNCxJld7PATM1uPCsM Ab9X+L+fHk5TrCGfwNFFzKtLCcz9/8ALK2OFx9K1x+at5aj+Kgi2hZvNRSsDYRHdXXOS ntY/9YI1IP9SGgB1OWPvNz9awwO3n8dAfpOKyrD3x2F/L+D16GIK2vbay7G2f9GAKA3e +hMzD+l/TCLTd2TFBPS228ghPdPrQ7RuwAFKx/y1kMZAZG7eQEzoooEVzqDrCKBCfOKE RQmiKm+zPGZnzolRXDO8+nDX0cmFKE1N6mMgHxVBMg4SXenQbQe6cXpoyoo4LXovXZMd QarA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=zsCFjnF8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si5048559pln.769.2017.10.24.02.37.08; Tue, 24 Oct 2017 02:37:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=zsCFjnF8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932458AbdJXJfV (ORCPT + 99 others); Tue, 24 Oct 2017 05:35:21 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:54032 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932287AbdJXJfO (ORCPT ); Tue, 24 Oct 2017 05:35:14 -0400 Received: by mail-wm0-f68.google.com with SMTP id r196so1992380wmf.2 for ; Tue, 24 Oct 2017 02:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lRI2X27yBLAt+0CtDNePjfuQn1ktQT0NIINRWL+rt+w=; b=zsCFjnF8YTbIEADriNIuyC6urtultuzJoWLgB3bQ1tL02hXoFHLOplZu7FSCa8O883 xflqEHCf0iQ8js2tVvou+NpHgoRfdcX0QwCo7X4LPikpKRqomN1MyjqrM2FzxCWzqSdC xBN1y57gnSg3DTOL2Lm1H3u8o872akpcrwnvRM5yasD3uGvgbo3CAxccq//oxsJNGh5a luB6ezUGgnafBMKlIrey/PqAbQqeva8dYsCEU3L3Q6zSWBLPH3zXcJ8XXxBZTD6cy5ol /ZbnsTh2BqgQiTU/BoOSc0ouktyTwgX9l8L7k5tFN1leeY4joFYssX12TAyQtyFoL2uG 0y+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lRI2X27yBLAt+0CtDNePjfuQn1ktQT0NIINRWL+rt+w=; b=uWsPvwQq+gNUEt1yTT8BvSC0Wyc8ld14ixdvBffRPmwkvhN9xHZq+FCkaIylpHWDNz eiGmWcnoWmAb8Syq+BlKnuZau6bB/zclty8XqAuu4xmcyC+CQ3C9LsRWdjkw0mawiuuU D6Sl7CWmBt+3LwqnWhv8pwLiVArOcVjEjl3zO5CESTBxvGdNZJXlkvOgAExHTFdJCcFh jO2ORFQsilsqPxvProZGjzKXykzHrOn/+bqFaopRLa/4m/w0hTK94jGuIqJNaQWZ3hQg uMgonHnFfytwcwAXcEXi5wk8a57fanm2zpIgoYG4pYVkj4PFG8bu/9bIkg3DoLKuAc1s KPPg== X-Gm-Message-State: AMCzsaUkx6UZ3JQLokc1euguYyczKXbj5WoT+xTvLohA1/H3xneHlJWD CcsiFw568aTUD1FH+GDXtf5B1i/KNRc= X-Google-Smtp-Source: ABhQp+QsTF+KQSVutdbqDd3/3i3SeK89Nq9NNfl9kFBk1h14SSTwD6V1xN/a2hrUp4FfaveRB+xCUw== X-Received: by 10.80.140.203 with SMTP id r11mr19158168edr.299.1508837712572; Tue, 24 Oct 2017 02:35:12 -0700 (PDT) Received: from [192.168.192.35] ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id r15sm8228158edi.52.2017.10.24.02.35.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 02:35:12 -0700 (PDT) Subject: Re: [PATCH] staging: greybus: Convert timers to use timer_setup() To: Kees Cook , Greg Kroah-Hartman Cc: Johan Hovold , Alex Elder , greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org References: <20171024082550.GA142933@beast> From: Bryan O'Donoghue Message-ID: <3caa07a1-4f46-d879-cfec-586addc006af@nexus-software.ie> Date: Tue, 24 Oct 2017 10:35:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20171024082550.GA142933@beast> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/10/17 09:25, Kees Cook wrote: > 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: Greg Kroah-Hartman > Cc: "Bryan O'Donoghue" > Cc: Johan Hovold > Cc: Alex Elder > Cc: greybus-dev@lists.linaro.org > Cc: devel@driverdev.osuosl.org > Signed-off-by: Kees Cook > --- > drivers/staging/greybus/loopback.c | 14 ++++---------- > drivers/staging/greybus/operation.c | 7 +++---- > 2 files changed, 7 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c > index 08e255884206..045aaf81113a 100644 > --- a/drivers/staging/greybus/loopback.c > +++ b/drivers/staging/greybus/loopback.c > @@ -572,16 +572,11 @@ static void gb_loopback_async_operation_work(struct work_struct *work) > gb_loopback_async_operation_put(op_async); > } > > -static void gb_loopback_async_operation_timeout(unsigned long data) > +static void gb_loopback_async_operation_timeout(struct timer_list *t) > { > - struct gb_loopback_async_operation *op_async; > - u16 id = data; > + struct gb_loopback_async_operation *op_async = > + from_timer(op_async, t, timer); > > - op_async = gb_loopback_operation_find(id); > - if (!op_async) { > - pr_err("operation %d not found - time out ?\n", id); > - return; > - } Hi Kees, you need to add gb_loopback_async_operation_get(op_async); when dropping the gb_loopback_operation_find() call here. > schedule_work(&op_async->work); > } > > @@ -631,8 +626,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, > if (ret) > goto error; > > - setup_timer(&op_async->timer, gb_loopback_async_operation_timeout, > - (unsigned long)operation->id); > + timer_setup(&op_async->timer, gb_loopback_async_operation_timeout, 0); > op_async->timer.expires = jiffies + gb->jiffy_timeout; > add_timer(&op_async->timer); > > diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c > index 3023012808d9..ee4ba3f23bef 100644 > --- a/drivers/staging/greybus/operation.c > +++ b/drivers/staging/greybus/operation.c > @@ -294,9 +294,9 @@ static void gb_operation_work(struct work_struct *work) > gb_operation_put(operation); > } > > -static void gb_operation_timeout(unsigned long arg) > +static void gb_operation_timeout(struct timer_list *t) > { > - struct gb_operation *operation = (void *)arg; > + struct gb_operation *operation = from_timer(operation, t, timer); > > if (gb_operation_result_set(operation, -ETIMEDOUT)) { > /* > @@ -541,8 +541,7 @@ gb_operation_create_common(struct gb_connection *connection, u8 type, > goto err_request; > } > > - setup_timer(&operation->timer, gb_operation_timeout, > - (unsigned long)operation); > + timer_setup(&operation->timer, gb_operation_timeout, 0); > } > > operation->flags = op_flags; > Other than that, the rest looks good to me and you can add my Reviewed-by: Bryan O'Donoghue From 1582126742408023281@xxx Tue Oct 24 08:27:19 +0000 2017 X-GM-THRID: 1582126742408023281 X-Gmail-Labels: Inbox,Category Forums