From patchwork Wed May 22 10:34:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 164804 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp695060ili; Wed, 22 May 2019 03:37:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkcfH1f8P5UJE9+3BRZvuiiXGRoe1BgkWBOAnsAdcN+IRbfH8uC+bKWScP68T3JqCWV4gw X-Received: by 2002:a63:a55:: with SMTP id z21mr89548235pgk.440.1558521422625; Wed, 22 May 2019 03:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558521422; cv=none; d=google.com; s=arc-20160816; b=eh4c1mi5SyzTShtjkL0nUaPMjiE5WfuOX2PRjZBJI8/GiN0e67Jdupct/6o4NpHR3v ozh5V8H0wVQerEfKVwhJExMHhkHD4nKjJAzD0jWPvkwQP4s1ZCXlNtYSC5QGe3GPgxE/ GyjAO8G4gUZiFjiQH45ER31u1MiyaWvRjNd0E9+PpgoVM336Ry79hO5PKzKsbAtsKcgF gy8fPBoxXfNVq8ICs5YYYH/M2y1NyDrZtJqx5Bosqk56GgrmR/vkZ60jNDLgdgCguRyX 331rfJk7AeljqCsQFWdV0iGFRCidg2OOBKY4ZXZv4gY1dKhx48aCv89Sst4JlSihdwur Qvxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=PkcYtuYnQZteVLmimQRL8pzPNwgc6KZxlWxzL4UCEaQ=; b=JoBQFRhRxJkRsVVWzJb/c9CRw6eem0O3pqjmoF2bE8NyMQ5NjBMIfV+WDPr87aqSM0 FhqN+ctqO2Ovybm389idLDQcn8YianvKlevKVONGpFeOntSEemtuJioltGxna6mYMFiX 4rKoTPy1DfYevDc1O1MdA1VujXMJVLE3s76oUc7Sfk16cVAizIoLBtTnEMzlW9rLP6Xy kBG0XPa7XIVvvIP8aEsDPJaoiHv7LhpCM5vqWF3M784jZWwsmBVLfwpDuWfDswNhcuAV 1wIaKVNgpUCtauU3emaIPY+mLk3WWKqtDiVqvExt/A+P0Gp5RzN/kS9ej0wHMvwClOEI 38oQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si11419771pgq.350.2019.05.22.03.37.02; Wed, 22 May 2019 03:37:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729605AbfEVKhB (ORCPT + 30 others); Wed, 22 May 2019 06:37:01 -0400 Received: from foss.arm.com ([217.140.101.70]:47052 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729319AbfEVKfe (ORCPT ); Wed, 22 May 2019 06:35:34 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C2E43341; Wed, 22 May 2019 03:35:33 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B32B73F575; Wed, 22 May 2019 03:35:32 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, coresight@lists.linaro.org, Suzuki K Poulose Subject: [PATCH v4 12/30] coresight: stm: Rearrange probing the stimulus area Date: Wed, 22 May 2019 11:34:45 +0100 Message-Id: <1558521304-27469-13-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558521304-27469-1-git-send-email-suzuki.poulose@arm.com> References: <1558521304-27469-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we are about to refactor the platform specific handling re-arrange some of the DT specific property handling. Reviewed-by: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-stm.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 8f50484..3992a35 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -683,14 +683,15 @@ static const struct attribute_group *coresight_stm_groups[] = { NULL, }; -static int stm_get_resource_byname(struct device_node *np, - char *ch_base, struct resource *res) +#ifdef CONFIG_OF +static int of_stm_get_stimulus_area(struct device *dev, struct resource *res) { const char *name = NULL; int index = 0, found = 0; + struct device_node *np = dev->of_node; while (!of_property_read_string_index(np, "reg-names", index, &name)) { - if (strcmp(ch_base, name)) { + if (strcmp("stm-stimulus-base", name)) { index++; continue; } @@ -705,6 +706,20 @@ static int stm_get_resource_byname(struct device_node *np, return of_address_to_resource(np, index, res); } +#else +static inline int of_stm_get_stimulus_area(struct device *dev, + struct resource *res) +{ + return -ENOENT; +} +#endif + +static int stm_get_stimulus_area(struct device *dev, struct resource *res) +{ + if (is_of_node(dev_fwnode(dev))) + return of_stm_get_stimulus_area(dev, res); + return -ENOENT; +} static u32 stm_fundamental_data_size(struct stm_drvdata *drvdata) { @@ -819,7 +834,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR(base); drvdata->base = base; - ret = stm_get_resource_byname(np, "stm-stimulus-base", &ch_res); + ret = stm_get_stimulus_area(dev, &ch_res); if (ret) return ret; drvdata->chs.phys = ch_res.start;