From patchwork Tue May 7 10:52:39 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: 163509 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp1185590ilm; Tue, 7 May 2019 03:55:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZY//fQAPMscHQIZmRmbYczHFvE4XiPbBvz5+khmNJ4oKe29DpKEh7OFbDeSiIytPuy6FF X-Received: by 2002:a17:902:a988:: with SMTP id bh8mr39076520plb.243.1557226557270; Tue, 07 May 2019 03:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557226557; cv=none; d=google.com; s=arc-20160816; b=jyqHxA08om5Nhl5R0LZb+qT3WMIv9szcs8e/a4WwrxWVdYBxkxGC2rzOhiK5QAl74n iqBvoX3FHi9EqICoEdQF1YrDMQ8NcK9oCI9+4nDK17ZpwcNMtnAoV2+mCBeL6My9R0E4 kmgv3uUykK/vQsAb2euCGzzqITwSorJaD1XE2vleUMdukTBJhrdOPWZcRMkEWG9P+P4B zZ8V+bIlgJWIqhuwfNFApoOr6oinVpPI7l1zyKVhF5gopkwkDhG1JfzJ5nAM0Q0iVAJB VBw9LskEdrZtA6tuG/fwhcaWnUQY/QpWnGIGUZfp3AKSa8V6C6TMKBFpULhr89yj8CM5 gdYw== 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=uerHy2Cm1XoBBmI+wZfMj+RrLJ8zTbOP1tFL8mkJSfIqU0YIBM6soaQSU9vpyu1urn kC8M3l+86lTQVpdpLMCXO7Pmf94eoe73M8ikGjOcO7M0EPBs2/ZnpsLsZ2PSLsezjsDi 9RmRNWXVbZZuzmKBaIqwEYN+/k3Mc8btjhJLYCfGuwqeeJdVpgEZGi6c8SEFmurcqcrv FxvtMOw76ieO3jLfz0c7pxE/vaa7SKw2U24AYGydFVWuWAQhxlm1IAm6Bxtus2nsmUGM XkBZarv7uB4iJ5bpz+jwhqh7NUq5MQ9nL075xJtCa3ONuap7rJ21SkYa0WXvmNHvMpV9 BEBQ== 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 j6si18482294pfr.140.2019.05.07.03.55.57; Tue, 07 May 2019 03:55:57 -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 S1727158AbfEGKz4 (ORCPT + 30 others); Tue, 7 May 2019 06:55:56 -0400 Received: from foss.arm.com ([217.140.101.70]:50174 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbfEGKx6 (ORCPT ); Tue, 7 May 2019 06:53:58 -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 53B41168F; Tue, 7 May 2019 03:53:58 -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 209873F5AF; Tue, 7 May 2019 03:53:56 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, rjw@rjwysocki.net, mathieu.poirier@linaro.org, Suzuki K Poulose Subject: [PATCH v3 12/30] coresight: stm: Rearrange probing the stimulus area Date: Tue, 7 May 2019 11:52:39 +0100 Message-Id: <1557226378-10131-13-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557226378-10131-1-git-send-email-suzuki.poulose@arm.com> References: <1557226378-10131-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;