From patchwork Mon Apr 15 16:03:59 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: 162210 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3105493jan; Mon, 15 Apr 2019 09:06:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXj4Cccc6jegE1K3+VTZqEvSOhS5dAT3JWDqH3K5mDRrMHTyQQHg8tQ9uWSaGsB+PwkEcU X-Received: by 2002:a63:525f:: with SMTP id s31mr70679555pgl.172.1555344379906; Mon, 15 Apr 2019 09:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555344379; cv=none; d=google.com; s=arc-20160816; b=NXyBONuPrPURpqdpKQvHfk2jno0vNsB98KusRPe4sXpPmRnR5o8R3Exs9y4rl4KHxi mwcOAuUF3oig9LZVUcuRHcb8Beg52uQyXKx5Ra9OJvn1B6DUh5cNmVrbmx2ee+YExhf4 kRChw5nerCNmnmNFFBOYgMpadzA4ddT81epRIiHcVHbz2mdqGHldqhmzidEe7g5wLJmi 4MlKFxDJpXy4rKcnbRYqxaQ5y85T9K3jTQMXSlwXW6/S0vlEcUrQ0i5Y/U2dSL1giN7Z hup/lVPrp+vuUb5VDmcn+fUEuCDQGyX8843G7DtWVIQEpo1Ajj9kevRa8GAql8gbLZBI ypig== 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=RbhWyPAxWOQYSqYn7EZ7Z5vXsr/ma8nI406Vuxe+3Lk=; b=akMNMDVcXOViTs1sAX0eC7CsbaM5hhL7p7zzrs88lD1bNlft/yHkG0thv3UITZwjfX O0wouwM8yd0wHzRgbbI1rzknz3EFEt/qyxrbvUouFMVj3m+hmT1ojZHonAClt5nXdO31 aI6VMVU81PoJubcw6bmiE5cd/LomWnqdrvGhjASBstgNAKouDidvFa6nTm2CUPbZbdE8 hhKjnQbjNTeUHA4IGaknuVKJ8MMFDPmK1UzwQS3JifBmToJlhMfQzECnVtz+jVbhfZ86 XnXw4CD9H5Qj3yoI8H9kqhf51J8wiBPNbUr8ZOfgtodDuKrP6XUC9qKs9bsYo2Kj61oP MFUg== 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 w3si44448747pgr.189.2019.04.15.09.06.19; Mon, 15 Apr 2019 09:06:19 -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 S1727995AbfDOQGR (ORCPT + 30 others); Mon, 15 Apr 2019 12:06:17 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37848 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727963AbfDOQGN (ORCPT ); Mon, 15 Apr 2019 12:06:13 -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 E80611684; Mon, 15 Apr 2019 09:06:12 -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 6E47F3F68F; Mon, 15 Apr 2019 09:06:11 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, mike.leach@linaro.org, rjw@rjwysocki.net, robert.walker@arm.com, Suzuki K Poulose Subject: [PATCH v2 16/36] coresight: stm: Rearrange probing the stimulus area Date: Mon, 15 Apr 2019 17:03:59 +0100 Message-Id: <1555344260-12375-17-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> References: <1555344260-12375-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. Cc: 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..a0690be 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 (dev->of_node) + 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;