Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp393897imm; Thu, 7 Jun 2018 21:30:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJlYWRuwLnl2zl7KES8K8YY8/kMMxXtOihWisbzcnnGvj5cFkeoRhEo00WHNHAvZ1d/fCe9 X-Received: by 2002:a65:4081:: with SMTP id t1-v6mr3971533pgp.32.1528432202546; Thu, 07 Jun 2018 21:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528432202; cv=none; d=google.com; s=arc-20160816; b=HGXQn7WpLtlGpez83qN90bK4pwVimFj9Qx1t3zGxZRliXX6h2CbYMU6ilHahPtQHmN I/9mHzZG832AbQlqK5SACYEwUtzIg81M9MkK8r0SWmAVhYejjY7gLwIsMjWfS1lZwjMo o3vVrUNXRONde2I4Ip8z8IbVDp4HBr5UK7GXbmZBQMmbOeBJFl6PUg1MqIeMpPi3iz82 9ed3RPMYZVuopAy9Bii/MnxcdjSVTknTW42mD8gHceIMXSb09knUmr+JZdtmR5xp7CWN RNl/sqKwwUuXzpfIvl2BhlC0hUO6r91naa97HoYN4iLjhgrPRQcxO7xw7cOrdzon4Npj h43A== 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=DXA69csit/S+qXuxygjuAEUvNn+Jw/K1u34cJ5J37nA=; b=UwKxm6mnqb8vavrWXgD9Cphy+KPlL8w+5bV6Tw6Vwm1vjV+0XBShf3yz33HNAOpYW3 quYMxncDLeS1uQdeoxcYeA+7OWdr2z8ifd0wuw3DP3N1Ed2u26Qh/RbZvLia6/HA0dvI 9eXCxOFiV1SIKKI60bYyf5NDU/tIkt29ViZp/3eJ6oi+4kDCfUE3ruSMhTQ1wGezjczO X1pa9B93Q7wBqkm00g6DWHMDuUEcfOBBITwU/M6q9I9z0X1m6DKGItGOfCRGStKtigww OUYGQ97bsmBLqXOcJTq7wbIMn9RKoV8Elhh+MuH2ZlqZiJ86ud8mjIGezZmeQkJAxZvr O4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L1BfT0kA; 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 w10-v6si29049868ply.482.2018.06.07.21.29.48; Thu, 07 Jun 2018 21:30:02 -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=L1BfT0kA; 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 S1751117AbeFHE3X (ORCPT + 99 others); Fri, 8 Jun 2018 00:29:23 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:44122 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750859AbeFHE3V (ORCPT ); Fri, 8 Jun 2018 00:29:21 -0400 Received: by mail-pg0-f67.google.com with SMTP id p21-v6so5766593pgd.11 for ; Thu, 07 Jun 2018 21:29:21 -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=DXA69csit/S+qXuxygjuAEUvNn+Jw/K1u34cJ5J37nA=; b=L1BfT0kAuqk7tyqYt6pVJlGgz9ehRwiB0UkuHJT3aF5RheWVPnQoUx4UFsj8++b/Ho qgCNVNhe01tQyRiw7S4X/0RcZNDOmSBrQWiqt8D6+k4cj+8QDy4L+DYYQ1JW7J7kMeJ4 xa2nCksxz3sbm3TGFo1s3KDVuGb5ffUyuvZww= 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=DXA69csit/S+qXuxygjuAEUvNn+Jw/K1u34cJ5J37nA=; b=FpvyJLqrzNb6A7m/Ap17bCyfHqmDRbIasyRfxvg2FB2tK6GSkGGqBRsuTp2i+SdFaI P3frquSuHRuqU3X5xI/b46VThoZIl4gippiEdhdByc7uIA6VoT/loxlUn8Se95E2pEz3 eTkm7YAYH6rD6cscnRL66A3UL2JWgSFbqqWjLjXZyiDGjkWywtmkAdxWFSC0M9PhxT0F 1FUH3xhSNjlk8ShoXWL3NhM8nXI0AExZqnk/780vBnDdpUPnzENkXbHO/ZqLUe9DClMI u9T5NHi5NnlEOG+ka2L9BwpJSFkOEXuUjfruvKm0AiFO4ZTDxL9CXBU1lRuNa8w13rBd dYAw== X-Gm-Message-State: APt69E1Zye56JViGDm/xhZfJSNePv4LsbxtfWbj0MBiRiZDt4raIJshP +Ao9VGLxSwt6KsN7jc0gmhuRCQ== X-Received: by 2002:a63:6383:: with SMTP id x125-v6mr3744611pgb.277.1528432160970; Thu, 07 Jun 2018 21:29:20 -0700 (PDT) Received: from localhost ([223.226.91.101]) by smtp.gmail.com with ESMTPSA id p12-v6sm74780978pgn.26.2018.06.07.21.29.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 21:29:19 -0700 (PDT) Date: Fri, 8 Jun 2018 09:59:17 +0530 From: Viresh Kumar To: ilia.lin@gmail.com Cc: Ilia Lin , "Rafael J . Wysocki" , Arnd Bergmann , Dan Carpenter , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: kryo: Add module remove and exit Message-ID: <20180608042917.2t3el22xgwaezuqe@vireshk-i7> References: <20180607205827.1588-1-ilia.lin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180607205827.1588-1-ilia.lin@gmail.com> 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 07-06-18, 20:58, ilia.lin@gmail.com wrote: > From: Ilia Lin > > Add device remove and module exit code to make the driver > functioning as a loadable module. > > Fixes: ac28927659be (cpufreq: kryo: allow building as a loadable module) > Signed-off-by: Ilia Lin > --- > drivers/cpufreq/qcom-cpufreq-kryo.c | 24 +++++++++++++++++++++--- > 1 file changed, 21 insertions(+), 3 deletions(-) > > diff --git a/drivers/cpufreq/qcom-cpufreq-kryo.c b/drivers/cpufreq/qcom-cpufreq-kryo.c > index d049fe4b80c4..a08de0253169 100644 > --- a/drivers/cpufreq/qcom-cpufreq-kryo.c > +++ b/drivers/cpufreq/qcom-cpufreq-kryo.c > @@ -71,10 +71,10 @@ static enum _msm8996_version __init qcom_cpufreq_kryo_get_msm_id(void) > return version; > } > > +struct platform_device *cpufreq_dt_pdev; Move this and the other platform device pointer at the top of the file after the enum declarations. They don't look nice in the middle of nowhere. > static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > { > struct opp_table *opp_tables[NR_CPUS] = {0}; > - struct platform_device *cpufreq_dt_pdev; > enum _msm8996_version msm8996_version; > struct nvmem_cell *speedbin_nvmem; > struct device_node *np; > @@ -115,6 +115,8 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > > speedbin = nvmem_cell_read(speedbin_nvmem, &len); > nvmem_cell_put(speedbin_nvmem); > + if (IS_ERR(speedbin)) > + return PTR_ERR(speedbin); This doesn't look related to this patch. Should it be a different commit ? And I just saw definition of nvmem_cell_read() and it says the returned buffer must be freed by caller using kfree(). I dont' see you doing that. Please also check if any other such resources are there which you forgot to free. > > switch (msm8996_version) { > case MSM8996_V3: > @@ -162,8 +164,15 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > return ret; > } > > +static int qcom_cpufreq_kryo_remove(struct platform_device *pdev) > +{ > + platform_device_unregister(cpufreq_dt_pdev); > + return 0; > +} > + > static struct platform_driver qcom_cpufreq_kryo_driver = { > .probe = qcom_cpufreq_kryo_probe, > + .remove = qcom_cpufreq_kryo_remove, > .driver = { > .name = "qcom-cpufreq-kryo", > }, > @@ -174,6 +183,7 @@ static const struct of_device_id qcom_cpufreq_kryo_match_list[] __initconst = { > { .compatible = "qcom,msm8996", }, > }; > > +struct platform_device *kryo_cpufreq_pdev; > /* > * Since the driver depends on smem and nvmem drivers, which may > * return EPROBE_DEFER, all the real activity is done in the probe, > @@ -198,8 +208,9 @@ static int __init qcom_cpufreq_kryo_init(void) > if (unlikely(ret < 0)) > return ret; > > - ret = PTR_ERR_OR_ZERO(platform_device_register_simple( > - "qcom-cpufreq-kryo", -1, NULL, 0)); > + kryo_cpufreq_pdev = platform_device_register_simple( > + "qcom-cpufreq-kryo", -1, NULL, 0); > + ret = PTR_ERR_OR_ZERO(kryo_cpufreq_pdev); > if (0 == ret) > return 0; > > @@ -208,5 +219,12 @@ static int __init qcom_cpufreq_kryo_init(void) > } > module_init(qcom_cpufreq_kryo_init); > > +static void __init qcom_cpufreq_kryo_exit(void) > +{ > + platform_device_unregister(kryo_cpufreq_pdev); > + platform_driver_unregister(&qcom_cpufreq_kryo_driver); > +} > +module_exit(qcom_cpufreq_kryo_exit); > + > MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Kryo CPUfreq driver"); > MODULE_LICENSE("GPL v2"); -- viresh