Received: by 10.213.65.68 with SMTP id h4csp1005705imn; Sun, 25 Mar 2018 21:09:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+JfQy1j7+OkHrEanRFTCus3OdddgQIbUA/C5bjIIqBzp3BuOPxyTjf2ZHyFKic3w0l8EM+ X-Received: by 10.101.98.22 with SMTP id d22mr3735277pgv.344.1522037388147; Sun, 25 Mar 2018 21:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522037388; cv=none; d=google.com; s=arc-20160816; b=hfFr9UMLnOEOViFZLoKMe/8TK+SClz4VdKcloWkgLthfxCYXcAoyuQ+m8eMb84hd85 xPZZlEECbv7mCMxUCfXttlgBhn0xQ2uADG9n2DF9CYZR6hlHEHveizvccS0o+5eudysj bMZgWVynOC2xZj5lIXlQ6IZ8Ap8N8lzYw7r+jMJAfO+I3StoR3Mpf7q9x6VBMgi8PglC xiqcHLYPZKqIAY9Ur2jcbOlbNkbNxoJ9dj0/rTtNwBGKkhs1qCOW8puyVaovex19+b/1 SMwQwfjdTCDscJsTGa3kSMrsp/GPA4es+FDRPEaBYGgywsnUfjSq/wN0lJkaEtlVtwzB vzOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=m6OCxjdY8waraKKkuwWP9zZxOHBV7NuiiD1mQW/LyaA=; b=nNe/QNotaJdNp4F16xFnd04H1io2KoHbgX3AAW6+EjvSMxTu5A8YHPZj0cXSl05gFH MH2YrQkUU9qLXIqBNfPBEmkNmSExYhyL1Wp2up6ERvvDbdescGI2MhZu9GSFXdWtgqPn 6gJCMLhcLsd1jE5myEO+UyNg3nw7og/oT3+gXdY7hV/vCtZs8rFnYIe1bw6sCxyolKyi Vtnpd0zOSgTsfWn3G8yTyhjGWQLAA7jnfJ8JEoz1THmbyI0/mrcskVRbeZJ3pntwqjnT AoXunKknEkMbp4fHWmy0gkyAd9wyraVsoiaifIfXfKRxRJuGOnmas42jKNTR0B32eWeS oQfw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b59-v6si10750424plb.530.2018.03.25.21.09.21; Sun, 25 Mar 2018 21:09:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750885AbeCZEHy (ORCPT + 99 others); Mon, 26 Mar 2018 00:07:54 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:38741 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750713AbeCZEHw (ORCPT ); Mon, 26 Mar 2018 00:07:52 -0400 X-UUID: 3ef8356837a84ec982a10f41a722de32-20180326 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1577683522; Mon, 26 Mar 2018 12:07:47 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 26 Mar 2018 12:07:45 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 26 Mar 2018 12:07:45 +0800 Message-ID: <1522037265.18424.14.camel@mtkswgap22> Subject: Re: [PATCH v1 09/16] rtc: mediatek: convert to use device managed functions From: Sean Wang To: Alexandre Belloni CC: , , , , , , , , , , Date: Mon, 26 Mar 2018 12:07:45 +0800 In-Reply-To: <20180323105017.GI3417@piout.net> References: <20180323105017.GI3417@piout.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.5042-8.2.9001-23742.001 X-TM-AS-Result: No-16.411000-8.000000-10 X-TMASE-MatchedRID: y/2oPz6gbvgOwH4pD14DsPHkpkyUphL9+Vb3woyMZbue9toQ6h6LExRE XZwhDuFxsDSpqyZY4zQkFyQegp0Snp7oe7OF0U2WEhGH3CRdKUXSde/CNbaZJSAWlErg1VlPjmK ERq7fTSFOJB5wP1oqhFJaDhgFzZsBqH7dGVt6/4nKl4yJoI+fG9O4VcbrqWuqTUobVis5Bb+wV7 nfUWvsNMrqJH3Kw4BA118ZC33GdOuny6BdO4dlIWA/V00XWjDtwx0jRRxcQfNtPXRTHBlYsEBIC Rren7xC4ImvYyRqEBzl2rMeR1tlaPGU4m5A0eV9ngIgpj8eDcC063Wh9WVqgtZE3xJMmmXc+gtH j7OwNO0CpgETeT0ynA== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--16.411000-8.000000 X-TMASE-Version: SMEX-12.5.0.5042-8.2.9001-23742.001 X-TMASE-POSTMAN: 2-d; X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-03-23 at 11:50 +0100, Alexandre Belloni wrote: > On 23/03/2018 at 17:15:06 +0800, sean.wang@mediatek.com wrote: > > From: Sean Wang > > > > Use device managed operation to simplify error handling, reduce source > > code size, and reduce the likelyhood of bugs, and remove our removal > > callback which contains anything already done by device managed functions. > > > > Signed-off-by: Sean Wang > > --- > > drivers/rtc/rtc-mt6397.c | 31 ++++++++----------------------- > > 1 file changed, 8 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c > > index cefb83b..bfc5d6f 100644 > > --- a/drivers/rtc/rtc-mt6397.c > > +++ b/drivers/rtc/rtc-mt6397.c > > @@ -14,6 +14,7 @@ > > > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -328,10 +329,10 @@ static int mtk_rtc_probe(struct platform_device *pdev) > > > > platform_set_drvdata(pdev, rtc); > > > > - ret = request_threaded_irq(rtc->irq, NULL, > > - mtk_rtc_irq_handler_thread, > > - IRQF_ONESHOT | IRQF_TRIGGER_HIGH, > > - "mt6397-rtc", rtc); > > + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, > > + mtk_rtc_irq_handler_thread, > > + IRQF_ONESHOT | IRQF_TRIGGER_HIGH, > > + "mt6397-rtc", rtc); > > if (ret) { > > dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", > > rtc->irq, ret); > > @@ -340,30 +341,15 @@ static int mtk_rtc_probe(struct platform_device *pdev) > > > > device_init_wakeup(&pdev->dev, 1); > > > > - rtc->rtc_dev = rtc_device_register("mt6397-rtc", &pdev->dev, > > - &mtk_rtc_ops, THIS_MODULE); > > + rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, "mt6397-rtc", > > + &mtk_rtc_ops, THIS_MODULE); > > You should probably switch to devm_rtc_allocate_device() and > rtc_register_device instead of devm_rtc_device_register. > Just would like to know something details It seems you just encourage me to switch into the new registration method and currently devm_rtc_device_register I used for the driver shouldn't cause any harm. right? > > if (IS_ERR(rtc->rtc_dev)) { > > dev_err(&pdev->dev, "register rtc device failed\n"); > > ret = PTR_ERR(rtc->rtc_dev); > > - goto out_free_irq; > > + return ret; > > ret doesn't seem necessary anymore here. okay, it'll be removed > >