Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759249AbcDAOfJ (ORCPT ); Fri, 1 Apr 2016 10:35:09 -0400 Received: from mail.kernel.org ([198.145.29.136]:33948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758289AbcDAOfF (ORCPT ); Fri, 1 Apr 2016 10:35:05 -0400 Date: Fri, 1 Apr 2016 11:35:01 -0300 From: Arnaldo Carvalho de Melo To: Taeung Song Cc: Arnaldo Carvalho de Melo , Namhyung Kim , linux-kernel@vger.kernel.org, Jiri Olsa , Ingo Molnar , Peter Zijlstra Subject: Re: [PATCH v4 1/4] perf config: Introduce perf_config_set class Message-ID: <20160401143501.GF7115@kernel.org> References: <1459212193-1095-1-git-send-email-treeze.taeung@gmail.com> <20160331173144.GA10112@kernel.org> <56FE4D0A.60200@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56FE4D0A.60200@gmail.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1754 Lines: 57 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(). > >>+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? - Arnaldo