From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229AbcGUKt3 (ORCPT ); Thu, 21 Jul 2016 06:49:29 -0400 Received: from foss.arm.com ([217.140.101.70]:47308 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751592AbcGUKt0 (ORCPT ); Thu, 21 Jul 2016 06:49:26 -0400 Subject: Re: [PATCH V2 5/6] coresight: adding sink parameter to function coresight_build_path() To: Mathieu Poirier , acme@kernel.org, jolsa@kernel.org References: <1469047100-18131-1-git-send-email-mathieu.poirier@linaro.org> <1469047100-18131-6-git-send-email-mathieu.poirier@linaro.org> Cc: peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Suzuki K Poulose Message-ID: <07484e7c-7d19-465f-04d9-1dbb4899b643@arm.com> Date: Thu, 21 Jul 2016 11:49:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1469047100-18131-6-git-send-email-mathieu.poirier@linaro.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/07/16 21:38, Mathieu Poirier wrote: > Up to now function coresight_build_path() was counting on a sink to > have been selected (from sysFS) prior to being called. This patch > adds a string argument so that a sink matching the argument can be > selected. > > static int _coresight_build_path(struct coresight_device *csdev, > - struct list_head *path) > + struct list_head *path, const char *sink) > { > int i; > bool found = false; > struct coresight_node *node; > > - /* An activated sink has been found. Enqueue the element */ > - if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || > - csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) && csdev->activated) > - goto out; > + /* > + * First see if we are dealing with a sink. If we have one check if > + * it was selected via sysFS or the perf cmd line. > + */ > + if (csdev->type == CORESIGHT_DEV_TYPE_SINK || > + csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) { > + /* Activated via perf cmd line */ > + if (sink && !strcmp(dev_name(&csdev->dev), sink)) > + goto out; > + /* Activated via sysFS */ > + if (csdev->activated) When a sink is specified, should we skip an activated sink and continue to find the specified one ? or at least fail with an error as we may not be using the sink specified by the user ? i.e may be : if (!sink && csdev->activated) goto out; Suzuki