Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp69366imm; Mon, 14 May 2018 21:10:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqY6cBzbrpAzd/FtaIK6mF3qjq81Dc0jwlGBYUjdBR6XNrIJTAsYtOEVvZVCSj+KEkjLYzj X-Received: by 2002:a17:902:a714:: with SMTP id w20-v6mr12327843plq.374.1526357425762; Mon, 14 May 2018 21:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526357425; cv=none; d=google.com; s=arc-20160816; b=m0+POQ6pKs/AXA68YNNDU19xby3FHoT7+4BXgXO+GLd7E9r9asfCzwODvolrf19ixN Pcamdi6afmjIMdJLTN72tjWmscluU6AIJBVzyHTF73Su/DpMPZkxS56KE+3YYpIlJooC iKIsP+oXF8cqY3Q1jWWYeHTKU/fSDKROx5C9BgGrzddHq2Qcj9wWRnlL30VGpW1VQU64 BBul1dHsnL/u4b5iGEbq7M2FI4A/Z8Mwik4AgeTQ36IvnT81/bfbKGQIXLZc2sMJYr0O O1zg1ViS4XVME+5UV824i1tUCY0be58SeSCW7/L5VbbV8GtsZyrn0kL3KQDs3ioYTk+A WM0A== 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=k4SgkFPHfffgVbGVMLHFs6+8o18rXmVyife2DGUgNCg=; b=rZmgj+azjPdaNUMW57xPhLWo/TuZjauHjbMM3Q3pUBzKr6xAvGNHKT7XbdQHyXzi8C F5L9W2TdTY272KwTSV1cEkk5pl8v96U6GBfcXcueYljl9hHkptzohOa+LBkBT7l5SuF7 F4MhCQPq3N0WWXhbwsYoqlVd3+wGwekl93wYRnqUCSTa1jLXzM9Sq6qjDw0L7xAvqmIk IWCYB4ZLoFMEp+JT84mREahFlu/pi+G/cJEHfoOpqCtWCm+h0YGm/vRBLg80Pk3nW7aC /J5dYQmrgTr688wmjqnaG0YFCI12hMtsBdEc1ngW9XAFYnLNHAwxgXSmUf3tQ1smrMwj n8Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jLOK1w3S; 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 90-v6si10867217plc.205.2018.05.14.21.10.11; Mon, 14 May 2018 21:10:25 -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=jLOK1w3S; 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 S1752168AbeEOEJa (ORCPT + 99 others); Tue, 15 May 2018 00:09:30 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:39159 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752139AbeEOEJ0 (ORCPT ); Tue, 15 May 2018 00:09:26 -0400 Received: by mail-pl0-f66.google.com with SMTP id c19-v6so8603575pls.6 for ; Mon, 14 May 2018 21:09:26 -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=k4SgkFPHfffgVbGVMLHFs6+8o18rXmVyife2DGUgNCg=; b=jLOK1w3SjcH5yBm3m2wIB8erndi7Z1nH+ama8jEAFZb0+qmeo43cHdhuI0IZC4QNvz ZeYdiP1denB1yWGEdJ65GurKqZeHtwtQDuDwmdh/9YLo1gjHhz/uGR09I/Mry3tuzs07 oRkF1lSctsSTwqNUaeaBcY5HfG7qoxZL1KBhM= 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=k4SgkFPHfffgVbGVMLHFs6+8o18rXmVyife2DGUgNCg=; b=Vfg5lE/V7PNx7yXy3zY9Qb8TYtxXYMhAFz0P1NZOmCojpGQIIDvYdRupCYK8kITpMQ b5bCxWg3eFyGDiYP4FxlD/SGFGuwOp1rxNpD0ry6btjjGLK05ZYg0l+v+dMmovMP+yTg 276lU78AhkXgFHCk96wYlwCENKO4y/R8RV7/Id07IRnIj3KKQ4UuksBbbhSzBZ9BhkfJ gmv6xkcaHi3goSIftwFO8rZO0+MgQEUAtcWA3zazcmAOBQLklpm19R2/bv33JIrNHon7 MWSmnSjTgZt23cCkprp5uZyJ6/5KRRKnfR3vxh8gBO4ImORUxeZ3Cl5ptg2hbJ9tBVy4 7zpg== X-Gm-Message-State: ALKqPwfW1CA5KQTCV2bEnnBHBnRCxu/TcKCUW7PV6IfGarC5nyJveWuJ 94H69Xl7HgjPvNYK49horkeUQQ== X-Received: by 2002:a17:902:7209:: with SMTP id ba9-v6mr12940135plb.119.1526357366185; Mon, 14 May 2018 21:09:26 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id d4-v6sm22796634pfl.24.2018.05.14.21.09.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 May 2018 21:09:25 -0700 (PDT) Date: Tue, 15 May 2018 09:39:22 +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 v6 12/14] cpufreq: Add Kryo CPU scaling driver Message-ID: <20180515040922.hbk4xqdweel2hvsr@vireshk-i7> References: <1526303520-5843-1-git-send-email-ilialin@codeaurora.org> <1526303520-5843-13-git-send-email-ilialin@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526303520-5843-13-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 14-05-18, 16:11, Ilia Lin wrote: > +static int __init qcom_cpufreq_kryo_driver_init(void) > +{ > + size_t len; > + int ret; > + u32 versions; > + enum _msm8996_version msm8996_version; > + u8 *speedbin; > + struct device *cpu_dev; > + struct device_node *np; > + struct nvmem_cell *speedbin_nvmem; > + struct opp_table *opp_temp = NULL; > + > + cpu_dev = get_cpu_device(SILVER_LEAD); > + if (IS_ERR_OR_NULL(cpu_dev)) > + return PTR_ERR(cpu_dev); > + > + msm8996_version = qcom_cpufreq_kryo_get_msm_id(); > + if (NUM_OF_MSM8996_VERSIONS == msm8996_version) { > + dev_err(cpu_dev, "Not Snapdragon 820/821!"); > + return -ENODEV; > + } > + > + np = dev_pm_opp_of_get_opp_desc_node(cpu_dev); > + 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, "Could not get nvmem cell: %d\n", ret); > + goto free_np; > + } > + > + speedbin = nvmem_cell_read(speedbin_nvmem, &len); > + > + 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; > + } > + > + ret = PTR_ERR_OR_ZERO(opp_temp = \ Why back slash here ? > + dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); > + if (0 > ret) > + goto free_np; > + > + dev_pm_opp_put_supported_hw(opp_temp); > + > + cpu_dev = get_cpu_device(GOLD_LEAD); > + ret = PTR_ERR_OR_ZERO(opp_temp = \ And here. > + dev_pm_opp_set_supported_hw(cpu_dev,&versions,1)); > + if (0 > ret) > + goto free_np; > + > + ret = PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", \ and here. > + -1, NULL, 0)); > + > + dev_pm_opp_put_supported_hw(opp_temp); And this is wrong. You don't need to call this in success case here. It may have worked for you as cpufreq-dt driver would have already been initialized, but that's not the case always. For example try inserting cpufreq-dt module after kernel boots and it will fail. > + > +free_np: > + of_node_put(np); > + > + return ret; > +} > +late_initcall(qcom_cpufreq_kryo_driver_init); > + > +MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Kryo CPUfreq driver"); > +MODULE_LICENSE("GPL v2"); > -- > 1.9.1 -- viresh