From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48C7528CF68 for ; Fri, 18 Jul 2025 08:38:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752827882; cv=none; b=nMNBI79C5r4xpyKR8MsR/fB5aT+3ei2USLjn4W3tb5Q9VUK5zkQY0qa3Afso5PS1rlB14JSRvg/bQ0nUqhjgkobM3c3lGI8Yizk3UpJ2A4+qQl67YEJDI7fKPwT/EaJRGe62zchnAUv9AfRtAZzzpF1Dr+7oBxv8ORRJK9Qn+PQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752827882; c=relaxed/simple; bh=xkrVlFl++yjki3bmgqZOv3E+MHiM7DAo5a8dlrBWSxw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cOnv6pu5RFiNIEHF69h1lYziPALxXL/JThxxhuo4XGAP8YQ1ktnYb9dpFdJ4HC+pW6Zfn7DsijgftM4GjhUfsikWvYb2aQRMPNlw+7zFiL4NZJR+IvH3F/Leb5wmhlVeeKPLLT8+q2/SzwJMS0EHAsKxZiVMVmcy2+3B7i8I+a0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=sSotEowd; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sSotEowd" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-7399a2dc13fso2398370b3a.2 for ; Fri, 18 Jul 2025 01:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752827880; x=1753432680; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=T5DKf/JSZuAS6z2Xq7nrToIfpwa9ePTbW/i2x4sP8aQ=; b=sSotEowd9H5Ak/Q5YVL95C9Gl1h+0+YLlofTzc6tL38O9vn+CiooSTzRRQ6tZdzP36 xsDNFDH6VIaVpmFUprpIkS0+WaBO3ML0827EC4vkRolSR5gFo3tilHN/dCOsxfoNyPH8 qpWSJrg8oTXmd2chzQdgen5xunNyFcj/T+Cs0AmM4t6IwdmTn9BWIP1ZjdW2i4SWw+wE ueHRjMp0oJZvDE+Q9qu/n1N+0eQUr2pktqSlEfPWiNDLgA1okXzL1q07R1iA3ttlShXb hGzVGcoYyG9Y6+q28ODMvp+chWH9TF9/P4ikjslQSIBUQbN3zm/oiYYO4JxriAvCQVjx T9HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752827880; x=1753432680; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=T5DKf/JSZuAS6z2Xq7nrToIfpwa9ePTbW/i2x4sP8aQ=; b=LAfxX6u7y0Z3XDJP1X+q0KsLxBUHTwA+08mdi3y9MBuOEEWqDi8HMV7OUzsz7PnmPp kAXtNdNy8+sKqXkyin+Q0F1Ga9HQ0ZE9awQZNqVZWLMAZIXmNLvlflYjhw4P18Fjlmtl y4SthggCmFBhg34tnWY7DYON6ziXzFCvVqzQ8bvWYaPgsBgtog0J0ZCEPluScH8kHOtP ldTFfQYvxJbGUStUzu5lOrCLoaqR8IHcGRernmaGonQwQZnq/Mrxk+JKv1Reh+fH+Ot0 YDywig4nw0HWQzcE7bub3X4O5PzB7dSXsS9Y30npILmz1MABrySGc3dFozP24SxoTHsV bMRg== X-Forwarded-Encrypted: i=1; AJvYcCW6QBXwXoyATlcOTkqQ+vrpWzGyNkr2m+9vwU92P9b6qWF9Du4UE1uxlJwCZSWB9HBhcZlx5TSru9t2@vger.kernel.org X-Gm-Message-State: AOJu0Yy8YLtdakzAFfloO4eO6LfYiLC0CdxtTybWsdFVB4D9sdp8lEJ0 4kwMdoZF3v4FVZBa3pkI+S4PU3VUyCTcYspZjV6YAIo2F0hNJjJoTLlqQw8rHrOSRVhcCR2ch5W LK0wkq5Q+33IdJcAgvl3KJJlYCNgGl3TDX8AcJIhPXg== X-Gm-Gg: ASbGnctZKNcMDHZagDHFlTGasiIf3uveYzSIN1IL1u0r7tC3G1k6CWDhRHIxMG09jmd vESPUg5R0vGsTRt2mVZacLu5aI/2ddFawG15Gh5zygfl9wCBQSQL7AFVXxsBWO1+51DTZIHINva qigIxUOMqpWGKW9yNXGV16fSpa0iZINA3MdfudV+T6iqJBEC5XFxTcSTkWJRx2dMYE0GYVCiXg4 nVb0w2K X-Google-Smtp-Source: AGHT+IFqh+j+6EUjya6/Rjc1r8NT0FseuVGCh1Ka+tsqzW1wYMCTrimcXhsVexvinaMtnBJgBfcFHLy00MJtnLuDPNY= X-Received: by 2002:a05:6a00:1883:b0:736:5664:53f3 with SMTP id d2e1a72fcca58-7572427b03amr12830626b3a.15.1752827880483; Fri, 18 Jul 2025 01:38:00 -0700 (PDT) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250714063109.591-1-jie.gan@oss.qualcomm.com> <20250714063109.591-3-jie.gan@oss.qualcomm.com> In-Reply-To: <20250714063109.591-3-jie.gan@oss.qualcomm.com> From: Mike Leach Date: Fri, 18 Jul 2025 09:37:46 +0100 X-Gm-Features: Ac12FXzbwn7h5sLCdV0XEMivqozSxEu3_Wm23VZ6koC6hPisQ9WkjxcqJkjzS7w Message-ID: Subject: Re: [PATCH v3 RESEND 02/10] coresight: core: add a new API to retrieve the helper device To: Jie Gan Cc: Suzuki K Poulose , James Clark , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Alexander Shishkin , Tingwei Zhang , Yuanfang Zhang , Mao Jinlong , Jie Gan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Hi, On Mon, 14 Jul 2025 at 07:31, Jie Gan wrote: > > Retrieving the helper device of the specific coresight device based on > its helper_subtype because a single coresight device may has multiple types > of the helper devices. > > Signed-off-by: Jie Gan > --- > drivers/hwtracing/coresight/coresight-core.c | 30 ++++++++++++++++++++ > drivers/hwtracing/coresight/coresight-priv.h | 2 ++ > 2 files changed, 32 insertions(+) > > diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c > index 5297a5ff7921..76e10c36a8a1 100644 > --- a/drivers/hwtracing/coresight/coresight-core.c > +++ b/drivers/hwtracing/coresight/coresight-core.c > @@ -580,6 +580,36 @@ struct coresight_device *coresight_get_sink(struct coresight_path *path) > } > EXPORT_SYMBOL_GPL(coresight_get_sink); > > +/** > + * coresight_get_helper: find the helper device of the assigned csdev. > + * > + * @csdev: The csdev the helper device is conntected to. > + * @type: helper_subtype of the expected helper device. > + * > + * Retrieve the helper device for the specific csdev based on its > + * helper_subtype. > + * > + * Return: the helper's csdev upon success or NULL for fail. > + */ > +struct coresight_device *coresight_get_helper(struct coresight_device *csdev, > + int type) > +{ > + int i; > + struct coresight_device *helper; > + > + for (i = 0; i < csdev->pdata->nr_outconns; ++i) { > + helper = csdev->pdata->out_conns[i]->dest_dev; > + if (!helper || !coresight_is_helper(helper)) > + continue; > + Manipulating the connections list almost certainly requires some locking. See other functions in this file Mike > + if (helper->subtype.helper_subtype == type) > + return helper; > + } > + > + return NULL; > +} > +EXPORT_SYMBOL_GPL(coresight_get_helper); > + > /** > * coresight_get_port_helper: get the in-port number of the helper device > * that is connected to the csdev. > diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h > index 07a5f03de81d..5b912eb60401 100644 > --- a/drivers/hwtracing/coresight/coresight-priv.h > +++ b/drivers/hwtracing/coresight/coresight-priv.h > @@ -158,6 +158,8 @@ void coresight_path_assign_trace_id(struct coresight_path *path, > enum cs_mode mode); > int coresight_get_port_helper(struct coresight_device *csdev, > struct coresight_device *helper); > +struct coresight_device *coresight_get_helper(struct coresight_device *csdev, > + int type); > > #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) > int etm_readl_cp14(u32 off, unsigned int *val); > -- > 2.34.1 > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK