Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbdLSSv0 (ORCPT ); Tue, 19 Dec 2017 13:51:26 -0500 Received: from smtprelay0228.hostedemail.com ([216.40.44.228]:58999 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750783AbdLSSvV (ORCPT ); Tue, 19 Dec 2017 13:51:21 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 10,1,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3167:3352:3622:3865:3867:3868:3872:4321:5007:6742:6743:7903:10007:10400:10848:11026:11232:11473:11657:11658:11914:12043:12296:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21433:21451:21627:30012:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:1:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: sail76_4539cda4cdc12 X-Filterd-Recvd-Size: 2966 Message-ID: <1513709474.1234.66.camel@perches.com> Subject: Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO From: Joe Perches To: Borislav Petkov Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Thomas Falcon , John Allen , Inaky Perez-Gonzalez , linux-wimax@intel.com, James Smart , Dick Kennedy , Zhang Rui , Eduardo Valentin , Martin Schwidefsky , Heiko Carstens , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, Dmitry Torokhov , "James E.J. Bottomley" , "Martin K. Petersen" , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org Date: Tue, 19 Dec 2017 10:51:14 -0800 In-Reply-To: <20171219184441.ixxh757tl44qvk5l@pd.tnic> References: <20171219184441.ixxh757tl44qvk5l@pd.tnic> 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 Content-Length: 1162 Lines: 30 On Tue, 2017-12-19 at 19:44 +0100, Borislav Petkov wrote: > On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote: > > Convert DEVICE_ATTR uses to DEVICE_ATTR_WO where possible. > > > > Done with perl script: > > > > $ git grep -w --name-only DEVICE_ATTR | \ > > xargs perl -i -e 'local $/; while (<>) { s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(?:\s*S_IWUSR\s*|\s*0200\s*)\)?\s*,\s*NULL\s*,\s*\s_store\s*\)/DEVICE_ATTR_WO(\1)/g; print;}' [] > > diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c [] > > @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev, > > return sprintf(buf, "0x%x\n", uci->cpu_sig.pf); > > } > > > > -static DEVICE_ATTR(reload, 0200, NULL, reload_store); > > +static DEVICE_ATTR_WO(reload); > > static DEVICE_ATTR(version, 0400, version_show, NULL); > > static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL); > > > > # cat /sys/devices/system/cpu/microcode/reload > cat: /sys/devices/system/cpu/microcode/reload: Permission denied Not different behavior. It was and remains write only. > The reason for the code churn being? Consistency for easier grep by use-type.