From patchwork Fri Jul 1 08:20:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4176C43334 for ; Fri, 1 Jul 2022 08:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iSRYdmksfOSS66Chwaz/EWXMgI/xcjH7h2Az/q7pX64=; b=wF9Ymk3Eqnv/we QdLRgAC2cx5mozFIY2oYVbVWOpjlcAs3g52UodOeBESbPoo/hsGhTKa6isxLzxOO2paj43EzOzSkO 3GzqC5WmYnHYH/BPiemPQ1o4LBlgv0yLA7ZH+ewDi8bXP2VRyrNFsf9RmgHz75xkwdU2GQP8snzDp rNtWUx5S41FDPsaMp3GlpsLxiSNzWp9FZb01J2EeXCRiaOxHWsRDOewqYdxJ20Dyl+44Ei54v8X7b VKRxgg3rUvjVGmdPwk72N1FUAYtvRSl60nbmGaNqhdxIVEsQnqbSf9jcx5qohQhu/hmbjhG4UwTiQ /qaeS38JybALdR0Mcqqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7Bu0-003bao-3L; Fri, 01 Jul 2022 08:21:24 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7Bth-003bPK-V1 for linux-arm-kernel@lists.infradead.org; Fri, 01 Jul 2022 08:21:07 +0000 Received: by mail-pl1-x633.google.com with SMTP id o18so1725345plg.2 for ; Fri, 01 Jul 2022 01:21:04 -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=UP0yoNhFLIHXiHpKMoJOvGvXM3qtPgVsBeDYDxFaexg=; b=qqFUbB4lPwvbdMFxiQhId3PlyWslWgqsVhgJF1Bry2po60wBJ5SBPQVqo0Efv5yhwX EouPmk6sI8onPh1qSQa0sspYochs4rfrmIwTSZfgcS/kud3GriovNPYKQ4kxBGLzPqkY 0mgFYO8PU8nd0RfJTa4Yyhd/lMBpJswGvBwoqT0LZbZmi2Mx8KyBw94j3834LusE68UQ lHNHmyn3ROVMfXLfS1VUiN5GkyacbAifavQnqeCnYU6FFrgyUiL+ObpmOlzPPvlk00Ub ixm3g8LFPtUiOah0AW2j4fkTGCApWETRqm4Y2SyKR0PvBIJlrh7C7BpT4jM2dgsq+h0D nt4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UP0yoNhFLIHXiHpKMoJOvGvXM3qtPgVsBeDYDxFaexg=; b=dK6I0+HgRKRO3eO1TH6jUJH9zK8gzGqFzaws/Ygglgnz13ZA+sGz8x8wLZ8QmLCuG+ 3MZs4DEaV4PuUjZrLY8vSGKIxNRr1XZ1axHFTTbyWL9EzrQVTSA8PWdMv8F93CrGBpJH 3hVtKLlFhkALbIrVOW5ppRKPdo3k/+PL/dHORHHLy793TNP9rVcWiG4e66bS2sT82mUX VuSmz1fYxGaC7VKAgx3NID0IgvF5KrocL7DkCJ3/bXhGeaAEsRT4CdKDu4SRfBEnKBVj xoWirBEKWpLNgafVQhfKjU+Id7elHjXGXV5xzZwLG8hOiOsxXhhmHdoki3WZ4Nc5U5J9 yxeg== X-Gm-Message-State: AJIora9c/eEC8Wa4/zszWhvp9QFm6Y4HNI81VjjXn9y35tiZ0I7zn37U eoW/z1m10Dv/1yUnz51QSQA43g== X-Google-Smtp-Source: AGRyM1td7OiTDDJKC5UOCJKA2KSSdhXte5R0MVbBPWtzUOmmETfHP5pTi96toOOFE2DuqbeHR+O24A== X-Received: by 2002:a17:90b:1e47:b0:1ed:2723:981a with SMTP id pi7-20020a17090b1e4700b001ed2723981amr17170127pjb.144.1656663664161; Fri, 01 Jul 2022 01:21:04 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id h18-20020a170902f7d200b001624cd63bbbsm14841818plw.133.2022.07.01.01.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:03 -0700 (PDT) From: Viresh Kumar To: Yangtao Li , "Rafael J. Wysocki" , Viresh Kumar , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH V2 07/30] cpufreq: sun50i: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:02 +0530 Message-Id: <195383ea6386102e430140f14d349769f6893fd6.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220701_012106_025794_884273B3 X-CRM114-Status: GOOD ( 16.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/sun50i-cpufreq-nvmem.c | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c index 75e1bf3a08f7..afb1a11f781c 100644 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c @@ -86,26 +86,29 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) { - struct opp_table **opp_tables; + int *opp_tokens; char name[MAX_NAME_LEN]; unsigned int cpu; u32 speed = 0; int ret; - opp_tables = kcalloc(num_possible_cpus(), sizeof(*opp_tables), + opp_tokens = kcalloc(num_possible_cpus(), sizeof(*opp_tokens), GFP_KERNEL); - if (!opp_tables) + if (!opp_tokens) return -ENOMEM; ret = sun50i_cpufreq_get_efuse(&speed); if (ret) { - kfree(opp_tables); + kfree(opp_tokens); return ret; } snprintf(name, MAX_NAME_LEN, "speed%d", speed); for_each_possible_cpu(cpu) { + struct dev_pm_opp_config config = { + .prop_name = name, + }; struct device *cpu_dev = get_cpu_device(cpu); if (!cpu_dev) { @@ -113,10 +116,10 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) goto free_opp; } - opp_tables[cpu] = dev_pm_opp_set_prop_name(cpu_dev, name); - if (IS_ERR(opp_tables[cpu])) { - ret = PTR_ERR(opp_tables[cpu]); - pr_err("Failed to set prop name\n"); + opp_tokens[cpu] = dev_pm_opp_set_config(cpu_dev, &config); + if (opp_tokens[cpu] < 0) { + ret = opp_tokens[cpu]; + pr_err("Failed to set OPP config\n"); goto free_opp; } } @@ -124,7 +127,7 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1, NULL, 0); if (!IS_ERR(cpufreq_dt_pdev)) { - platform_set_drvdata(pdev, opp_tables); + platform_set_drvdata(pdev, opp_tokens); return 0; } @@ -132,27 +135,24 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) pr_err("Failed to register platform device\n"); free_opp: - for_each_possible_cpu(cpu) { - if (IS_ERR_OR_NULL(opp_tables[cpu])) - break; - dev_pm_opp_put_prop_name(opp_tables[cpu]); - } - kfree(opp_tables); + for_each_possible_cpu(cpu) + dev_pm_opp_clear_config(opp_tokens[cpu]); + kfree(opp_tokens); return ret; } static int sun50i_cpufreq_nvmem_remove(struct platform_device *pdev) { - struct opp_table **opp_tables = platform_get_drvdata(pdev); + int *opp_tokens = platform_get_drvdata(pdev); unsigned int cpu; platform_device_unregister(cpufreq_dt_pdev); for_each_possible_cpu(cpu) - dev_pm_opp_put_prop_name(opp_tables[cpu]); + dev_pm_opp_clear_config(opp_tokens[cpu]); - kfree(opp_tables); + kfree(opp_tokens); return 0; }