Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5167753yba; Wed, 10 Apr 2019 12:55:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxy+6IvrPzLRUlBWugfBFbi5rmp0DW3t4mp5lfMo28FpP6g8ryJvexzFHM2lqNVy+yMg5j4 X-Received: by 2002:a17:902:846:: with SMTP id 64mr45965677plk.266.1554926104138; Wed, 10 Apr 2019 12:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554926104; cv=none; d=google.com; s=arc-20160816; b=H5sBR7vTXoQTsO+QhvbrzpmRGs5QQlWaIY/xAMvoI0084Bccb+HZq4Mvlf8OV+YmCW 8I8YCDvdB252kVn6kUPZbvOg464qoAItYKo8ZEcb4s2H8leRXtyTM0WFp116vbRvQ0le FmXtmcQW07452iE0KLzvsaO7blLFbhUEQg4RnYLxuIqYQbdxhYu11z40hBJEz3e4Jakk fv0vzn/qCCVHa7v/jojANbQJ1kr0lJttbkuXE63XxKjIy4uXDYNiJ2O6NQNn7E1KnmBH ZVFRKn6PWYTBGatfn9IUCQk2kWebq3njmcYFdIO4Ms5HXLNYNPKLu3mZrky1eLED/1Vp AAFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8RnvvGONpc1znN6tehKhO4srMrP2MiULHwMPLq6oZTE=; b=KF8VeG6GOP2N/dVProw+qc8qQITYUjBiWWIpL/598UdHtjcLL9dKgY54RfkzjEfiYF Q7OXRAZse1IarV3WJBgzINDME/Y+5WMS3QdXHFM17jATNTCIUl6CDbUoj9osOxp4wWXN u+CAuiC+B7nnD/prqwBa01dm686UfFhuoEBYMg+cNiQVS402KlHDsM0qPtd0d1LDN2W5 Z+MxyrHfkpC92UMkXAYq1kY1m/VUGMgihnC5k1GYRLuwfVeyeog88D2PvWY9EynhtDVj sW38Yz010VcBWe9DgjvisU/oSt6A+yUEB19sxl2+ETX8RKLYXcfFfcIdrmPVaZWbHXTD 8lsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=N9vk8EAm; 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 l32si32932651pgm.130.2019.04.10.12.54.48; Wed, 10 Apr 2019 12:55:04 -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=fail header.i=@gmail.com header.s=20161025 header.b=N9vk8EAm; 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 S1726655AbfDJTyM (ORCPT + 99 others); Wed, 10 Apr 2019 15:54:12 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43973 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbfDJTyM (ORCPT ); Wed, 10 Apr 2019 15:54:12 -0400 Received: by mail-pg1-f193.google.com with SMTP id z9so2158632pgu.10; Wed, 10 Apr 2019 12:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8RnvvGONpc1znN6tehKhO4srMrP2MiULHwMPLq6oZTE=; b=N9vk8EAmD7Lq+Rmyo9UfsJtulMoudjAc9zcmCkwKRu51lIX3pBludaGgbGZmgg+2bJ 2fwBWiz2JP1d9dn19m6kxjv76TVXpL2byYF0AjBh5oWlDz4p6xtB0iB2GGE1f8EIZOFJ S+xeTL7FYZvHkzWP3U5i03bm3a5+eCLI4cuTiQllBKqz6smT6VcQ8K3G0s2zudxa5d4e lJLtqkEQWgrr47s7E+MvUd4r+xIDtejv9fnKek5XAYgdiCpc/UyoLBGSae+hP6b42kxk i17dwBca6hRYdX4JTCvlGLSJZUBwvbuphsTFPKZXh/jqEwtblSyiRDXytJAms3b1KEc4 mA8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=8RnvvGONpc1znN6tehKhO4srMrP2MiULHwMPLq6oZTE=; b=KS2JsOa0BD8E9y0TgrIBWgmAr6+N5g28cwDPrrFStlxpBV8NLV3kAZSM+TCHgRlbzh Ys5MRUd/m1b0yazgXBS5dOXAGOQBB5f5v2ifo9X2qfeyUJw4oNW3Dh7NVNHHdKK4mxch 3HjMsTqZH5RRRU+326hMVGfvR48mhoQGWcwH4LvuqEiNbBOFdEQkr76XS4ZipDjXf7YJ UZcd5YZw+KmHAjuHgwr4dsOEl/Ki0ilsXkCyz8myyDRI8glNhc2bE213fM9HqGHFVCmw TkZIRZQGsoVkrQf6z0eJ37586ZiBXWMQfThpHpmZyp82dC6XTtI8M6glBcsGS+F2jR0y 7qkg== X-Gm-Message-State: APjAAAX7jbnImE5eiGVOAhjT3MWWKACFXO0WZdOhCksmw2JIMK7y/AoI 6gYbPQXFQicCZuiv1o5lM74= X-Received: by 2002:a63:2b4c:: with SMTP id r73mr43673385pgr.181.1554926051864; Wed, 10 Apr 2019 12:54:11 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 143sm71833340pge.50.2019.04.10.12.54.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 12:54:10 -0700 (PDT) Date: Wed, 10 Apr 2019 12:54:09 -0700 From: Guenter Roeck To: Joe Perches Cc: Wim Van Sebroeck , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Brugger Subject: Re: [PATCH 18/22] watchdog: mt7621_wdt: Use 'dev' instead of dereferencing it repeatedly Message-ID: <20190410195409.GA29802@roeck-us.net> References: <1554913683-25454-1-git-send-email-linux@roeck-us.net> <1554913683-25454-19-git-send-email-linux@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 10, 2019 at 11:46:24AM -0700, Joe Perches wrote: > On Wed, 2019-04-10 at 09:27 -0700, Guenter Roeck wrote: > > Introduce local variable 'struct device *dev' and use it instead of > > dereferencing it repeatedly. > > > > The conversion was done automatically with coccinelle using the > > following semantic patches. The semantic patches and the scripts > > used to generate this commit log are available at > > https://github.com/groeck/coccinelle-patches > > Interesting collection. It would be useful to specify which > particular script generated or enabled this patch. > It is pdev-addvar.cocci, rule 'new'. deref.cocci wasn't used for the watchdog patches. The script to apply the various rules is watchdog/make.sh. Pointing to the actual scripts used is a good idea. I'll see if I can add this for subsequent series. After all, the commit log is also auto-generated, so this should be straightforward. > Just scanning briefly, it might have been this one: > https://github.com/groeck/coccinelle-patches/blob/master/common/deref.cocci > But it looks like some manual bit might have been required too. Not for this one. There were a couple of situations where I had to manually split long lines to avoid checkpatch warnings, and I manually updated a few of the commit logs, but not in this patch. > > And trivially: > > > diff --git a/drivers/watchdog/mt7621_wdt.c b/drivers/watchdog/mt7621_wdt.c > [] > > @@ -133,18 +133,19 @@ static struct watchdog_device mt7621_wdt_dev = { > [] > > watchdog_init_timeout(&mt7621_wdt_dev, mt7621_wdt_dev.max_timeout, > > - &pdev->dev); > > + dev); > > This could be on one line. > Coccinelle isn't perfect. The rule doesn't modify the entire argument list, only the last argument, so coccinelle missed that it could have merged the two lines into one. A checkpatch rule suggesting that multiple extension lines can be merged might be useful to help finding such situations. Just a thought. Thanks, Guenter