From patchwork Tue Jan 20 16:21:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 43412 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 047362034D for ; Tue, 20 Jan 2015 16:23:28 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf5938436wid.3 for ; Tue, 20 Jan 2015 08:23:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=iR3pwv2Tcz1NJGgweYI13GpQM1iqKtkejY2SwvMOieU=; b=e7YgUBykXpPkbrZ4wj9ReXRENhJIK/ttUxaU81J8t8MRKSX4HtdZVS11F8+xqy+RPF U32R/SSKexXoXST+SWROMJf2oT+Pafbd0VQ9LVFgll8fW01tOv18a56rQ9Q1E8q4gUoQ kUO8JrPL7BrB1H90L+Nrv9zw0+X2Ki3v1vO6/r4AZLh7MLfEqXNgoLZTBJU0LrUFn9Pg CCwI4VOiuB4RtBX5ZuoSlPvAdEKYWPHdeHeqmt+rQqrYLvtxBSMjSvLSABLLn3FY8R5T AaVWHwjWZC8Eatgv9wV7Glwj6ff29XDH/jUCeY0D++JDWq6fimVB0AS2Y+GVb4S6/9// aTvw== X-Gm-Message-State: ALoCoQlTve0/5bEXqKdLEV3PrWcDNsFolapQOjGV7C993+gEaM1wQXU7tUAfCohoatmqoh7eAtJ0 X-Received: by 10.112.99.37 with SMTP id en5mr132498lbb.17.1421771007170; Tue, 20 Jan 2015 08:23:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.202 with SMTP id m10ls671492lah.76.gmail; Tue, 20 Jan 2015 08:23:27 -0800 (PST) X-Received: by 10.112.56.142 with SMTP id a14mr38573831lbq.16.1421771006998; Tue, 20 Jan 2015 08:23:26 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id cr10si11951611lad.116.2015.01.20.08.23.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 08:23:26 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gq15so10805784lab.12 for ; Tue, 20 Jan 2015 08:23:26 -0800 (PST) X-Received: by 10.112.90.170 with SMTP id bx10mr39327517lbb.69.1421771006888; Tue, 20 Jan 2015 08:23:26 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1473370lbb; Tue, 20 Jan 2015 08:23:25 -0800 (PST) X-Received: by 10.68.208.65 with SMTP id mc1mr54616668pbc.111.1421771004656; Tue, 20 Jan 2015 08:23:24 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2si585212pdf.109.2015.01.20.08.23.23; Tue, 20 Jan 2015 08:23:24 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754146AbbATQXU (ORCPT + 28 others); Tue, 20 Jan 2015 11:23:20 -0500 Received: from mail-qc0-f178.google.com ([209.85.216.178]:51556 "EHLO mail-qc0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753400AbbATQWV (ORCPT ); Tue, 20 Jan 2015 11:22:21 -0500 Received: by mail-qc0-f178.google.com with SMTP id b13so9129544qcw.9 for ; Tue, 20 Jan 2015 08:22:21 -0800 (PST) X-Received: by 10.224.12.19 with SMTP id v19mr57143138qav.22.1421770941021; Tue, 20 Jan 2015 08:22:21 -0800 (PST) Received: from ip-10-181-65-231.ec2.internal ([54.235.93.228]) by mx.google.com with ESMTPSA id o34sm15633515qge.29.2015.01.20.08.22.20 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 08:22:20 -0800 (PST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , Richard Henderson , Uwe Kleine-Koenig , Linus Walleij , Fabio Estevam , John Stultz , Arnd Bergmann , Xunlei Pang Subject: [RFC PATCH v3 5/8] rtc/mxc: Modify rtc_update_alarm() not to touch the alarm time Date: Tue, 20 Jan 2015 16:21:36 +0000 Message-Id: <1421770899-4136-6-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1421770899-4136-1-git-send-email-pang.xunlei@linaro.org> References: <1421770899-4136-1-git-send-email-pang.xunlei@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pang.xunlei@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , rtc_class_ops's set_alarm() shouldn't deal with the alarm date, as this is handled in the rtc core. See rtc_dev_ioctl()'s RTC_ALM_SET and RTC_WKALM_SET cases. Signed-off-by: Xunlei Pang --- drivers/rtc/rtc-mxc.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 3c3f8d1..a7b218f 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c @@ -173,29 +173,18 @@ static void set_alarm_or_time(struct device *dev, int time_alarm, u32 time) * This function updates the RTC alarm registers and then clears all the * interrupt status bits. */ -static int rtc_update_alarm(struct device *dev, struct rtc_time *alrm) +static void rtc_update_alarm(struct device *dev, struct rtc_time *alrm) { - struct rtc_time alarm_tm, now_tm; - unsigned long now, time; + unsigned long time; struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr; - now = get_alarm_or_time(dev, MXC_RTC_TIME); - rtc_time_to_tm(now, &now_tm); - alarm_tm.tm_year = now_tm.tm_year; - alarm_tm.tm_mon = now_tm.tm_mon; - alarm_tm.tm_mday = now_tm.tm_mday; - alarm_tm.tm_hour = alrm->tm_hour; - alarm_tm.tm_min = alrm->tm_min; - alarm_tm.tm_sec = alrm->tm_sec; - rtc_tm_to_time(&alarm_tm, &time); + rtc_tm_to_time(alrm, &time); /* clear all the interrupt status bits */ writew(readw(ioaddr + RTC_RTCISR), ioaddr + RTC_RTCISR); set_alarm_or_time(dev, MXC_RTC_ALARM, time); - - return 0; } static void mxc_rtc_irq_enable(struct device *dev, unsigned int bit, @@ -346,11 +335,8 @@ static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); - int ret; - ret = rtc_update_alarm(dev, &alrm->time); - if (ret) - return ret; + rtc_update_alarm(dev, &alrm->time); memcpy(&pdata->g_rtc_alarm, &alrm->time, sizeof(struct rtc_time)); mxc_rtc_irq_enable(dev, RTC_ALM_BIT, alrm->enabled);