Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3953681imm; Thu, 17 May 2018 18:46:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoVtOSjhhxw5XME9Lma/ctOsjt10jUpQhwj/KC5afxTXlRFy9wKW3WvbNfVqGyBysADCx+h X-Received: by 2002:a17:902:9004:: with SMTP id a4-v6mr7368320plp.143.1526607980926; Thu, 17 May 2018 18:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526607980; cv=none; d=google.com; s=arc-20160816; b=LFWHn9you+5xz4j3R2s3EDQOFuDHJ8yL23Pt6eStfOERcI3ich9jVwXp9L71QhgbIx 01ZPfcyXz/rnIbudBdeWx/qyiB/hKm7FqK0rZ1dQSLFrIXL7qhfzyb2o/bEwjYYhlQ54 lAJp9KEuMebDuH8rbFD82kB743l3tGQoepHJ6+E7iUYNnTdpuY3n6kxH7XjkF2kfzo/K bfnHD56yiK21ORXYZqCYv0/D96N5Qd2sVnCYRo+G1JvgLBFr0e4ZePq6tnsSFUl28lVz LqINqUFdtqMcB8H9aOLyCC8POTBsixtZi25yGNIOm0hMI+M4Y9MeEE1LSRQ+A6juoHhI PBMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=oqRubp39STHmemvWMfIBiX+oDmtPBiyIyXjKncv+cts=; b=GHXXd0lZaoEvb68GMTRqdZS/hVJjtkuEjqn+aQwnsvInbX+ixu/5OLSA17joNLZ0m1 wPGdZ0emDUr1FaOzQNuit5un5RS3Emm1BPw/GlCciSn5JCahTClCsDgJYFZcS2r0KGWG IYZw973oTUWnSzTbpu3thnE5tIkOJuu3t69/tVWaUQpy/0hkBiKmjB1ZosBN2VNlNk6J DNEjBeOlkzqGYgSbiB0kkY25PoTPIsov0FZ86TACgrnZdDAd5bdYaXdsj/nDGkqnmu81 r3bdBWM8Vk6PrrCWZohbr7EnXTdQvt0WI+tpAblsFWq/mol3k8jDY6UJv7Kd4S1MEWq9 al0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SffEGK5P; 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; 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 w21-v6si6173467plp.199.2018.05.17.18.46.06; Thu, 17 May 2018 18:46:20 -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; dkim=pass header.i=@linaro.org header.s=google header.b=SffEGK5P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752059AbeERBpr (ORCPT + 99 others); Thu, 17 May 2018 21:45:47 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:43867 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751985AbeERBpn (ORCPT ); Thu, 17 May 2018 21:45:43 -0400 Received: by mail-pg0-f66.google.com with SMTP id p8-v6so2586238pgq.10 for ; Thu, 17 May 2018 18:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oqRubp39STHmemvWMfIBiX+oDmtPBiyIyXjKncv+cts=; b=SffEGK5P09fFBV2MPgovaJzwjGV0we/MWwjrQo4V52oX6f6faMC77dgG9lO3TIbbti f+X5tz/rBEkR4kdGKtRL7bTOBN+PuqaypbVO3MxHyVD4j/v3r43nY1ZOq+DGZ1CFRTjH utmuyEN8l8Ax7aOE/PHNNMxyaD8IeuMErVmDo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oqRubp39STHmemvWMfIBiX+oDmtPBiyIyXjKncv+cts=; b=dFwxoIxDdt/wUT5Q5GdEUGWWkqL+A1IYNE8QdJP9FQ9Vm/DowL/5JuaklLzgJpqzu/ S+6PfSpprKcX3nuPNRuR7lNktQ5WzVeduUmXDtFrjuUFE3uPLau8HehjWCQvAacq8AZf AnNCN0yC2EPG8/HNawIPsHip0Dlwpl2DSwDvHvWC36KOJO8XONlFhGy030PwRFpciYhM cWazlwbgzxIOmk2sy8/AOITWE+4usUdDiu2/nrvRGZT3e3O6AGNkrr437dijq6HXqYo5 1h6MkDJT9w5qZEmb+/UVHXHiFiovmKXj6Ds0naFJvMX+emMd0rEZMmMjyaDsTDWen80R 5QZA== X-Gm-Message-State: ALKqPwcvheMdsQUb1Y2Vz11OjQpmAOr6XW0oIPlNDDLGDcmCzGIAluFa amEFVcBTbKTvYX9bm70oJePxqg== X-Received: by 2002:a65:5105:: with SMTP id f5-v6mr5909482pgq.232.1526607942637; Thu, 17 May 2018 18:45:42 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id 65-v6sm7855575pgh.87.2018.05.17.18.45.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 18:45:41 -0700 (PDT) Date: Fri, 18 May 2018 07:15:38 +0530 From: Viresh Kumar To: Ilia Lin Cc: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, mark.rutland@arm.com, nm@ti.com, lgirdwood@gmail.com, broonie@kernel.org, andy.gross@linaro.org, david.brown@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rnayak@codeaurora.org, amit.kucheria@linaro.org, nicolas.dechesne@linaro.org, celster@codeaurora.org, tfinkel@codeaurora.org Subject: Re: [PATCH v8 10/15] cpufreq: Add Kryo CPU scaling driver Message-ID: <20180518014538.duphof6enscpm5vp@vireshk-i7> References: <1526555955-29960-1-git-send-email-ilialin@codeaurora.org> <1526555955-29960-11-git-send-email-ilialin@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526555955-29960-11-git-send-email-ilialin@codeaurora.org> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-05-18, 14:19, Ilia Lin wrote: > +static int __init qcom_cpufreq_kryo_driver_init(void) > +{ > + size_t len; > + int ret = 0; > + u32 versions; > + enum _msm8996_version msm8996_version; > + u8 *speedbin; > + struct device *cpu_dev_silver, *cpu_dev_gold; > + struct device_node *np; > + struct nvmem_cell *speedbin_nvmem; > + struct platform_device *pdev; > + struct opp_table *opp_silver = NULL; > + struct opp_table *opp_gold = NULL; No need to initialize them and you may want to arrange all above in decreasing order of their length. > + > + cpu_dev_silver = get_cpu_device(SILVER_LEAD); > + if (IS_ERR_OR_NULL(cpu_dev_silver)) > + return PTR_ERR(cpu_dev_silver); > + > + cpu_dev_gold = get_cpu_device(SILVER_LEAD); > + if (IS_ERR_OR_NULL(cpu_dev_gold)) > + return PTR_ERR(cpu_dev_gold); > + > + msm8996_version = qcom_cpufreq_kryo_get_msm_id(); > + if (NUM_OF_MSM8996_VERSIONS == msm8996_version) { > + dev_err(cpu_dev_silver, "Not Snapdragon 820/821!"); > + return -ENODEV; > + } > + > + np = dev_pm_opp_of_get_opp_desc_node(cpu_dev_silver); > + if (IS_ERR_OR_NULL(np)) > + return PTR_ERR(np); > + > + if (!of_device_is_compatible(np, "operating-points-v2-kryo-cpu")) { > + ret = -ENOENT; > + goto free_np; > + } > + > + speedbin_nvmem = of_nvmem_cell_get(np, NULL); > + if (IS_ERR(speedbin_nvmem)) { > + ret = PTR_ERR(speedbin_nvmem); > + dev_err(cpu_dev_silver, "Could not get nvmem cell: %d\n", ret); > + goto free_np; > + } > + > + speedbin = nvmem_cell_read(speedbin_nvmem, &len); > + nvmem_cell_put(speedbin_nvmem); > + > + switch (msm8996_version) { > + case MSM8996_V3: > + versions = 1 << (unsigned int)(*speedbin); > + break; > + case MSM8996_SG: > + versions = 1 << ((unsigned int)(*speedbin) + 4); > + break; > + default: > + BUG(); > + break; > + } > + > + opp_silver = dev_pm_opp_set_supported_hw(cpu_dev_silver,&versions,1); > + if (IS_ERR_OR_NULL(opp_silver)) { This API doesn't return NULL and so IS_ERR() would be sufficient. > + dev_err(cpu_dev_silver, "Failed to set supported hardware\n"); > + ret = PTR_ERR(opp_silver); > + goto free_np; > + } > + > + opp_gold = dev_pm_opp_set_supported_hw(cpu_dev_gold,&versions,1); > + if (IS_ERR_OR_NULL(opp_gold)) { same here. > + dev_err(cpu_dev_gold, "Failed to set supported hardware\n"); > + ret = PTR_ERR(opp_gold); > + goto free_opp_silver; > + } > + > + pdev = platform_device_register_simple("cpufreq-dt", -1, NULL, 0); > + if (!IS_ERR_OR_NULL(pdev)) > + goto out; Simply return from here and remove the useless label out. > + > + ret = PTR_ERR(pdev); > + dev_err(cpu_dev_silver, "Failed to register platform device\n"); > + dev_pm_opp_put_supported_hw(opp_gold); > + > +free_opp_silver: > + dev_pm_opp_put_supported_hw(opp_silver); > + > +free_np: > + of_node_put(np); > + > +out: > + return ret; > +} > +late_initcall(qcom_cpufreq_kryo_driver_init); Please resend only this patch now or just paste the new code in a mail here so that I can review it quickly and then you can resend the final version. Most of the patches aren't changing anyway. -- viresh