From patchwork Thu Apr 4 05:09:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 161741 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1155537jan; Wed, 3 Apr 2019 22:09:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsRs4ObPnO/UOx+tR5w4pMXdu65FqFBeYNvYorXYkKQ51fIhSWO/L1VOR+w7BoZ2kdmkyY X-Received: by 2002:a17:902:2c01:: with SMTP id m1mr4209380plb.186.1554354593449; Wed, 03 Apr 2019 22:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554354593; cv=none; d=google.com; s=arc-20160816; b=NdUb8wq6i+dBZVTKPKCVfb6Awbo6KcerTMfhJhwruaDAXXLf2Qk97LOXAn4uCka7si LKv3BC3z4korVImQcWoqoc4tyGA32BCxmRQON5CpJ0KqsH4ivfZ5JNs4fV+z+sv53lrp y0Tbxz44LVukVuiVlR8VtALqPbmFIC91Y+ncVOZV666pFf+2/TQFufUtv9FokHGzxpWw 8C8afzGmmbQMnxIjmz3ztXEhqoxbglqXXP0zntyF8QvGnENYmgbBKNwdzINv+uv8E1R5 oSHNbl6hK43RsfGLIYJkd5o0pX0+OtcpdBl9PGYj5eTu/KfpLO8HhmEkT+BXg7vEBStj zIZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vQdCIQWz2/OSkRD/KWHO1VP+gkavuY4twT+b1yBYoCM=; b=gqyFqn0H6s81sJTou6rJ90xSH6nv+JC+vjVXI6t264qP4BY3DhSeWIlizZ1axvr21V pYErDX3cWpFasjZDZeSfWW+aLnNkr88jRfVxz1HXYRQ3z56O0j2MxQketRld/x64wmSb r3oWKCzvgnB7+vM+A/1OSoXZaAxRWxH1RgUa7IHoRiAHoEQ2HHh/6FYG2pvoc+PdnQL5 C9ciJBWvVu4esERGt7/lOVvMYz6vKlwBCAngjUHcalBAEZBbGTp+5L5jJ5/6JVe6432x keO7X2nz4XWF8diTnDshJgJFEkiHfVARPhtYHz00lCQwrNFeYf2MFmgjEx2vBfqhPYVv YLFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A8KoeW3L; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id a13si13819345pgi.60.2019.04.03.22.09.52; Wed, 03 Apr 2019 22:09:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A8KoeW3L; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 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 S1726530AbfDDFJs (ORCPT + 15 others); Thu, 4 Apr 2019 01:09:48 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33103 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbfDDFJr (ORCPT ); Thu, 4 Apr 2019 01:09:47 -0400 Received: by mail-pf1-f194.google.com with SMTP id i19so745628pfd.0 for ; Wed, 03 Apr 2019 22:09:47 -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=vQdCIQWz2/OSkRD/KWHO1VP+gkavuY4twT+b1yBYoCM=; b=A8KoeW3LQ8IeBLIEjTe8gdpRfup7E9tSobKG3ChSpGgnRBLLI5S+oASEFkZJ/OnO/C +YqVgGk3jFkYaub4hwjTph4fLbE58mc+ewR0ghD19ZGrWHBPmQMFLJQEmaVSirgnQmSi Daf4++Fy0ofkTw0yTeu1/t+YonjdUc++ptCaWDXfn5hcldU489IJOlP6PobXPjVT+0xq ZkS0lbXx+8YDEYrVbpFLcvjvKkdE90MWz96O6DB+ts4aSfuotARcwZj8BgADd29q553o +C9PP65zBS+OEox1on2LaJDtRBXq3RUpT9mCNsW7R4VeeDrUNrI0UsNdri43GKbkkwqT Blag== 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=vQdCIQWz2/OSkRD/KWHO1VP+gkavuY4twT+b1yBYoCM=; b=dbLD5PeKUtvMJZxTaUsBPSSLU6dFwQj3oOt3dfR7rd9VQENBWYBELP7En6WCTIkyCD cn+E63NTUTF17L7aVTIao2lUs/Gzy0H6IIMi4fTiRfrC/bbjoeYZNricsp/UnwhxMiuY w7inM1c2jaQ5hvMuIzx8eeo64lH177BTfXDFO+iZQofPn43ImT3FhI64n1XXcSe3txEm 1D/Ah24vw1J6dehsjY/ARcKU0sDL2vnCvKs0HQuvfSDwYjvgDca44XaEV5PDwpwzNDTq +kRxiYVH0WvvD7LFiC+Xy/VsFZ2LmEzj90qHNOUZ/teccu1y2nf9jS8/ZQddMO9XIsnU PxSg== X-Gm-Message-State: APjAAAWTzY28grua1ExWDaTfZm3ndyz3IjQz0MoQCCIhL09/5xe02mVm vrTtox3RMmAVjxjeGkNjK26tuA== X-Received: by 2002:a63:4750:: with SMTP id w16mr3765472pgk.256.1554354586830; Wed, 03 Apr 2019 22:09:46 -0700 (PDT) Received: from centauri.imgcgcw.net ([147.50.13.10]) by smtp.gmail.com with ESMTPSA id a129sm50589089pfa.152.2019.04.03.22.09.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 22:09:46 -0700 (PDT) From: Niklas Cassel To: Andy Gross , David Brown , Liam Girdwood , Mark Brown Cc: linux-arm-msm@vger.kernel.org, jorge.ramirez-ortiz@linaro.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/9] drivers: regulator: qcom_spmi: enable linear range info Date: Thu, 4 Apr 2019 07:09:22 +0200 Message-Id: <20190404050931.9812-2-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190404050931.9812-1-niklas.cassel@linaro.org> References: <20190404050931.9812-1-niklas.cassel@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jorge Ramirez-Ortiz Signed-off-by: Jorge Ramirez-Ortiz --- drivers/regulator/qcom_spmi-regulator.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.20.1 diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c index 3193506eac6f..f2edf510b0df 100644 --- a/drivers/regulator/qcom_spmi-regulator.c +++ b/drivers/regulator/qcom_spmi-regulator.c @@ -1907,6 +1907,7 @@ MODULE_DEVICE_TABLE(of, qcom_spmi_regulator_match); static int qcom_spmi_regulator_probe(struct platform_device *pdev) { const struct spmi_regulator_data *reg; + const struct spmi_voltage_range *range; const struct of_device_id *match; struct regulator_config config = { }; struct regulator_dev *rdev; @@ -1996,6 +1997,12 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) } } + if (vreg->logical_type == SPMI_REGULATOR_LOGICAL_TYPE_HFS430) { + /* since there is only one range */ + range = spmi_regulator_find_range(vreg); + vreg->desc.uV_step = range->step_uV; + } + config.dev = dev; config.driver_data = vreg; config.regmap = regmap; From patchwork Thu Apr 4 05:09:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 161743 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1155882jan; Wed, 3 Apr 2019 22:10:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqy49S+9LRQMXcISwFcrOFvBKqxaRbog6atoRiDFK1jkH3nbnYXK+XmLqFWa4W1HV8FRJEoy X-Received: by 2002:a62:e411:: with SMTP id r17mr3634400pfh.127.1554354614103; Wed, 03 Apr 2019 22:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554354614; cv=none; d=google.com; s=arc-20160816; b=jqGFFfTaY3PWXm024I1K7BXRE1nsmfEcGzkAHVYprIm93+efRWCuXQbr1Y+PAK7zHd gTIpEu6jhCszfTWQcT4rBFXtRpeLru/iaO/SjiqPXoo6Jz6QGHXqIBNoJWsWw8z1FFUM /mSlUqHsWFmBn56D26ZrfCXs4UQG2xI1AcvNakkk7L4wjhPCpgNKvSpLVQltC3vYdnQv iDxlFg7Xf4CIJAthaibKwRi9+hoigqRA6jMDcsF4Z38gGUzit6GqFjIolOwUAJ+/fWC6 K8z3IHsfV/41I8ahX0h5bRkf1ct+SO5+wTKoMrtpQ1iAwHmt2WOXtV/xsxIRjyxI9SZ7 BFLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TwZwcfQZmyrQh4osKkmpWYd/wJZhOgCuylNR0zMT/RE=; b=YaDLpPv2XWxpJLCwb0h/qh22k8Z7Y/MHbASq5OrJyV6m5wN1U9d58XaVC7gmA2r0q8 fQRYJ6KMWie3wY96eoGedZgd+TIB5vGwmRp5O0G0vqoZUWFOF9EkX418sNJXRHeJad9F 1kvWzliGlV2PyU7FXoYOfwvum8FdovjaskDvUbGHvb6SVjc1qQOCAN3f+ktPeH+9gaha VlKszAnUHg1hPdhxWVEprTvgmB0OVgYroFodyoHFOhGg/mOVynbCDQ8VtkxR0jrM5fJD VSdOZC88an4b/KaeK8trIJNsrlwvUdyaGS7jL5sFVzh7b9pNqi+PKNSojYQtG5z9QHwU BTkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sbAT5d8j; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id s34si15645940pgl.97.2019.04.03.22.10.13; Wed, 03 Apr 2019 22:10:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sbAT5d8j; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 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 S1726475AbfDDFKN (ORCPT + 15 others); Thu, 4 Apr 2019 01:10:13 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:34996 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726815AbfDDFKN (ORCPT ); Thu, 4 Apr 2019 01:10:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id t21so740386pfe.2 for ; Wed, 03 Apr 2019 22:10:12 -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=TwZwcfQZmyrQh4osKkmpWYd/wJZhOgCuylNR0zMT/RE=; b=sbAT5d8jHLX0Y2LokpDIv98MIwAZ/VaN2rk89O34Ti1oWVd98AtCEanCie7K8Dq/Z3 hggcB0rHomr46Chchxx0pofgmgODT5v1K3ToZfsS2b+Zw4i9w+lWgskc1CeuUP/eC95K FRpGzuFsp1J+i/N7dsltQW+dYxbOr1qiiZ+xBUag41o5Au3BrBD8hqegSgaHNv+cU5JM RRsx4sYxjpdVx95DV7DO80muxgm3QX+mXe8taS06wEjvRb2Zdos+piWLasXuERBL72sy y4FXgU+8yocCUHGnoH1lD9p12CNP32rQZsBDyU2sPRTad2Cz1eGKfPr+R4OaYX8nA3cF pe3w== 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=TwZwcfQZmyrQh4osKkmpWYd/wJZhOgCuylNR0zMT/RE=; b=RRiwqKk6WHJkOzGHJcvS6A/GErqSoHKX0OvlNqUM7SmewzX6/t9aRVsEb/a8wVLrz+ mlvVFd8f3TBaFLVvfDaWwWPMkCtUHhs83sbIjeo4+OyrrDtFdGLv3V431cA2u0qD0KO5 OIT0dbR/6AZD7scjUp4qCnlC4swJZX209BA2X3P4dm/WsaRUzzRKbm9QK5YaYre0ZXdA MtiGHkPsuWQtdIb/YEdfdARjv1Ey/Yy28haDnGEBFYOK0Zf/yXznOY2DRn9f+KpptE/0 aH8Lq9KtsWRpsKYuGktedA8wrl/1AGbHv44z10Ld/FSaHH96gQ+GbcORJZB5+uF/v/bo ZK4w== X-Gm-Message-State: APjAAAWp2Jm+XI3Xvs1SxCTwVK6SQNxVa5e0A6o4a+Ln1TwducnKJfwz 0+kfQCI4Fz9IT91l4ByNnAH4lg== X-Received: by 2002:a65:654c:: with SMTP id a12mr3799647pgw.101.1554354612126; Wed, 03 Apr 2019 22:10:12 -0700 (PDT) Received: from centauri.imgcgcw.net ([147.50.13.10]) by smtp.gmail.com with ESMTPSA id q80sm27623011pfa.66.2019.04.03.22.10.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 22:10:11 -0700 (PDT) From: Niklas Cassel To: Andy Gross , David Brown , "Rafael J. Wysocki" , Viresh Kumar Cc: linux-arm-msm@vger.kernel.org, jorge.ramirez-ortiz@linaro.org, Niklas Cassel , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/9] cpufreq: qcom: create a driver struct Date: Thu, 4 Apr 2019 07:09:24 +0200 Message-Id: <20190404050931.9812-4-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190404050931.9812-1-niklas.cassel@linaro.org> References: <20190404050931.9812-1-niklas.cassel@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org create a driver struct to make it easier to free up all common resources, and only call dev_pm_opp_set_supported_hw() if the implementation has dynamically allocated versions. Co-developed-by: Jorge Ramirez-Ortiz Signed-off-by: Jorge Ramirez-Ortiz Signed-off-by: Niklas Cassel --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 69 ++++++++++++++++++---------- 1 file changed, 46 insertions(+), 23 deletions(-) -- 2.20.1 diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index 652a1de2a5d4..366c65a7132a 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -43,6 +43,11 @@ enum _msm8996_version { NUM_OF_MSM8996_VERSIONS, }; +struct qcom_cpufreq_drv { + struct opp_table **opp_tables; + u32 *versions; +}; + static struct platform_device *cpufreq_dt_pdev, *cpufreq_pdev; static enum _msm8996_version qcom_cpufreq_get_msm_id(void) @@ -76,12 +81,16 @@ static enum _msm8996_version qcom_cpufreq_get_msm_id(void) static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, struct nvmem_cell *speedbin_nvmem, - u32 *versions) + struct qcom_cpufreq_drv *drv) { size_t len; u8 *speedbin; enum _msm8996_version msm8996_version; + drv->versions = kzalloc(sizeof(*drv->versions), GFP_KERNEL); + if (!drv->versions) + return -ENOMEM; + msm8996_version = qcom_cpufreq_get_msm_id(); if (NUM_OF_MSM8996_VERSIONS == msm8996_version) { dev_err(cpu_dev, "Not Snapdragon 820/821!"); @@ -94,10 +103,10 @@ static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, switch (msm8996_version) { case MSM8996_V3: - *versions = 1 << (unsigned int)(*speedbin); + *drv->versions = 1 << (unsigned int)(*speedbin); break; case MSM8996_SG: - *versions = 1 << ((unsigned int)(*speedbin) + 4); + *drv->versions = 1 << ((unsigned int)(*speedbin) + 4); break; default: BUG(); @@ -110,15 +119,14 @@ static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, static int qcom_cpufreq_probe(struct platform_device *pdev) { - struct opp_table **opp_tables; + struct qcom_cpufreq_drv *drv; int (*get_version)(struct device *cpu_dev, struct nvmem_cell *speedbin_nvmem, - u32 *versions); + struct qcom_cpufreq_drv *drv); struct nvmem_cell *speedbin_nvmem; struct device_node *np; struct device *cpu_dev; unsigned cpu; - u32 versions; const struct of_device_id *match; int ret; @@ -141,23 +149,31 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) return -ENOENT; } + drv = kzalloc(sizeof(*drv), GFP_KERNEL); + if (!drv) + return -ENOMEM; + speedbin_nvmem = of_nvmem_cell_get(np, NULL); of_node_put(np); if (IS_ERR(speedbin_nvmem)) { if (PTR_ERR(speedbin_nvmem) != -EPROBE_DEFER) dev_err(cpu_dev, "Could not get nvmem cell: %ld\n", PTR_ERR(speedbin_nvmem)); - return PTR_ERR(speedbin_nvmem); + ret = PTR_ERR(speedbin_nvmem); + goto free_drv; } - ret = get_version(cpu_dev, speedbin_nvmem, &versions); + ret = get_version(cpu_dev, speedbin_nvmem, drv); nvmem_cell_put(speedbin_nvmem); if (ret) - return ret; + goto free_drv; - opp_tables = kcalloc(num_possible_cpus(), sizeof(*opp_tables), GFP_KERNEL); - if (!opp_tables) - return -ENOMEM; + drv->opp_tables = kcalloc(num_possible_cpus(), sizeof(*drv->opp_tables), + GFP_KERNEL); + if (!drv->opp_tables) { + ret = -ENOMEM; + goto free_drv; + } for_each_possible_cpu(cpu) { cpu_dev = get_cpu_device(cpu); @@ -166,10 +182,12 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) goto free_opp; } - opp_tables[cpu] = dev_pm_opp_set_supported_hw(cpu_dev, - &versions, 1); - if (IS_ERR(opp_tables[cpu])) { - ret = PTR_ERR(opp_tables[cpu]); + if (drv->versions) + drv->opp_tables[cpu] = + dev_pm_opp_set_supported_hw(cpu_dev, + drv->versions, 1); + if (IS_ERR(drv->opp_tables[cpu])) { + ret = PTR_ERR(drv->opp_tables[cpu]); dev_err(cpu_dev, "Failed to set supported hardware\n"); goto free_opp; } @@ -178,7 +196,7 @@ static int qcom_cpufreq_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, drv); return 0; } @@ -187,26 +205,31 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) free_opp: for_each_possible_cpu(cpu) { - if (IS_ERR_OR_NULL(opp_tables[cpu])) + if (IS_ERR_OR_NULL(drv->opp_tables[cpu])) break; - dev_pm_opp_put_supported_hw(opp_tables[cpu]); + dev_pm_opp_put_supported_hw(drv->opp_tables[cpu]); } - kfree(opp_tables); + kfree(drv->opp_tables); +free_drv: + kfree(drv->versions); + kfree(drv); return ret; } static int qcom_cpufreq_remove(struct platform_device *pdev) { - struct opp_table **opp_tables = platform_get_drvdata(pdev); + struct qcom_cpufreq_drv *drv = platform_get_drvdata(pdev); unsigned int cpu; platform_device_unregister(cpufreq_dt_pdev); for_each_possible_cpu(cpu) - dev_pm_opp_put_supported_hw(opp_tables[cpu]); + dev_pm_opp_put_supported_hw(drv->opp_tables[cpu]); - kfree(opp_tables); + kfree(drv->opp_tables); + kfree(drv->versions); + kfree(drv); return 0; }