Re: [PATCH v6 3/5] RTC: RK808: add RTC driver for RK808

Heiko Stübner
2014-08-27T18:50:37Z

Hi Chris,

Am Dienstag, 26. August 2014, 22:14:56 schrieb Chris Zhong:
> Adding RTC driver for supporting RTC device present inside RK808 PMIC.
>
> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
> Signed-off-by: Zhang Qing <zhangqing@rock-chips.com>
>
> ---
>
> Changes in v6:
> Adviced by doug
> - move RTC_READSEL setting into probe
>
> Changes in v5:
> - fixed a bug about set_time failed
>
> Changes in v4:
> - use &client->dev replace rk808->dev
>
> Changes in v3: None
> Changes in v2:
> Adviced by javier.martinez
> - Add a separate clock driver, rather than in RTC driver
>
> drivers/rtc/Kconfig | 10 ++
> drivers/rtc/Makefile | 1 +
> drivers/rtc/rtc-rk808.c | 412
> +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 423
> insertions(+)
> create mode 100644 drivers/rtc/rtc-rk808.c
>

[...]

> diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c
> new file mode 100644
> index 0000000..00cd997
> --- /dev/null
> +++ b/drivers/rtc/rtc-rk808.c

[...]

> +/*
> + * We will just handle setting the frequency and make use the framework for
> + * reading the periodic interupts.
> + *
> + * @freq: Current periodic IRQ freq:
> + * bit 0: every second
> + * bit 1: every minute
> + * bit 2: every hour
> + * bit 3: every day
> + */
> +static irqreturn_t rk808_alarm_irq(int irq, void *data)
> +{
> + struct rk808_rtc *rk808_rtc = data;
> + struct rk808 *rk808 = rk808_rtc->rk808;
> + struct i2c_client *client = rk808->i2c;
> + uint32_t rtc_ctl;
> + int ret;
> +
> + ret = regmap_write(rk808->regmap, RK808_RTC_STATUS_REG,
> + RTC_STATUS_MASK);
> + if (ret) {
> + dev_err(&client->dev,
> + "%s:Failed to update RTC status: %d\n", __func__, ret);
> + return ret;
> + }
> +
> + rtc_update_irq(rk808_rtc->rtc, 1, RTC_IRQF | RTC_AF);
> + dev_dbg(&client->dev,
> + "%s:irq=%d,rtc_ctl=0x%x\n", __func__, irq, rtc_ctl);

what is rtc_ctl? It seems to be unused and its use in the dev_dbg produces:

drivers/rtc/rtc-rk808.c: In function 'rk808_alarm_irq':
drivers/rtc/rtc-rk808.c:258:2: warning: 'rtc_ctl' may be used uninitialized in this function [-Wuninitialized]

Heiko