From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8530DECAAA3 for ; Fri, 26 Aug 2022 07:23:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245235AbiHZHXG (ORCPT ); Fri, 26 Aug 2022 03:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245234AbiHZHXC (ORCPT ); Fri, 26 Aug 2022 03:23:02 -0400 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E09D25FD; Fri, 26 Aug 2022 00:23:00 -0700 (PDT) Received: (Authenticated sender: alexandre.belloni@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 45B7E24000B; Fri, 26 Aug 2022 07:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1661498578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JK9COduMorPgKCAsggz5pvTrJ2MnP3XJ9ZS9Yi4YLmo=; b=k2jQNZTSqbhsDjWsVNPZdeykaB3Jq0J7Z1Bcvt1Vtghj2eeiqZPpEXhoIs4iCFNOST5jQ4 tuLiCOCyRU5aD6v3FqfjRu0OztAyIy64lqBQn/GXBu7XUB3+cn7BpxkGs/csa6ngYjvw4F q6QPYxWz8hkcD0inkcTDLHq+jLYeEyA2/zYqITcRDDWGiyFWRGyNjziOQ2Ay1uAjUwJJKP +NCKhoEeOh53Mi0y+JCD6/bP+1a9mL7j2ms0yxd8YrQHZVQW/lm5OdOPzTpReqNWtL9KP+ 3N9vGd5PbATIxEjEv74YUZvNdFwqZK3pAoq/pAHOPnmzD+5ZfYnwoh7PlZ3x/w== Date: Fri, 26 Aug 2022 09:22:57 +0200 From: Alexandre Belloni To: Zhang Jianhua Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rtc: fsl-ftm-alarm: Use module_init and add module_exit Message-ID: References: <20220826070017.2340617-1-chris.zjh@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220826070017.2340617-1-chris.zjh@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org 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? > 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 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com