From patchwork Thu Apr 26 02:58:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 134400 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1668886lji; Wed, 25 Apr 2018 19:59:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+4VjOQxO6/coJD37eIOnaIIMMRtoM7wWKIQo186C+/VCzrharP8mVs6mHUU5lTgF6XBtXQ X-Received: by 10.98.59.203 with SMTP id w72mr22843367pfj.129.1524711588583; Wed, 25 Apr 2018 19:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524711588; cv=none; d=google.com; s=arc-20160816; b=czDqq7hurgCTae8yFaSkhW5QkkeTLuNXT1U5YPqiN3JK8aU8uAdT+XbrgCy1oOVzn2 s4SpbST86VElnOYYAPmnSGfQ1mXhbJxXjg4Vyobof3WnSV6rAihYIi7X9K0t7P22G0nI eIUC1i465FOJUHuQgcVdoSltWOK8wBq2XozjH8l1ZO/xprx1FIgxtuKPYTZd9K7GzCFf Ytv+QMBp6HxRuk2dZDzhw/iTMPCOcblHoGE2s5VntZeRRT/yBnXwBmjXpyJnyMeyDmc1 GLPE8EbVkuQ1P47F/3MgWHerVRN+CKUtD7nfWL9TjLHQhJDqvQXia3G6Ml6I/L5lR0Wq M50w== 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 :dkim-signature:arc-authentication-results; bh=oqO1yo7anAQMVVPjIzFxniYWg3ofUmwQOOFB8NPAeBI=; b=MbL60uw3V3OFnSa7T4WeFE4cqAclkEvIj42O5Z5gPUL0vuC+kFde5qF8CtaX7Ks4Ue +YIz+B2k/Z/44GyD681eUKXTAc4J6WpIcO3gKe9Ef5FqyBSq14Xot/dUoEahBiZJDBGD H5NgpBpNIF7qG9q4l5o8M+s37HZGVrDqaWMYVvdANUXhtpgvZQU6541JFh07DJBlG3Lo YGsaHt8QqmO18pm1ubRR4YKPcA4Y1zc25KqXDsUWpx4BWFUYUA3DS2Ff/8mUXySQRy46 pChbV8tWfjDTkbtFLE9MHgMheBy6usVjZeLQCfkRo+ETAag/fNU/J35aLQrUzfaHSAOa TSlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=au1huh6H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d18si15184669pgo.310.2018.04.25.19.59.48; Wed, 25 Apr 2018 19:59: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; dkim=pass header.i=@linaro.org header.s=google header.b=au1huh6H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752051AbeDZC7n (ORCPT + 29 others); Wed, 25 Apr 2018 22:59:43 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36076 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751424AbeDZC7l (ORCPT ); Wed, 25 Apr 2018 22:59:41 -0400 Received: by mail-pf0-f193.google.com with SMTP id g14so16982933pfh.3 for ; Wed, 25 Apr 2018 19:59:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=oqO1yo7anAQMVVPjIzFxniYWg3ofUmwQOOFB8NPAeBI=; b=au1huh6HlJ1DjefAeq597t1+7eHK+urTdZlH8VzgMdiKqu/CTVMvQvXjiJWkH333Mp oNbh9lGvDpqywua6tYYmWctVvjqQHMtT9yl+FQnUMBHd3IJSPn/oTmTmvNkm53dl9D8/ 4UAVGcKT5t6E2XhCmhg2VzHdUN56I2tm6f8CQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oqO1yo7anAQMVVPjIzFxniYWg3ofUmwQOOFB8NPAeBI=; b=Ubi2txlveNXAA/lzhgWcUYldqRW8qg8eZGnyYeL17yxdKun7Td9AA3bXGqFGh2jThJ XwAJ7UZdTrDhaw3DKAF9L9acWN6X5o+Nzkx7FhN1tIt3+iZCkxfh2JMj9YCjQlD/+Gx2 lSqpAn+keRfpv3U9ILd3ntt+gZDNIZKMpGEwZX+uNqTh7mhwhnCBwpVcp5cCjlLzbnA7 rbJCvY7j/2XSdZ+sA8S2vI8/vbs9z57Slztr/6zNe3AXrNjsfvTjzhXXW0RYSvgV0DKg cClAga2ycEJx3VqhfyEIT8sxgN7BxzaO8AtCM/VQ6466B/xOo5xNZH4EXZLjnJHSnReh QfWQ== X-Gm-Message-State: ALQs6tDQiYVqx3TuTXmxQYyrVfNKNrAeM+dZWh4+hHiRsomQTL0Ke++5 AmMwfg/CIOxEcKVPOxo0gWZmgA== X-Received: by 2002:a17:902:5844:: with SMTP id f4-v6mr1430950plj.35.1524711581032; Wed, 25 Apr 2018 19:59:41 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id a81sm43852557pfc.168.2018.04.25.19.59.38 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Apr 2018 19:59:40 -0700 (PDT) From: Baolin Wang To: a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: baolin.wang@linaro.org, broonie@kernel.org, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] rtc: sprd: Change to use devm_rtc_allocate_device() Date: Thu, 26 Apr 2018 10:58:44 +0800 Message-Id: <95b85b6d0369b4693e9d4e57af5eac49eee87dc9.1524710929.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a preparation patch, changing to use devm_rtc_allocate_device() that can allow driver to set 'range_max' and 'range_min' for the RTC device. Signed-off-by: Baolin Wang --- drivers/rtc/rtc-sc27xx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 1.7.9.5 diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c index 00d87d1..ac86322 100644 --- a/drivers/rtc/rtc-sc27xx.c +++ b/drivers/rtc/rtc-sc27xx.c @@ -600,6 +600,10 @@ static int sprd_rtc_probe(struct platform_device *pdev) return rtc->irq; } + rtc->rtc = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(rtc->rtc)) + return PTR_ERR(rtc->rtc); + rtc->dev = &pdev->dev; platform_set_drvdata(pdev, rtc); @@ -626,10 +630,12 @@ static int sprd_rtc_probe(struct platform_device *pdev) return ret; } - rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, - &sprd_rtc_ops, THIS_MODULE); - if (IS_ERR(rtc->rtc)) - return PTR_ERR(rtc->rtc); + rtc->rtc->ops = &sprd_rtc_ops; + ret = rtc_register_device(rtc->rtc); + if (ret) { + dev_err(&pdev->dev, "failed to register rtc device\n"); + return ret; + } device_init_wakeup(&pdev->dev, 1); return 0;