From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754361AbbCSM6D (ORCPT ); Thu, 19 Mar 2015 08:58:03 -0400 Received: from smtprelay0115.hostedemail.com ([216.40.44.115]:57942 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752228AbbCSM57 convert rfc822-to-8bit (ORCPT ); Thu, 19 Mar 2015 08:57:59 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::,RULES_HIT:41:152:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1513:1515:1516:1518:1521:1534:1541:1593:1594:1711:1730:1747:1777:1792:1801:2393:2553:2559:2562:3138:3139:3140:3141:3142:3167:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:4605:5007:6119:6261:7875:7903:8957:9040:10004:10400:10848:10967:11026:11232:11233:11658:11914:12043:12438:12517:12519:12555:12663:12740:13069:13311:13357:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: trees16_7fb702c2fa35b X-Filterd-Recvd-Size: 3056 Date: Thu, 19 Mar 2015 08:57:56 -0400 From: Steven Rostedt To: Borislav Petkov Cc: Xie XiuQi , akpm@linux-foundation.org, n-horiguchi@ah.jp.nec.com, gong.chen@linux.intel.com, bhelgaas@google.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, jingle.chen@huawei.com Subject: Re: [PATCH] trace, RAS: remove unnecessary const Message-ID: <20150319085756.2c649e7d@gandalf.local.home> In-Reply-To: <20150319103330.GC11544@pd.tnic> References: <1426755004-28434-1-git-send-email-xiexiuqi@huawei.com> <20150319103330.GC11544@pd.tnic> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Mar 2015 11:33:30 +0100 Borislav Petkov wrote: > On Thu, Mar 19, 2015 at 04:50:04PM +0800, Xie XiuQi wrote: > > These parameters are passed by value. There's no need to make them const. > > I can think of a reason: > > include/trace/../../include/ras/ras_event.h: In function ‘ftrace_raw_event_mc_event’: > include/trace/../../include/ras/ras_event.h:136:35: error: assignment of read-only parameter ‘top_layer’ > __entry->top_layer = top_layer = 12; > ^ > --- > diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h > index 79abb9c71772..e4721eac3e25 100644 > --- a/include/ras/ras_event.h > +++ b/include/ras/ras_event.h > @@ -133,7 +133,7 @@ TRACE_EVENT(mc_event, > __assign_str(label, label); > __entry->error_count = error_count; > __entry->mc_index = mc_index; > - __entry->top_layer = top_layer; > + __entry->top_layer = top_layer = 12; > __entry->middle_layer = mid_layer; > __entry->lower_layer = low_layer; > __entry->address = address; > --- > > I'm not saying it is a particularly sane reason and no one would even > *think* of changing TP parameters passed on from higher layers in the TP > itself but I've seen people do lotsa crazy things - things they normally > would never do - so if it doesn't hurt having the const here, what's the > downside of having the compiler do that sanity checking for us too? That's a bit of a stretch. But sure, there's no real downside to having it, except that it makes one take a double take when seeing it, and thinking about why it would even be needed (like I did). > > Steve, this is an invitation for your crazy fantasy! :-P > I think you had the crazy fantasy with the above patch! -- Steve