From patchwork Tue Jan 13 15:44:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 43056 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9044720DE8 for ; Tue, 13 Jan 2015 15:46:47 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id k11sf2098132wes.2 for ; Tue, 13 Jan 2015 07:46:46 -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=fxC7XwIg9sqqOxnf7Tudg/COs34u20IJOzqvAoLgK8Y=; b=MHICkBgPPRNhB5RBt3QfyhDp4EThHX6e74duY3rtPCDYz++oIDy5lCMSOBdvqxIpP7 5b1td7vyHJTJCNCndyKI+H2VgE2IioCJOOh+Gis3eYtLKUnw7nnpoDirQ0F0R2eD6CK+ D0fcAIVTdBP6mkG96XozVgeOCqBdWyx3A7uR28IHjef4zpVB+xVWrLS/2PGlXeCrXzcm rBx+DDVhvVn7OOCuxCGH1ZPmEeEYSKPOii17aG0CblCoWGnHd6k7cy3VGkaUVOP8dtbl nJl0XxQ0S7cM+c0NzRwEeYjzpHcJdrRVRmanr7nU9fok75ihg9c4S2ZG2qfnNZE4C4hS LsvA== X-Gm-Message-State: ALoCoQlB6nh/k5Y3WyELFtFEEc25lZnngzSBcrpD5k5xnw+/Sl1BsM4v7Kiah3WXibmH1eXTv8OZ X-Received: by 10.180.208.46 with SMTP id mb14mr1203wic.4.1421164006912; Tue, 13 Jan 2015 07:46:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.137 with SMTP id 9ls11910lau.26.gmail; Tue, 13 Jan 2015 07:46:46 -0800 (PST) X-Received: by 10.152.27.130 with SMTP id t2mr42174522lag.28.1421164006722; Tue, 13 Jan 2015 07:46:46 -0800 (PST) Received: from mail-la0-x233.google.com (mail-la0-x233.google.com. [2a00:1450:4010:c03::233]) by mx.google.com with ESMTPS id yh1si3177217lab.112.2015.01.13.07.46.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 07:46:46 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) client-ip=2a00:1450:4010:c03::233; Received: by mail-la0-f51.google.com with SMTP id ms9so3298687lab.10 for ; Tue, 13 Jan 2015 07:46:46 -0800 (PST) X-Received: by 10.152.23.38 with SMTP id j6mr43167840laf.81.1421164006561; Tue, 13 Jan 2015 07:46:46 -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 c8csp1420983lbb; Tue, 13 Jan 2015 07:46:45 -0800 (PST) X-Received: by 10.70.89.174 with SMTP id bp14mr51627671pdb.136.1421164004616; Tue, 13 Jan 2015 07:46:44 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot2si12728737pbb.53.2015.01.13.07.46.43; Tue, 13 Jan 2015 07:46:44 -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 S1752930AbbAMPqm (ORCPT + 27 others); Tue, 13 Jan 2015 10:46:42 -0500 Received: from m15-111.126.com ([220.181.15.111]:37347 "EHLO m15-111.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbbAMPqh (ORCPT ); Tue, 13 Jan 2015 10:46:37 -0500 Received: from vptest-PC.zte.com.cn (unknown [182.149.91.53]) by smtp1 (Coremail) with SMTP id C8mowEAZEUVxPbVUBIRpDg--.692S9; Tue, 13 Jan 2015 23:45:00 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org, John Stultz , Arnd Bergmann Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , Xunlei Pang Subject: [RFC PATCH v2 6/9] rtc/mxc: Modify rtc_update_alarm() not to touch the alarm time Date: Tue, 13 Jan 2015 23:44:54 +0800 Message-Id: <1421163897-8020-7-git-send-email-xlpang@126.com> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1421163897-8020-1-git-send-email-xlpang@126.com> References: <1421163897-8020-1-git-send-email-xlpang@126.com> X-CM-TRANSID: C8mowEAZEUVxPbVUBIRpDg--.692S9 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw4UKw1fCFyxZw1Uury8Krg_yoW8tw15pF W3Cayktr4ktFySgw1DGFsruF45Jw18J39Fq3WfJ34S9rn5Aa4kJF95Cry8KrW5tFZ5u3Zr J3W3ZF15urWUZF7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jd_-9UUUUU= X-Originating-IP: [182.149.91.53] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbimRqAv00vL4USVAAAsy Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: xlpang@126.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; dmarc=fail (p=NONE dis=NONE) header.from=126.com 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: , From: Xunlei Pang 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);