Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp106370rwe; Fri, 26 Aug 2022 01:22:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR4HzjU7PvrGXRYrJc9EWqPrsyK7/8Dt3+qquyDKevbKGM2p5IMiYIe+kj9STbBeYxDf7mCH X-Received: by 2002:a17:90b:35c1:b0:1fd:6992:f82a with SMTP id nb1-20020a17090b35c100b001fd6992f82amr1053436pjb.188.1661502156654; Fri, 26 Aug 2022 01:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661502156; cv=none; d=google.com; s=arc-20160816; b=o7VVGSmLvX/AfGy7s9V5fo4DXyx12cU7B9lDoqpOw4JVPO8gTWVR0DDGWzAyKNpNR4 RZkIPZKtLyByIu5xt2L6wHqa1smv/m0gF+QySbSQV/aFKC4zyJIBww54FKyTR4U4ATNs UlfXomrb/FNRMpHQlwy6ndI0EfGxwlNcQifGZTeB4l3gxgKwnnA0/x5Gu8T5TPxG/ux7 4uNl8hks3ndQDjEBIRCbeytam/K7FJpowgnC7+E64SET+RRRPrSB5FdC3F4feqELnLJx w1O4bz7usztdBuA9E3gVWSOCII9NwWLt8xabTzC8yzTivYCWI7U3LQ3NnvBNszxYmgf0 q45w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=Iz69lCM22bgS52J/N7S//yrPzPAWpyoFT/oRcZMoi6M=; b=iMDkKfM1vP58rE3nSxNPUlCy+9FyhUrSGvqRe6Tq1vTogOAYHi0eHGWkVmPfla8ERq V7Kl06+cNW3OIgS0U/VRFYICXpcBaUbmLq/qqWD+zo0Pfw6GC7eGwuBmO+0KJpjtH2B+ GsDFaHd0kmM5gEJWFyik3hbfDZaJGZflCBPR3HQBjR6ZzGcvSQghFBlYLTBSyQ98sHHO BSzZMw0fZsrONhkxJanaPvFzOgThepi9hyvXj8UKCt4WMlKrSXdV3K7c8UAEKCkYDVX+ VHGgTU/+Jo+QxtaoBRpkwc2FqWscLINSNgvLzQzt3u81B0YomPiCsACPeL8DNlA6I2Yn re8w== 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 pg3-20020a17090b1e0300b001e29c6b2ff5si1599237pjb.151.2022.08.26.01.22.25; Fri, 26 Aug 2022 01:22:36 -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 S245597AbiHZHp6 (ORCPT + 99 others); Fri, 26 Aug 2022 03:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245595AbiHZHpr (ORCPT ); Fri, 26 Aug 2022 03:45:47 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E201CA260F; Fri, 26 Aug 2022 00:45:45 -0700 (PDT) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MDX013WslzGprJ; Fri, 26 Aug 2022 15:44:01 +0800 (CST) Received: from [10.67.110.73] (10.67.110.73) 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, 26 Aug 2022 15:45:43 +0800 Message-ID: <1fa01bcf-15e5-279e-79ac-056c70a9401d@huawei.com> Date: Fri, 26 Aug 2022 15:45:43 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH] rtc: fsl-ftm-alarm: Use module_init and add module_exit To: Alexandre Belloni CC: , , References: <20220826070017.2340617-1-chris.zjh@huawei.com> From: "zhangjianhua (E)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.110.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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,NICE_REPLY_A, 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 在 2022/8/26 15:22, Alexandre Belloni 写道: > On 26/08/2022 15:00:17+0800, Zhang Jianhua wrote: >> - Use module_init instead of device_initcall. >> - Add a function for module_exit to unregister driver. >> > I can see what you are doing but this doesn't explain why. Also, was > this tested on any actual hardware? I find this problem by code review, so solve it smoothly, and there is no hardware, so I just test it on qemu. May I need to modify the commit message? >> Signed-off-by: Zhang Jianhua >> --- >> 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 >>