Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753163AbcDBL6o (ORCPT ); Sat, 2 Apr 2016 07:58:44 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:32902 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751971AbcDBL6n (ORCPT ); Sat, 2 Apr 2016 07:58:43 -0400 Subject: Re: [PATCH v4 1/4] perf config: Introduce perf_config_set class To: Arnaldo Carvalho de Melo References: <1459212193-1095-1-git-send-email-treeze.taeung@gmail.com> <20160331173144.GA10112@kernel.org> <56FE4D0A.60200@gmail.com> <20160401143501.GF7115@kernel.org> Cc: Namhyung Kim , linux-kernel@vger.kernel.org, Jiri Olsa , Ingo Molnar , Peter Zijlstra From: Taeung Song Message-ID: <56FFB3EE.9040808@gmail.com> Date: Sat, 2 Apr 2016 20:58:38 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160401143501.GF7115@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1921 Lines: 66 On 04/01/2016 11:35 PM, Arnaldo Carvalho de Melo wrote: > Em Fri, Apr 01, 2016 at 07:27:22PM +0900, Taeung Song escreveu: >> On 04/01/2016 02:31 AM, Arnaldo Carvalho de Melo wrote: >>> Em Tue, Mar 29, 2016 at 09:43:13AM +0900, Taeung Song escreveu: >>>> +static int collect_config(const char *var, const char *value, >>>> + void *perf_config_set) >>>> +{ >>>> + int ret = -1; >>>> + char *ptr, *key; >>>> + char *section_name, *name; >>>> + struct perf_config_section *section = NULL; >>>> + struct perf_config_item *config_item = NULL; >>>> + struct perf_config_set *perf_configs = perf_config_set; >>>> + struct list_head *sections = &perf_configs->sections; > >>>> + key = ptr = strdup(var); >>>> + if (!key) { >>>> + pr_err("%s: strdup failed\n", __func__); > >>> pr_debug() > >> I'll change pr_err to pr_debug. >> But why do use pr_debug at only this part ? > > Well, ideally one would propagate the errors from library level code to > the code in the tool, i.e. closer to builtin-foo.c, where it would > decide how to present it to the user. > > For extra messages, that may help a more advanced user or to be sent to > the tool developers, use pr_debug(). I understood it! > >>>> +struct perf_config_section { >>>> + char *name; >>>> + struct list_head config_items; > >>> s/config_items/items/g > >>>> + struct list_head list; > >>> s/list/node/g >>>> +}; >>>> + >>>> +struct perf_config_set { >>>> + struct list_head sections; > >>> See? Here you did it right, no point in having it as "config_sections" > >> I'll rename it to 'config_sections'. > > I meant to keep this one like it is, i.e. perf_config_set->sections, and > use the same principle: shorter names, removing useless stuff like > "config_", that in this case can be implied by the name of the class, > and apply it to the perf_config_section case, making it > perf_config_section->items, ok? I got it. :-) I'll resend v5 Thanks, Taeung