Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1665786rwe; Fri, 2 Sep 2022 01:25:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MTXYDqggEGKke8Ob+qpz8LW6yLu1VLl5WundX9Ic0inWvyrSabpnMTz56ZGKdjfFguRgQ X-Received: by 2002:a17:906:5d07:b0:730:9e98:8fbf with SMTP id g7-20020a1709065d0700b007309e988fbfmr26013050ejt.610.1662107099797; Fri, 02 Sep 2022 01:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662107099; cv=none; d=google.com; s=arc-20160816; b=WKpmihi3qY/CAD03lIAjo1m37wu7SjJd4DJo53IAXEW5uq+q/Tri4frvJdDqUgoRX8 b/sd0n2ZtqJLbdldVl099s6r24mZx0pgnfNWLOEY9Di0W7aX+wXxbC8/hs8KyV3BK1S+ BuueTV2kzZ+R4Nfobyf/uDxZAG4ns9cnKBs9w7HpqnyHBY1K2ZGPT5GZI+kGvzGFDc3D ZEoDE7DCNUbObl0BvmyKumEpZnvgx58yTFxH8kMZH+ZgZg+TGIQ7AIobqOYQvAQMS8hQ qVZR5Fzw3gxjQPWbQfY0SSOBdaK8YMckNNQvbFvHqSwsVLGXlLx9TTxRpJGP7Us9luMX 17LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Egb33cWpKmapa+3bxFZDMgPGsQPWHjyQz/db5YmaJdM=; b=Iip5cqRKqjq3C6xhfhK0MnxdBtto3TooLCqI11tmNlWhxClZh3KpsjjM27FSpbDEzL Wx0/I5VWj2KMgPaOQpzvzclqAJQ7fVJcjEH2Thjdwv9vwPB86LmFG/Jje37+fia4sNGs sGBpvPeavOcjP0uMwP+FDVwV60vGjG4qV3LtDuagvT2T94XS9Jo7Z0gzb8felepUy+z5 RMLa3cyRoTJuuHSf9DhBiwiR1hgmAFpZh7FLZsDA4Q7SNr8aEQ/BtfKNQ+SgrM5ElkoE MsAWWPme9g2Srspm8NgCkHLhM4G11eEFLv/UfO7rHY0m8eBweFuftCdYxiXjHELyHeaD JMeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs41-20020a1709073ea900b0072ee922047asi1835607ejc.590.2022.09.02.01.24.33; Fri, 02 Sep 2022 01:24:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235636AbiIBH7J (ORCPT + 99 others); Fri, 2 Sep 2022 03:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235608AbiIBH6z (ORCPT ); Fri, 2 Sep 2022 03:58:55 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F3A9BD77B; Fri, 2 Sep 2022 00:58:47 -0700 (PDT) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJqvn4Fq5zlWh8; Fri, 2 Sep 2022 15:55:17 +0800 (CST) Received: from huawei.com (10.67.174.96) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 15:58:44 +0800 From: Zhang Jianhua To: , CC: , , Subject: [PATCH -next v2] rtc: fsl-ftm-alarm: Use module_init and add module_exit Date: Fri, 2 Sep 2022 15:55:25 +0800 Message-ID: <20220902075525.379699-1-chris.zjh@huawei.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.96] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fsl-ftm-alarm driver can be built out of tree, so change the macro device_initcall() to module_init() for standard usage. fsl-ftm-alarm registers a platform driver in module_init function, however there is no module_exit function to unregister it, and it will occur resource leak, so add ftm_alarm_exit() function for module_exit. Signed-off-by: Zhang Jianhua --- v2: - modify the commit message for more accurate description --- drivers/rtc/rtc-fsl-ftm-alarm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c index c0df49fb978c..28bdc6c97b64 100644 --- a/drivers/rtc/rtc-fsl-ftm-alarm.c +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c @@ -332,7 +332,13 @@ static int __init ftm_alarm_init(void) return platform_driver_register(&ftm_rtc_driver); } -device_initcall(ftm_alarm_init); +static void __exit ftm_alarm_exit(void) +{ + platform_driver_unregister(&ftm_rtc_driver); +} + +module_init(ftm_alarm_init) +module_exit(ftm_alarm_exit) MODULE_DESCRIPTION("NXP/Freescale FlexTimer alarm driver"); MODULE_AUTHOR("Biwen Li "); -- 2.31.0