From patchwork Wed Mar 20 18:49:33 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: 160709 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp625886jan; Wed, 20 Mar 2019 11:50:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWpv/9axEntO6XU2w7NlYZW17p8jUGMOIFbiHNzZRFtegzYDO4Qn145ivIOlE7kQowPFNJ X-Received: by 2002:a62:1b84:: with SMTP id b126mr9013917pfb.225.1553107840939; Wed, 20 Mar 2019 11:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553107840; cv=none; d=google.com; s=arc-20160816; b=hld3XfVjPwLrn1pXS8ALLOiggitLMRqrnIQRqznrAWAiGTikTiv6py3AbEH/8Qs1uw T9KWl+0vxTC36+SUaN0famVaJ4hHeXBWFwH6zhi3EyQ6k0xKWwsLWHabRZCckMvJEGfo i0kwvDFcQH6Ye5dLrstuUZaSRwqJO8VhfGUrSfkog9dMjaj1WwggEE8EMZI0amAsLion Xos1jG0YClqSd8tpHXw+dIxnRcD01cw3ylIopQlB1cNFut4U1puIKF9u7FHrnoetQKhN dVLa+5w2y4XRgSsEsqdrrRfr1fOWbrJFKh2ZpOxdAyhxKYqg3S52XvZmrnNed9lFc1bX /wog== 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=ZaCXV5BjcspCnrZBpWW74WxaJw3mJBmGZRTKKUqWdrE=; b=zWWB+pWVS4mVaosr47Ag/adw4LcBBMXQpAPw3Sx9XIjVt97d7mfmCR/u8RAQOdWoj7 t+WLRNcObEwhI0NJjqztWDgX41ZrPloRPMFxyGlOM5NDRaBWiEpt4OmAg0KPVNAdzCPW js2J5NlDmk4+3rvhAZr65rvvEd4Kys4N32JaHUTUhmkOVdr75G/nQ5U0EA8Pz/MhtQwI QfvchYWgU4imPKuZxNV0Ac/LKo60fxeCbzr3yGT8M1Ztj4j6PJxMCGZDavNLQdWTblkM ipVOjSVGTW8Fy75Q25yKw0iG7MrbHoVH91c8IRHNYG+QI4xnM0EDmyEAqLbg+qJWOi8W R7zA== 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 n19si2193801pgk.158.2019.03.20.11.50.40; Wed, 20 Mar 2019 11:50:40 -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 S1727642AbfCTSuj (ORCPT + 31 others); Wed, 20 Mar 2019 14:50:39 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44966 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727613AbfCTSuh (ORCPT ); Wed, 20 Mar 2019 14:50:37 -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 404491BC0; Wed, 20 Mar 2019 11:50:37 -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 BAEC93F59C; Wed, 20 Mar 2019 11:50:35 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, coresight@lists.linaro.org, mike.leach@linaro.org, robert.walker@arm.com, Suzuki K Poulose , Mathieu Poirier Subject: [PATCH 16/25] coresight: stm: Rearrange probing the stimulus area Date: Wed, 20 Mar 2019 18:49:33 +0000 Message-Id: <1553107783-3340-17-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553107783-3340-1-git-send-email-suzuki.poulose@arm.com> References: <1553107783-3340-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 6afe033..eb96bba 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -684,14 +684,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; } @@ -706,6 +707,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;