From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO Date: Tue, 19 Dec 2017 10:51:14 -0800 Message-ID: <1513709474.1234.66.camel@perches.com> References: <20171219184441.ixxh757tl44qvk5l@pd.tnic> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: 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 In-Reply-To: <20171219184441.ixxh757tl44qvk5l@pd.tnic> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org 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" 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtprelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3z1Rnl61qCzF078 for ; Wed, 20 Dec 2017 05:51:23 +1100 (AEDT) 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" Mime-Version: 1.0 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.