Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3176061imm; Sun, 17 Jun 2018 13:02:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL6tRk5iiwEHJ5DHK3QpdOLnH3f+uKVSIjvbYzQ9sfNBXM3NhLtufuWV9FkYsrVEJOSGTNq X-Received: by 2002:a65:57c6:: with SMTP id q6-v6mr8733446pgr.160.1529265767548; Sun, 17 Jun 2018 13:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529265767; cv=none; d=google.com; s=arc-20160816; b=m9008qryeNLTL+Fk1FZdRL1Mq2Qn2QWXSA6jzgIvqhp+HoOVy79xXMUlhuelKR/Kyd B8kFixH8gguHqgaak4vzdy+PEQhtFxkCcZWOgH98HoNktyMaY/UC50TkW7k+tadMPm+q hSFgppe/UMmQrtqMRS4VK7jzYoJTJIoIJ6WNXGFqSgkeYSrb4YCdHECE8WELCcH6L/SZ IGhLzzB9mgTCVE2VbQgLGw0QM4NVSD3fs1uWi7hJqeC2Te8vZis5CbOourDNJqPy70j9 QBmRUeFNxJhQFLFr+eU/DW+xw16Rc8mSV+a1fVFj+F4C+JHMfjkXW2VFY6XdPsnEuOAH KSXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=d4zT/6YexChyiDRVTQtrztEwPasvSPv6qHjHtaZWTXY=; b=AcjCsESMvT1CbkgENIMtXAyFb0VkAaxsfj9UC/kNXaIcS52gybw8mRmU+2j/cn3ILL ExDtGyhueYFqBZcgPf2J3Cf9AB4MjPAXuynzXIPDH07JqKLh829OMnwdUEG87Yrhud8Q QASnzATtho78H12Z096+R22F3kmTs/N4lFbuZNNsZAl6nE+TczdFNw6KwIofEO9usvu1 hV99CCzac+/cXuJ2YPjgJu398bYPPj1BZYssRUMw6TkYZvanE8bHRb9OZ4q+dV4qMZL5 eGG20I1zN/EJ3R1nRGGazyN3mCLyMMsMXLdLBGnrAZWBJCVXPpWAz6ndmKi6paBkPfbl MGxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V0Rr8kuZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4-v6si4615901plc.436.2018.06.17.13.02.33; Sun, 17 Jun 2018 13:02:47 -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=@gmail.com header.s=20161025 header.b=V0Rr8kuZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933974AbeFQUCI (ORCPT + 99 others); Sun, 17 Jun 2018 16:02:08 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:39232 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933406AbeFQUCG (ORCPT ); Sun, 17 Jun 2018 16:02:06 -0400 Received: by mail-wr0-f193.google.com with SMTP id w7-v6so14637882wrn.6; Sun, 17 Jun 2018 13:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=d4zT/6YexChyiDRVTQtrztEwPasvSPv6qHjHtaZWTXY=; b=V0Rr8kuZs7pYgFcClIvLX52AEU6jJmgbLRDI0DHLp4J1HznEqpb7nLuXa/l5gHzPGb 2kq8PYjplI0nNHxIJOEm5+xx2FmJNGmdXLMmhUAQZRvyrnMFyeH06vqPdN6+V/Enqv/b 9ZLcu+m04vONY1DEnx21K0Jv/AUvXVrLS13+ynjmi9WSr9/51YH9OqbNuw2mzUJK6Pho /goGes1/MRWrwklFTTfv1e1xMypOLjAetiWjdiuesLp6yVBTClRTLLTY+DnT1ZXcC/Gp GVNp3ndeTQMXNOkZ6qAXda7tZBL2XCiaXTEbJqwD/bE2SRjafdJ6FKD+Nst6hGXW3qpw QtmQ== 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; bh=d4zT/6YexChyiDRVTQtrztEwPasvSPv6qHjHtaZWTXY=; b=IlnFpVv5zEvLg6ax/AlR/IIDzX+GU1/+7hmFgixDSu9mKO+DEEsaWQMYAT8EyrH8Yu QWM0geOzq0ObPTjzx+XI33mkKWWTax1IIdAvlCk0+add3gTr49TcW/C/Q9bvYbe8CHqG dQnKR3XMz18J6Degax/uU1G5Q4Qqnrr+NZ9a1vEOwgiycqmOrZ/nOGnFhRrKf6bvjLDw UHTs04ZTFLVAGnJWCqgJ/rDuI/t5J5+Mztosjx5voAYeuUATnA2iMMfENxFTDzGwGdwh UHSffwtxB5BVLmOxWWmYMNHXdkzS1UDHi0tFAgAl8bJgoAMJ2gq8h4KTKrSxjLpzzu4l NWkw== X-Gm-Message-State: APt69E1KT+l2hJp038A/cH3B0o5ma3kysubC3V1i0zqXS+/6KeJcBwXG n9nJSBt0ApJVnONA1AkerZE= X-Received: by 2002:adf:e392:: with SMTP id e18-v6mr8385966wrm.94.1529265725042; Sun, 17 Jun 2018 13:02:05 -0700 (PDT) Received: from gcc67.tetaneutral.net (gcc67.tetaneutral.net. [2a03:7220:8080:c00::1]) by smtp.gmail.com with ESMTPSA id j131-v6sm6917375wmb.35.2018.06.17.13.02.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jun 2018 13:02:04 -0700 (PDT) From: ilia.lin@gmail.com To: ilia.lin@gmail.com Cc: "Rafael J. Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] cpufreq: kryo: Add module remove and exit Date: Sun, 17 Jun 2018 22:01:46 +0200 Message-Id: <20180617200146.16425-1-ilia.lin@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180614204212.2028-1-ilia.lin@gmail.com> References: <20180614204212.2028-1-ilia.lin@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-kryo.c b/drivers/cpufreq/qcom-cpufreq-kryo.c index 74b9b93d511b..01bddacf5c3b 100644 --- a/drivers/cpufreq/qcom-cpufreq-kryo.c +++ b/drivers/cpufreq/qcom-cpufreq-kryo.c @@ -42,6 +42,8 @@ enum _msm8996_version { NUM_OF_MSM8996_VERSIONS, }; +struct platform_device *cpufreq_dt_pdev, *kryo_cpufreq_pdev; + static enum _msm8996_version __init qcom_cpufreq_kryo_get_msm_id(void) { size_t len; @@ -74,7 +76,6 @@ static enum _msm8996_version __init qcom_cpufreq_kryo_get_msm_id(void) 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; @@ -165,8 +166,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", }, @@ -201,8 +209,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; @@ -211,5 +220,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"); -- 2.11.0