From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755326AbdLTN0c (ORCPT ); Wed, 20 Dec 2017 08:26:32 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:3745 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754746AbdLTN00 (ORCPT ); Wed, 20 Dec 2017 08:26:26 -0500 X-IronPort-AV: E=Sophos;i="5.45,432,1508796000"; d="scan'208";a="306312158" Date: Wed, 20 Dec 2017 14:26:18 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Joe Perches cc: Greg Kroah-Hartman , Julia Lawall , Jarkko Nikula , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Cezary Jackiewicz , Darren Hart , Andy Shevchenko , Sebastian Ott , Peter Oberparleiter , James Smart , Dick Kennedy , Zhang Rui , Eduardo Valentin , Mathias Nyman , Felipe Balbi , "Luis R. Rodriguez" , Peter Ujfalusi , Martin Schwidefsky , Heiko Carstens , David Airlie , "James E.J. Bottomley" , "Martin K. Petersen" , Jiri Slaby , Bartlomiej Zolnierkiewicz , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org, linux-serial@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org, linux-omap@vger.kernel.org Subject: Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW In-Reply-To: <1513767307.1234.114.camel@perches.com> Message-ID: References: <20171220083403.GA27231@bitmer.com> <1513761884.1234.83.camel@perches.com> <20171220093211.GA16177@kroah.com> <1513763681.1234.101.camel@perches.com> <20171220095926.GA24285@kroah.com> <1513767307.1234.114.camel@perches.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Dec 2017, Joe Perches wrote: > On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote: > > > > Why you didn't send that patch to the sysfs maintainer is a bit odd... :) > > > > > > So here's an opportunity for you: > > > > > > The sysfs maintainer hasn't added include/linux/sysfs.h to > > > the list of maintained files... > > > > > > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS > > > M: Greg Kroah-Hartman > > > T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git > > > S: Supported > > > F: Documentation/kobject.txt > > > F: drivers/base/ > > > F: fs/debugfs/ > > > F: fs/sysfs/ > > > F: include/linux/debugfs.h > > > F: include/linux/kobj* > > > F: lib/kobj* > > > > Heh, good point, but using get_maintainer.pl does put me at the top of > > the list that you should be cc:ing: > > > > $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h > > Greg Kroah-Hartman (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%) > > Kate Stewart (commit_signer:1/3=33%) > > Thomas Gleixner (commit_signer:1/3=33%) > > Philippe Ombredanne (commit_signer:1/3=33%) > > Nick Desaulniers (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%) > > linux-kernel@vger.kernel.org (open list) > > The script I use to send patches adds --nogit --nogit-fallback > to copy only listed maintainers because people that send cleanup > patches don't generally like to get random patches. > > > > btw: there are many uses of a reversed declaration style of DEVICE_ATTR > > > > > > Here's another thing that could be done for more DEVICE_ATTR_ uses. > > > > > > === > > > > > > Some DEVICE_ATTR definitions use a reversed static function form from > > > the typical. Convert them to use the more common macro form so it is > > > easier to grep for the style. > [] > > > $ git grep --name-only -w DEVICE_ATTR | \ > > > xargs perl -i dev_attr_rw_backwards.perl > > Ah, nice, I love perl : > > That was a bad copy/paste of the script. > > The actual script for RW is: > > $ cat dev_attr_rw_backwards.perl > local $/; > while (<>) { > my $file = $_; > while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) { > my $var = $1; > if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) { > $file =~ s/\bshow_${var}\b/${var}_show/g; > $file =~ s/\bstore_${var}\b/${var}_store/g; > } > } > print $file; > } > > There are 3 different perl scripts for rw, ro, and wo. > and these scripts, because of function renaming and > possible reuse of the original function names by other > string concatenated macros, create some bad conversions > so they need some manual cleanups too. > > Perhaps coccinelle could do a better job of it, but > likely string concatenation macro uses are going to > be hard to deal with in any case. I made a rule for this at one point, but there are cases where the functions have the wrong names, and then these functions may be used elsewhere. julia