/* We use Alarm A, because Alarm B is already used to emulate update interrupt.  */
static int stm32f2_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
/* We use Alarm A, because Alarm B is already used to emulate update interrupt.  */
static int stm32f2_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
	struct stm32f2_rtc *rtc = dev_get_drvdata(dev);
	struct rtc_time *tm = &alrm->time;
	int rv;
	if (rtc_valid_tm(tm)) {
		rv = -EINVAL;
		goto out;
	}
	spin_lock_irq(&rtc->lock);
	stm32f2_setup_alarm(
		0, tm->tm_mday, tm->tm_wday,
		tm->tm_hour, tm->tm_min, tm->tm_sec);
	if (alrm->enabled)
		stm32f2_alarm_irq_enable(0, 1);
	spin_unlock_irq(&rtc->lock);
	rv = 0;
out:
	return rv;
}