From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932089AbaGWOZf (ORCPT ); Wed, 23 Jul 2014 10:25:35 -0400 Received: from mail.kernel.org ([198.145.19.201]:45546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755353AbaGWOZe (ORCPT ); Wed, 23 Jul 2014 10:25:34 -0400 Date: Wed, 23 Jul 2014 11:25:25 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Adrian Hunter , Peter Zijlstra , linux-kernel@vger.kernel.org, David Ahern , Frederic Weisbecker , Namhyung Kim , Paul Mackerras , Stephane Eranian Subject: Re: [PATCH 13/52] perf tools: Add perf_pmu__scan_file() Message-ID: <20140723142525.GM20303@kernel.org> References: <1406035081-14301-1-git-send-email-adrian.hunter@intel.com> <1406035081-14301-14-git-send-email-adrian.hunter@intel.com> <20140722190901.GC29750@krava.redhat.com> <53CF5531.90709@intel.com> <20140723093638.GA1207@krava.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140723093638.GA1207@krava.brq.redhat.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Jul 23, 2014 at 11:36:38AM +0200, Jiri Olsa escreveu: > On Wed, Jul 23, 2014 at 09:24:49AM +0300, Adrian Hunter wrote: > > On 07/22/2014 10:09 PM, Jiri Olsa wrote: > > > On Tue, Jul 22, 2014 at 04:17:22PM +0300, Adrian Hunter wrote: > > > > > > SNIP > > > > > >> + > > >> +static FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name) > > >> +{ > > >> + struct stat st; > > >> + char path[PATH_MAX]; > > >> + const char *sysfs; > > >> + > > >> + sysfs = sysfs__mountpoint(); > > >> + if (!sysfs) > > >> + return NULL; > > >> + > > >> + snprintf(path, PATH_MAX, > > >> + "%s" EVENT_SOURCE_DEVICE_PATH "%s/%s", sysfs, pmu->name, name); > > >> + > > >> + if (stat(path, &st) < 0) > > >> + return NULL; > > >> + > > >> + return fopen(path, "r"); > > >> +} > > > > > > looks like this function could be used in pmu_cpumask and pmu_type > > > and maybe others > > > > There is existing code duplication between them. Given the large number of > > patches I would say it is easier to deal with that separately. > > ook, jirka Is this an Acked-by: jirka? - Arnaldo