Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp978852pxb; Fri, 22 Apr 2022 15:49:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFuUn8eaw95XQJMymtbC9OfTspyy1Mml7oc4GrQdfVtIM9qlLdR3Y3XYr/WJvOLy+Ff6+T X-Received: by 2002:a17:903:240e:b0:158:eab9:2662 with SMTP id e14-20020a170903240e00b00158eab92662mr6596931plo.87.1650667751754; Fri, 22 Apr 2022 15:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650667751; cv=none; d=google.com; s=arc-20160816; b=YOIMQLovEBuOm/sIcavQJdyAXgZNRsfjhKBNpiLkJgIuqIZMraSsYmk8+rp+NzXBmx 9fCDjX5W8bKegiU6pXeY2v/t5wb5GEO40S114za+3MKlzJVVeTb9pifKTFosgwjTu/Ef xuHm5zP+2nhvCAYl98sN4xT2lZA8REY2WfNQQgJMOUq8PRIkP1LvRhXQmbDfmWlsrOmu iaQMAVgUWTcJe7CY1/eElOqU6tcvn2b626ZQGQHS59hsph6brtjrVKnjMSWWAvYyopjz zW4e6hMc+ls2snt5ApBlgtLgA8Y/GWsCljw21SlW8XMa+mQfDCNAa2RUw2MyrkC8A6fM SfBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SJoAgc6kJmmVvqozFGtppwZ/7+HvavmIfCcCoflVkLY=; b=sAh/cWiMDH5CXIhfqlDSfLTYWe/DOYwTkCbowcyuBri5Jmlwe4gO7mNHOo0nyvs9jD Q9ane6YD3h7HzOytUtvk0x7wZRV5mz80i4PdmPXp3gGuueIVkAVy9QZj20iTRiu+L8vB tW9XyeeMrFa1FSN0SmrSJBjk91kFNXhQn+Bng7aRlfMXdbKYohUrCKNEY7oV9oPIhsg0 +Ct/43SDj7k+3LP3L0kfd3j1X8Ou17loE+uuKocet2Relh/8Zs8dxQ95iOJX7dpCSGKM IjhKP07VGYPS2A1G17ADrB9a4Vyktyo0elIjhwWnXOiZg5szV4WIEP1cETjcEmtRrEbC 591Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iF6RgM+R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v5-20020a17090ac90500b001cba36e18e7si8511837pjt.53.2022.04.22.15.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iF6RgM+R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BA2D82A18B1; Fri, 22 Apr 2022 13:38:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiDVUDL (ORCPT + 99 others); Fri, 22 Apr 2022 16:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbiDVUDI (ORCPT ); Fri, 22 Apr 2022 16:03:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBD891E2738 for ; Fri, 22 Apr 2022 12:49:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3801AB83220 for ; Fri, 22 Apr 2022 19:05:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABCBFC385A0; Fri, 22 Apr 2022 19:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650654324; bh=9SKM3jK2iPGEfXDhEyIE2AvKemy8k5i6L/EzzAVKkqg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iF6RgM+Rv127nfGzfXZX6M6Wy79viuvggsKu3CulKDd7aDaG87zUzHfvBQoVDv2NA NgqdVZZv3WLjjDgHY2dyMY8qlH1RHGQyrIPJpqk37ieY8fH06CsIxljl+503o9TMDh E3n7U78quN8Zpw5s7VEz0vI+vDHmFZSidgZW+mtRz08adRGzbTMSsJ4GgIw5pqm8EC rfy7U7bUG2rkSo63A1ldtH8TwQQvs1PZI+T4LZYsAcewHcMzTlGeW8/lM8XYCJ03t+ ddzCCqKFEFoSkpbrgoChwRqzVYSP4gwBTwXG3nQDqYzJlWBb+KuKX9AB3FquBiVx7a e7BDAVlNPXpKQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 7747B400B1; Fri, 22 Apr 2022 16:05:22 -0300 (-03) Date: Fri, 22 Apr 2022 16:05:22 -0300 From: Arnaldo Carvalho de Melo To: Adrian Hunter Cc: Jiri Olsa , Ian Rogers , Alexey Bayduraev , Namhyung Kim , Leo Yan , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 01/21] libperf evsel: Factor out perf_evsel__ioctl() Message-ID: References: <20220422162402.147958-1-adrian.hunter@intel.com> <20220422162402.147958-2-adrian.hunter@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220422162402.147958-2-adrian.hunter@intel.com> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Apr 22, 2022 at 07:23:42PM +0300, Adrian Hunter escreveu: > Factor out perf_evsel__ioctl() so it can be reused. Cherry picking this one as I look at the patchset. - Arnaldo > Signed-off-by: Adrian Hunter > --- > tools/lib/perf/evsel.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/tools/lib/perf/evsel.c b/tools/lib/perf/evsel.c > index 210ea7c06ce8..20ae9f5f8b30 100644 > --- a/tools/lib/perf/evsel.c > +++ b/tools/lib/perf/evsel.c > @@ -328,6 +328,17 @@ int perf_evsel__read(struct perf_evsel *evsel, int cpu_map_idx, int thread, > return 0; > } > > +static int perf_evsel__ioctl(struct perf_evsel *evsel, int ioc, void *arg, > + int cpu_map_idx, int thread) > +{ > + int *fd = FD(evsel, cpu_map_idx, thread); > + > + if (fd == NULL || *fd < 0) > + return -1; > + > + return ioctl(*fd, ioc, arg); > +} > + > static int perf_evsel__run_ioctl(struct perf_evsel *evsel, > int ioc, void *arg, > int cpu_map_idx) > @@ -335,13 +346,7 @@ static int perf_evsel__run_ioctl(struct perf_evsel *evsel, > int thread; > > for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { > - int err; > - int *fd = FD(evsel, cpu_map_idx, thread); > - > - if (fd == NULL || *fd < 0) > - return -1; > - > - err = ioctl(*fd, ioc, arg); > + int err = perf_evsel__ioctl(evsel, ioc, arg, cpu_map_idx, thread); > > if (err) > return err; > -- > 2.25.1 -- - Arnaldo