From patchwork Wed Jul 28 14:24:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 487910 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp1258342jas; Wed, 28 Jul 2021 07:25:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmflFPIJEfgHPAtpLCkFpVbaYuB2BbGF60PkDut4yBT70Dei4HSktSW3tWN2lQVcmRuMrm X-Received: by 2002:a6b:7948:: with SMTP id j8mr23397583iop.32.1627482318645; Wed, 28 Jul 2021 07:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627482318; cv=none; d=google.com; s=arc-20160816; b=NXbdNk1ukqGgC5zpr5HnWbCEJqe5yd4H6saww797Ow7IEQqP10Xt5amhgCC0MP0Vv+ XTnBEPbXtj1fZwkcEVnneZ4sEY3Y73LPWQVBsQ6kCY3MQIBuB4o/kl4Yz8qcasE2m7q3 y5mH6S+yjvRrYM7+nUKwWgyFwO0NGfl2eygyey/3D1XNGWN2s2/gH6y/mGkpFGnDkC9U MU+aI61QDJMHNtTQea5/cwXRYSHrx3QOf2BbTynebDFhGhxaTWwfFpKGhwSUt8l4xOjW XIlhGIj55ptri9iYn6Y2+A7e2Y68zhQJE+cwftgG5XvHBOxNeSB+UTthSMrW0hb+7PzE U1GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ORimO8D42kAHhnXfoY653OGm+8ilcZTSD9Rm8q3p1bo=; b=fNjTU72u6PsvB4/CKNWjyQI/pYPErIhIgUIsoTUxqeZZ+ljj/Z2YW05gA3gHEO5Esd z4zbWXAqh1npMzyG3wBmH/kqSIVn50RpQZ7AKcfs26w4orKukIYl3l+Oa63klPHPuskk +UBQXixePcqZWVibQkUny6vrfyuSX8FLlDMZBcc4Nz7s2BIzMK0Kk37d06+cnR35uFOt RJckjwiA9laMRpMyUgjuG4dlXNSTz4cTEChRc26pbqmI9TpZYVXuzGAwVCCAOj06YTF/ eCAxlnom6bOy81r0uk+v8o020+AG6xf/AHBhEQi3ICXY6UGnpvcG/7HeNgE7Rr5lmamU J4ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QJdRABVp; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si59582iok.60.2021.07.28.07.25.18; Wed, 28 Jul 2021 07:25:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QJdRABVp; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235349AbhG1OZQ (ORCPT + 17 others); Wed, 28 Jul 2021 10:25:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236646AbhG1OZL (ORCPT ); Wed, 28 Jul 2021 10:25:11 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F8D5C0617A1 for ; Wed, 28 Jul 2021 07:24:55 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id x7so3284296ljn.10 for ; Wed, 28 Jul 2021 07:24:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ORimO8D42kAHhnXfoY653OGm+8ilcZTSD9Rm8q3p1bo=; b=QJdRABVp43c7JWRg8sbdKu6k+iBY7vTqpmXGlj/FeZzkEkG0i2omtElZod1AQGXI+J xVcYDap+fs7EweFwsu5TGdUi+b4kz0H14GE78mjrH+cwSAyJhxf26ZxMCYO0v/D+/kPt p73Cs8lzaG9gsFIorWc4P2FunLeHMpnaVREsNm6j+2URPW65Id04ee0oiY8qxio2CzmZ taYFAte0h2oRGq3fYRMftGNkXj4bxAZYQFGpZXn5fQeL7Bu2ezzJemFEF5o+0dJrZGsz E+WOBQiLRdGamNCkP2YOv9JdXV9kA7AIYSc13BAOiwVt9ddt+haN4UPVrQ0WIOZ10NSb aB1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ORimO8D42kAHhnXfoY653OGm+8ilcZTSD9Rm8q3p1bo=; b=JIFgtnKWXCB/+R+6fhrDyBdyqKhaxmQKMyNMRo7CIoGXqylcpwJvvM4v4V9m9vycG5 RLiuH7h8mWnjKWeEbiUPbUPQSi+bgEvuXCTCX4PusL4csT2Sks2rGJAQ9YdHSCzc70Cc sZyhTY3yhXKgG9seFfXqR+Ab7/EMD1s9WqgTVSqwz3BKYSto8bmTQEZ90bBN8TAJ65zk ygmsEnqg2wxq9FKgFg0e9W7yTvAGPBormRLRQXjtqMK9E6GzC3uNolW/0MiZmSXmrmGR g9DaQcV3MBcw3mDNOOu+HuD5/r0Cxf1+ma5U7FpujME1h4J2Zn/NWsW8ZdoinVeeNg6X p6Yw== X-Gm-Message-State: AOAM530TmbdzvsGjbj0rIMarzWSqlhycnmSiYQPmhvb+lvncVlIp5ARG gCeubpUefbGO2DHkn/BIjA1S0w== X-Received: by 2002:a2e:9605:: with SMTP id v5mr97711ljh.178.1627482293728; Wed, 28 Jul 2021 07:24:53 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id h4sm15610lft.184.2021.07.28.07.24.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 07:24:53 -0700 (PDT) From: Dmitry Baryshkov To: "Rafael J. Wysocki" , Pavel Machek , Greg Kroah-Hartman , Stephen Boyd , Taniya Das , Michael Turquette , Andy Gross , Bjorn Andersson Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 4/5] clk: qcom: use common code for qcom_cc_probe_by_index Date: Wed, 28 Jul 2021 17:24:44 +0300 Message-Id: <20210728142445.774158-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210728142445.774158-1-dmitry.baryshkov@linaro.org> References: <20210728142445.774158-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Rewrite qcom_cc_map and qcom_cc_probe_by_index to use (new) qcom_cc_map_by_index, removing code duplication and opening a way to have more common code in qcom_cc_map*. Signed-off-by: Dmitry Baryshkov --- drivers/clk/qcom/common.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) -- 2.30.2 diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 60d2a78d1395..ed7c516a597a 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -69,20 +69,26 @@ int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, u8 src) } EXPORT_SYMBOL_GPL(qcom_find_src_index); -struct regmap * -qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc) +static struct regmap * +qcom_cc_map_by_index(struct platform_device *pdev, const struct qcom_cc_desc *desc, int index) { void __iomem *base; struct resource *res; struct device *dev = &pdev->dev; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + res = platform_get_resource(pdev, IORESOURCE_MEM, index); base = devm_ioremap_resource(dev, res); if (IS_ERR(base)) return ERR_CAST(base); return devm_regmap_init_mmio(dev, base, desc->config); } + +struct regmap * +qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc) +{ + return qcom_cc_map_by_index(pdev, desc, 0); +} EXPORT_SYMBOL_GPL(qcom_cc_map); void @@ -313,15 +319,8 @@ int qcom_cc_probe_by_index(struct platform_device *pdev, int index, const struct qcom_cc_desc *desc) { struct regmap *regmap; - struct resource *res; - void __iomem *base; - - res = platform_get_resource(pdev, IORESOURCE_MEM, index); - base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(base)) - return -ENOMEM; - regmap = devm_regmap_init_mmio(&pdev->dev, base, desc->config); + regmap = qcom_cc_map_by_index(pdev, desc, index); if (IS_ERR(regmap)) return PTR_ERR(regmap);