Re: [Patch v3 3/7] rtc: DA9055 RTC driver

From: Andrew Morton
Date: Thu Dec 13 2012 - 16:39:29 EST


On Thu, 13 Dec 2012 18:34:20 +0530
Ashish Jangam <ashish.jangam@xxxxxxxxxxxxxxx> wrote:

> (This rtc patch is resend for merge)
> ---
> This is the RTC patch for the DA9055 PMIC. This patch has got dependency on
> the DA9055 MFD core.
>
> This patch is functionally tested on Samsung SMDKV6410.
>
> ...
>
> +static int __init da9055_rtc_device_init(struct da9055 *da9055,
> + struct da9055_pdata *pdata)
> +{
> + int ret;
> +
> + /* Enable RTC and the internal Crystal */
> + ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_B,
> + DA9055_RTC_EN, DA9055_RTC_EN);
> + if (ret < 0)
> + return ret;
> + ret = da9055_reg_update(da9055, DA9055_REG_EN_32K,
> + DA9055_CRYSTAL_EN, DA9055_CRYSTAL_EN);
> + if (ret < 0)
> + return ret;
> +
> + /* Enable RTC in Power Down mode */
> + ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_B,
> + DA9055_RTC_MODE_PD, DA9055_RTC_MODE_PD);
> + if (ret < 0)
> + return ret;
> +
> + /* Enable RTC in Reset mode */
> + if (pdata && pdata->reset_enable) {
> + ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_B,
> + DA9055_RTC_MODE_SD,
> + DA9055_RTC_MODE_SD <<
> + DA9055_RTC_MODE_SD_SHIFT);
> + if (ret < 0)
> + return ret;
> + }
> +
> + /* Disable the RTC TICK ALM */
> + ret = da9055_reg_update(da9055, DA9055_REG_ALARM_MO,
> + DA9055_RTC_TICK_WAKE_MASK, 0);
> + if (ret < 0)
> + return ret;

If one of these failure paths is taken, the hardware will be left in a
part-initialised state. Is this wise?

> + return 0;
> +}

--
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/