/* Return the current settings of the alarm @dev RTC device @alrm RTC wkalrm  */
static int kinetis_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
/* Return the current settings of the alarm @dev RTC device @alrm RTC wkalrm  */
static int kinetis_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
	struct kinetis_rtc *rtc = dev_get_drvdata(dev);
	struct rtc_time *tm = &alrm->time;
	long unsigned int secs;
	unsigned int ret = 0;
	spin_lock_irq(&rtc->lock);
	secs = readl(&KINETIS_RTC(rtc)->rtc_tar); 
	rtc_time_to_tm(secs, tm);
	alrm->enabled = (readl(&KINETIS_RTC(rtc)->rtc_ier) &
				KINETIS_RTC_IER_TAIE) ? 1 : 0;
	alrm->pending = (readl(&KINETIS_RTC(rtc)->rtc_sr) &
				KINETIS_RTC_SR_TAF) ? 1 : 0;
	spin_unlock_irq(&rtc->lock);
	d_printk(2, "secs=%ld,enabled=%d,ret=%d\n",
		secs, alrm->enabled, ret);
	return ret;
}