Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3657412imm; Mon, 4 Jun 2018 07:17:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKXwciQTLQKoTnguseKrn/1s0CNnKBAmq400cxF8sVZ/jTubEdrP3LmrUMrm+bh/qgd3DbL X-Received: by 2002:a17:902:4081:: with SMTP id c1-v6mr21977170pld.60.1528121822996; Mon, 04 Jun 2018 07:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528121822; cv=none; d=google.com; s=arc-20160816; b=izXoz8Tt5CTm4iUkBAOIOQvOR8bV43a0ROBLPaghomel+p/yRDb5ZJHqVOFpAJB4CZ SA1cM2VAqQUazWlnzTMj9kDGqp4T40oyJd6+g/DfKuJdctR70q5TAoerRBeaCdQQ89w6 gjomVWhBrsfAXJeLG/BydfUNVep3fPEa4l+k1eIP9b5nxQRxuWt2Glnhn9IotZIZvFI8 +vyRhOMOcIA0/L4oLXvB+DwzNwnaSUH1+ZoieVAfUZdKU9HiKXb1cRYcpkuQN/9Ndle5 9a2WipQk9yd3ArsjtFv2PsseN5as3jForZezrWick+mNZSmAyfq5KeJsAxIsdxUz0pQj QN3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=YdRHgn5DS6kqFP2+LD6lG72LeidR0y8HvUaoU9YryZU=; b=I34Zc0Bm+kWowuVTML7qhgReRaZFVEXwLwowLkPc3KKEEUWAsoLZKPXTkyHNxsuS9I 2piR3/CmGX4LcjewzSMJIdXEur/BgvmbCJDEMCTQpM/zJpUZnP1kRL8iwdck0jjzIhQw DjYV5yJoscsHyj1u37TMJ3kYt19B3Evi/TukIVRGDWfNhO0+lrBNfhkcYLq4nu9iQQ/z o9Cdnf/jKqfmqAh/zVHdfEA4Qhf2haJ8l3DgGUFh2dcGV+JmdniUBJNwwO30OeLl20Ai HwdYd5s9s3Fn+cOHGMa0Ij8+obX59J2qQvoCdkPKxjENUN1TatavO1osaKppXDLF2vyK s6ZQ== 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 x7-v6si10726796pfd.124.2018.06.04.07.16.48; Mon, 04 Jun 2018 07:17:02 -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 S1753899AbeFDOP4 (ORCPT + 99 others); Mon, 4 Jun 2018 10:15:56 -0400 Received: from mail.bootlin.com ([62.4.15.54]:51373 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753641AbeFDOPy (ORCPT ); Mon, 4 Jun 2018 10:15:54 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 59CB8207CA; Mon, 4 Jun 2018 16:15:52 +0200 (CEST) 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 (hy283-1-82-246-155-60.fbx.proxad.net [82.246.155.60]) by mail.bootlin.com (Postfix) with ESMTPSA id F067F20717; Mon, 4 Jun 2018 16:15:51 +0200 (CEST) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Hans Ulli Kroll , Linus Walleij , linux-arm-kernel@lists.infradead.org, Alexandre Belloni Subject: [PATCH 1/3] rtc: ftrtc010: switch to devm_rtc_allocate_device Date: Mon, 4 Jun 2018 16:15:26 +0200 Message-Id: <20180604141528.15635-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to devm_rtc_allocate_device/rtc_register_device. This allow or further improvement and simplifies ftrtc010_rtc_remove(). Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-ftrtc010.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-ftrtc010.c b/drivers/rtc/rtc-ftrtc010.c index af8d6beae20c..165d0b62db00 100644 --- a/drivers/rtc/rtc-ftrtc010.c +++ b/drivers/rtc/rtc-ftrtc010.c @@ -166,14 +166,18 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev) if (!rtc->rtc_base) return -ENOMEM; + rtc->rtc_dev = devm_rtc_allocate_device(dev); + if (IS_ERR(rtc->rtc_dev)) + return PTR_ERR(rtc->rtc_dev); + + rtc->rtc_dev->ops = &ftrtc010_rtc_ops; + ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt, IRQF_SHARED, pdev->name, dev); if (unlikely(ret)) return ret; - rtc->rtc_dev = rtc_device_register(pdev->name, dev, - &ftrtc010_rtc_ops, THIS_MODULE); - return PTR_ERR_OR_ZERO(rtc->rtc_dev); + return rtc_register_device(rtc->rtc_dev); } static int ftrtc010_rtc_remove(struct platform_device *pdev) @@ -184,7 +188,6 @@ static int ftrtc010_rtc_remove(struct platform_device *pdev) clk_disable_unprepare(rtc->extclk); if (!IS_ERR(rtc->pclk)) clk_disable_unprepare(rtc->pclk); - rtc_device_unregister(rtc->rtc_dev); return 0; } -- 2.17.1