From patchwork Thu Nov 5 09:29:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 7559371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B4927BEEA4 for ; Thu, 5 Nov 2015 09:32:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF68F207D8 for ; Thu, 5 Nov 2015 09:32:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1004207D5 for ; Thu, 5 Nov 2015 09:32:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZuGsh-0004Ss-4b; Thu, 05 Nov 2015 09:30:55 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZuGsd-0004Kv-Kg for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2015 09:30:52 +0000 Received: by wmww144 with SMTP id w144so2440750wmw.1 for ; Thu, 05 Nov 2015 01:30:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=X2qC+/QqBO9DTsABhUOdnU1H1loibPZqSIv9u7fM8KY=; b=inxcCED/hFQ4bbjZqQxhjwrtp/uimu1hDrIORGott6sKdKZ4u//9elAps4bWp4zV+Z JSvtyCoP8vOw8bgrcG5cdjQuMRDsGusO1tr0Ghx+hlKEPwgA5RmJI5nUBiR0h8vCPepH mXH1DsUSwC/LLidTm9tlfplElKnYb6VCRe2hIzb2WJIcFEQQq96LHYBgGRil4Nq/Ik9r DlyXF5/YZmZg26Io/piiMJi7jcVg+J2HDrtIArfx88CnLZPt4DoqDfSk2pDhzj5xaHOx St+5prZa3sNFo16XoSxfm1o/ruHY0Ja99kLVuyJKInQdulwxA9itYsqPHGYqYE50dIlt MZuA== X-Received: by 10.28.92.203 with SMTP id q194mr2185292wmb.37.1446715829958; Thu, 05 Nov 2015 01:30:29 -0800 (PST) Received: from Red.local (ANice-651-1-289-62.w83-201.abo.wanadoo.fr. [83.201.177.62]) by smtp.googlemail.com with ESMTPSA id iw8sm5972014wjb.5.2015.11.05.01.30.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 01:30:29 -0800 (PST) From: LABBE Corentin To: alexandre.belloni@free-electrons.com, a.zummo@towertech.it, linux-arm-kernel@lists.infradead.org, maxime.ripard@free-electrons.com, wens@csie.org Subject: [PATCH] rtc: sunxi: fix some misceanellous problems Date: Thu, 5 Nov 2015 10:29:49 +0100 Message-Id: <1446715789-10460-1-git-send-email-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.4.10 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151105_013051_830868_9DF6A0D9 X-CRM114-Status: GOOD ( 14.72 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LABBE Corentin , linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP year must be set as unsigned since it is use with sunxi_rtc_data_year{.min|.max} and as parameter of is_leap_year() which wait for unsigned int. Only tm_year is not unsigned, but it is long. This patch fix also the format of printing of min/max. (must %u since they are unsigned) The parameter to of sunxi_rtc_setaie() must be set to uint since callers give always uint data. The struct data_year_param is never modified, so it can be set const. Signed-off-by: LABBE Corentin --- drivers/rtc/rtc-sunxi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c index 52543ae..9287afc 100644 --- a/drivers/rtc/rtc-sunxi.c +++ b/drivers/rtc/rtc-sunxi.c @@ -133,7 +133,7 @@ struct sunxi_rtc_data_year { unsigned char leap_shift; /* bit shift to get the leap year */ }; -static struct sunxi_rtc_data_year data_year_param[] = { +static const struct sunxi_rtc_data_year data_year_param[] = { [0] = { .min = 2010, .max = 2073, @@ -175,7 +175,7 @@ static irqreturn_t sunxi_rtc_alarmirq(int irq, void *id) return IRQ_NONE; } -static void sunxi_rtc_setaie(int to, struct sunxi_rtc_dev *chip) +static void sunxi_rtc_setaie(unsigned int to, struct sunxi_rtc_dev *chip) { u32 alrm_val = 0; u32 alrm_irq_val = 0; @@ -343,7 +343,7 @@ static int sunxi_rtc_settime(struct device *dev, struct rtc_time *rtc_tm) struct sunxi_rtc_dev *chip = dev_get_drvdata(dev); u32 date = 0; u32 time = 0; - int year; + unsigned int year; /* * the input rtc_tm->tm_year is the offset relative to 1900. We use @@ -353,8 +353,8 @@ static int sunxi_rtc_settime(struct device *dev, struct rtc_time *rtc_tm) year = rtc_tm->tm_year + 1900; if (year < chip->data_year->min || year > chip->data_year->max) { - dev_err(dev, "rtc only supports year in range %d - %d\n", - chip->data_year->min, chip->data_year->max); + dev_err(dev, "rtc only supports year in range %u - %u\n", + chip->data_year->min, chip->data_year->max); return -EINVAL; }