From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751394AbeABPek (ORCPT + 1 other); Tue, 2 Jan 2018 10:34:40 -0500 Received: from smtprelay0140.hostedemail.com ([216.40.44.140]:60831 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751047AbeABPef (ORCPT ); Tue, 2 Jan 2018 10:34:35 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: part73_279926d0e1d0e X-Filterd-Recvd-Size: 3498 Message-ID: <1514907270.31497.0.camel@perches.com> Subject: Re: [PATCH] scripts: Add device_attr_.pl scripts to convert DEVICE_ATTR uses From: Joe Perches To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Julia Lawall Date: Tue, 02 Jan 2018 07:34:30 -0800 In-Reply-To: <20171223141929.GA6228@kroah.com> References: <863ff80559b868614cd965b431b07a99ca52509a.1513972839.git.joe@perches.com> <20171223141929.GA6228@kroah.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sat, 2017-12-23 at 15:19 +0100, Greg Kroah-Hartman wrote: > On Fri, Dec 22, 2017 at 12:02:47PM -0800, Joe Perches wrote: > > There are many uses of the DEVICE_ATTR(var, perms, show, store) > > declaration macro that could use one of the convenience macros > > DEVICE_ATTR_RW, DEVICE_ATTR_RO, or DEVICE_ATTR_WO. > > > > These scripts automate those conversions. Hey Greg. Are you going to use these scripts? > > Many declarations of functions used to show or store the values > > do not use the _show and _store form. These scripts > > also check to see if the normal form is unused in the file, that > > the currently named functions are static and only used as the > > function definition and the macro declaration and convert the > > unusual function name to the more normal style. > > > > Use these scripts with a list of files to be converted. > > > > e.g.: git ls-files -- "*.c" | xargs perl -i scripts/device_attr_rw.pl > > > > Here are the current uses of DEVICE_ATTR macros in next-20171222 > > > > $ git grep -w -P "DEVICE_ATTR(_RW|_RO|_WO|)" -- "*.c" | wc -l > > 3393 > > $ git grep -w -P "DEVICE_ATTR" -- "*.c" | wc -l > > 2052 > > $ git grep -w -P "DEVICE_ATTR_RW" -- "*.c" | wc -l > > 456 > > $ git grep -w -P "DEVICE_ATTR_RO" -- "*.c" | wc -l > > 821 > > $ git grep -w -P "DEVICE_ATTR_WO" -- "*.c" | wc -l > > 64 > > > > If these scripts on run on that tag, there are 1490 conversions done > > > > $ git grep -w --name-only DEVICE_ATTR -- "*.c" | \ > > xargs perl -i scripts/device_attr_rw.pl > > $ git grep -w --name-only DEVICE_ATTR -- "*.c" | \ > > xargs perl -i scripts/device_attr_ro.pl > > $ git grep -w --name-only DEVICE_ATTR -- "*.c" | \ > > xargs perl -i scripts/device_attr_wo.pl > > > > $ git grep -w -P "DEVICE_ATTR(_RW|_RO|_WO|)" -- "*.c" | wc -l > > 3393 > > $ git grep -w -P "DEVICE_ATTR" -- "*.c" | wc -l > > 562 > > $ git grep -w -P "DEVICE_ATTR_RW" -- "*.c" | wc -l > > 924 > > $ git grep -w -P "DEVICE_ATTR_RO" -- "*.c" | wc -l > > 1727 > > $ git grep -w -P "DEVICE_ATTR_WO" -- "*.c" | wc -l > > 180 > > > > Signed-off-by: Joe Perches > > > > 1727 > > ith '#' will be ignored, and an empty message aborts the commit. > > --- > > scripts/device_attr_ro.pl | 57 ++++++++++++++++++++++++++++++++++++++++ > > scripts/device_attr_rw.pl | 66 +++++++++++++++++++++++++++++++++++++++++++++++ > > scripts/device_attr_wo.pl | 57 ++++++++++++++++++++++++++++++++++++++++ > > We should just fix up all in-kernel users, no need to put the scripts in > the kernel source tree, right? > > thanks, > > greg k-h