Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2009046imm; Sun, 9 Sep 2018 13:41:20 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb+wi9CygHJg7hZR5+RAm+8X4B6Vf7qeTkqsc7KXI9aHjOI8owr1yi3h5TWCgHxKDf6QNzs X-Received: by 2002:a17:902:988a:: with SMTP id s10-v6mr18185558plp.200.1536525680497; Sun, 09 Sep 2018 13:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536525680; cv=none; d=google.com; s=arc-20160816; b=qrIN9Ixq97pTqSJl5fSL8SVjfOvOygqmJGTMMLXlbHkFJUuME2By89Nzw69krvMoGM N0X8QpCF603ek6cxLgERXdctnAhc2BOVoEQ8qdl/0b8W0EGtXZxcNukM8DslZZA8HZv9 mu0mQ/3mPdvcbuzLJoWZgm6sNHjP8rUNTaooAVU3zGZ819Kf4p7M03Zgp0Mha7CSru+l DTDq5X7ON3/mp1EEhjn2I5OZEA9U35uWol0hRAniWsokXi5ABb6FrRgdQG4lDtU+x4Cx 0UsA4GLy3uQISTIoaaGXipE4kxPo5AJTKN1rWVv7v0tZbm5wZiZE5unYQz2PKU4RsQBE v1Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3s+pQGnnlJMo+P1Vh7NWSvdMza3LMsTPJZy9NEUPWmA=; b=NEESmJ/tKCsR7Znav2mlszHgZSbtqLmNdMPxA8DMbsMeJY8YsOwJBEjiC0FTT+9Qg+ D0b8C7xrvyK+2I+/KaQdKjtTphZq3hURN6VkOyWwpN5EmjV/c47SMfTkuUlMUANxN/CH NASVWUWem+SSUBLyjUI6YdS5YHqITcT6XKH5VvAuSs+5ejFGJuTnAw2r0n9Im+2wsqO3 oB2JdtOiC/H36uQcxlJJvPzPZzu6pR0ldlLNw4lkYgPGiJEB4SeApWC9CbpKespccWd8 INQ3Z1JwDaJ+ur0CZpK7ERF7maZfTNBdgTCr24kdboZzScDcl8I0FKwjJwjO14tnj42h 3M5A== 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 z2-v6si14941138pgn.494.2018.09.09.13.40.50; Sun, 09 Sep 2018 13:41:20 -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 S1726984AbeIJB3y (ORCPT + 99 others); Sun, 9 Sep 2018 21:29:54 -0400 Received: from mail.bootlin.com ([62.4.15.54]:47055 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726665AbeIJB3w (ORCPT ); Sun, 9 Sep 2018 21:29:52 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 2C4962079D; Sun, 9 Sep 2018 22:38:58 +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 (unknown [88.191.26.124]) by mail.bootlin.com (Postfix) with ESMTPSA id 00F9A203DC; Sun, 9 Sep 2018 22:38:57 +0200 (CEST) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Alexandre Belloni , Linus Walleij Subject: [PATCH 3/3] rtc: pl031: switch to devm_rtc_allocate_device/rtc_register_device Date: Sun, 9 Sep 2018 22:38:48 +0200 Message-Id: <20180909203848.3470-3-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.19.0.rc2 In-Reply-To: <20180909203848.3470-1-alexandre.belloni@bootlin.com> References: <20180909203848.3470-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 to simplify the erro and driver removal paths. Cc: Linus Walleij Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-pl031.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 82eb7da2c478..30943d200c5e 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -310,7 +310,6 @@ static int pl031_remove(struct amba_device *adev) device_init_wakeup(&adev->dev, false); if (adev->irq[0]) free_irq(adev->irq[0], ldata); - rtc_device_unregister(ldata->rtc); amba_release_regions(adev); return 0; @@ -383,24 +382,25 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) } device_init_wakeup(&adev->dev, true); - ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, - THIS_MODULE); - if (IS_ERR(ldata->rtc)) { - ret = PTR_ERR(ldata->rtc); + ldata->rtc = devm_rtc_allocate_device(&adev->dev); + if (IS_ERR(ldata->rtc)) + return PTR_ERR(ldata->rtc); + + ldata->rtc->ops = ops; + + ret = rtc_register_device(ldata->rtc); + if (ret) goto out; - } if (adev->irq[0]) { ret = request_irq(adev->irq[0], pl031_interrupt, vendor->irqflags, "rtc-pl031", ldata); if (ret) - goto out_no_irq; + goto out; dev_pm_set_wake_irq(&adev->dev, adev->irq[0]); } return 0; -out_no_irq: - rtc_device_unregister(ldata->rtc); out: amba_release_regions(adev); err_req: -- 2.19.0.rc2