Received: by 10.213.65.68 with SMTP id h4csp246799imn; Fri, 23 Mar 2018 03:51:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELs2EvQaRZ+x3VZDMeGY+MwIq7m9ALeMY8tgrEdBvJZkdjo4Z4ITuicQB1MUEuuTAtJv3kIC X-Received: by 2002:a17:902:8b82:: with SMTP id ay2-v6mr28340467plb.12.1521802287303; Fri, 23 Mar 2018 03:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521802287; cv=none; d=google.com; s=arc-20160816; b=t/duzSndMEO2tp02drk8fcbu6i8rBhN71n6di2Ey+9uOhJzqMPlKpmqn2vnWDV9dBO 1Il6Kp1eI3W6qvdToXMXib+SPD9NlJxKmYRm5T8tZpj9yaAKafrMtMBI2eM6qgB35jPu 3EbeOJgGsFMiw18spK23A/Jaed9gz2WEKrFtL/HqhrFoU2fe/9vuUR8tN2Dt3AhwVboR ouoEGUD+3/z1hhCYCuYY1i+snb2rfOIfuKPbgvZISoX/1DlHPOXiVkaTzLYtcve1ijir ymmAQ5kbPV30l8qPVivP1VyexAFCnxtE02N9sKFGtEwW0ydd70xUh8CptYSX3Qk6gbvC w67g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=mr6demLhfxvmFoNdO1HKeiMqVPkyLk3yqGT/tFfQfr0=; b=pw9F12/xzDa9mqBdAROOUhzjsAR7KJ73m4pem9VlqdZ82IrsxxMjFxqP219SN092Q1 c8SJs/2X8TIHNYbUteBM6+JmLElqTvIKwEM12fZqMeszoNIXUhiM36l8fryL9rdKqIic go4QC9jEIuwFva7lLHWDT4m2mJtB2hYSaE7yQ8Yd9XPgptqVMdH7ib6gcNaePln2c2Xb vX5R50q1qe9vLmdiAMeKPDtTuZXs5MQKYli44MeopL89JsLOxWAPvEQbCWlocCG8zwv3 rpXVtO1ZqSJAw+E8qauDTQYZFfwq4TvXFrJCdmzUr2riQNxQAb3fS0wbf5VBrKjk9rGt u0MQ== 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 c1-v6si8142184plz.102.2018.03.23.03.51.12; Fri, 23 Mar 2018 03:51:27 -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 S1755684AbeCWKuW (ORCPT + 99 others); Fri, 23 Mar 2018 06:50:22 -0400 Received: from mail.bootlin.com ([62.4.15.54]:43440 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751841AbeCWKuT (ORCPT ); Fri, 23 Mar 2018 06:50:19 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 05B812046F; Fri, 23 Mar 2018 11:50:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id 4A534203B1; Fri, 23 Mar 2018 11:50:16 +0100 (CET) Date: Fri, 23 Mar 2018 11:50:17 +0100 From: Alexandre Belloni To: sean.wang@mediatek.com Cc: robh+dt@kernel.org, mark.rutland@arm.com, sre@kernel.org, lee.jones@linaro.org, a.zummo@towertech.it, eddie.huang@mediatek.com, devicetree@vger.kernel.org, linux-rtc@vger.kernel.org, linux-pm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 09/16] rtc: mediatek: convert to use device managed functions Message-ID: <20180323105017.GI3417@piout.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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. -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com