Re: [PATCH 06/07] RTC: RTC driver for DA9052/53 PMIC v1

From: Andrew Morton
Date: Mon Feb 06 2012 - 17:38:37 EST


On Mon, 6 Feb 2012 18:19:05 +0530
Ashish Jangam <ashish.jangam@xxxxxxxxxxxxxxx> wrote:

> RTC Driver for Dialog Semiconductor DA9052/53 PMICs.
>
> This patch is functionally tested on Samsung SMDKV6410.
>
> ...
>
> drivers/rtc/Kconfig | 7 +
> drivers/rtc/Makefile | 1 +
> drivers/rtc/rtc-da9052.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 301 insertions(+), 0 deletions(-)

I assume that this patch is mergeable without any of the other six
patches in this series. It compiles OK...

>
> ...
>
> +static int da9052_read_alarm(struct da9052 *da9052, struct rtc_time *rtc_tm)
> +{
> + int ret;
> + uint8_t v[5] = {0, 0, 0, 0, 0};

These initalised local arrays are expensive. The below patch reduces
the module's text size by over 100 bytes.

The arrays whcih are passed to da9052_group_write() surely didn't need
initalisation, and I trust that's also the case with the arrays which
are passed to da9052_group_read()?

>
> ...
>

From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Subject: rtc-rtc-driver-for-da9052-53-pmic-v1-fix

- clean up file header layout
- remove unneeded initialisation of local arrays

Cc: Ashish Jangam <ashish.jangam@xxxxxxxxxxxxxxx>
Cc: David Dajun Chen <dchen@xxxxxxxxxxx>
Cc: Paul Gortmaker <p_gortmaker@xxxxxxxxx>
Cc: David Dajun Chen <dchen@xxxxxxxxxxx>
Cc: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx>
Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

drivers/rtc/rtc-da9052.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff -puN drivers/rtc/rtc-da9052.c~rtc-rtc-driver-for-da9052-53-pmic-v1-fix drivers/rtc/rtc-da9052.c
--- a/drivers/rtc/rtc-da9052.c~rtc-rtc-driver-for-da9052-53-pmic-v1-fix
+++ a/drivers/rtc/rtc-da9052.c
@@ -1,9 +1,9 @@
/*
* Real time clock driver for DA9052
*
- *Copyright(c) 2012 Dialog Semiconductor Ltd.
+ * Copyright(c) 2012 Dialog Semiconductor Ltd.
*
- *Author: Dajun Dajun Chen <dajun.chen@xxxxxxxxxxx>
+ * Author: Dajun Dajun Chen <dajun.chen@xxxxxxxxxxx>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ static irqreturn_t da9052_rtc_irq(int ir
static int da9052_read_alarm(struct da9052 *da9052, struct rtc_time *rtc_tm)
{
int ret;
- uint8_t v[5] = {0, 0, 0, 0, 0};
+ uint8_t v[5];

ret = da9052_group_read(da9052, DA9052_ALARM_MI_REG, 5, v);
if (ret != 0) {
@@ -92,7 +92,7 @@ static int da9052_read_alarm(struct da90
static int da9052_set_alarm(struct da9052 *da9052, struct rtc_time *rtc_tm)
{
int ret;
- uint8_t v[3] = {0, 0, 0};
+ uint8_t v[3];

rtc_tm->tm_year -= 100;
rtc_tm->tm_mon += 1;
@@ -136,7 +136,7 @@ static int da9052_rtc_get_alarm_status(s
static int da9052_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm)
{
struct da9052_rtc *rtc = dev_get_drvdata(dev);
- uint8_t v[6] = {0, 0, 0, 0, 0, 0};
+ uint8_t v[6];
int ret;

ret = da9052_group_read(rtc->da9052, DA9052_COUNT_S_REG, 6, v);
@@ -164,7 +164,7 @@ static int da9052_rtc_read_time(struct d
static int da9052_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
struct da9052_rtc *rtc;
- uint8_t v[6] = {0, 0, 0, 0, 0, 0};
+ uint8_t v[6];

rtc = dev_get_drvdata(dev);

_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/