diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2011-09-20 21:45:56 +0200 | 
|---|---|---|
| committer | Arnd Bergmann <arnd@arndb.de> | 2011-09-20 21:45:56 +0200 | 
| commit | 1fdb4888e45f1413972a8e9da55f3ffc08b9abcb (patch) | |
| tree | 635ef73cdff38d21a529bbdcab4cd2cb39a29484 /drivers/rtc/rtc-s3c.c | |
| parent | 1884af9365a96314164f4110d4528d425e5dd843 (diff) | |
| parent | ceb1c532ba6220900e61ec7073a9234661efa450 (diff) | |
Merge branch 'omap/cleanup' into next/cleanup
Diffstat (limited to 'drivers/rtc/rtc-s3c.c')
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 79 | 
1 files changed, 31 insertions, 48 deletions
| diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 9329dbb9ebab..4e7c04e773e0 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -152,10 +152,6 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)  		goto retry_get_time;  	} -	pr_debug("read time %04d.%02d.%02d %02d:%02d:%02d\n", -		 1900 + rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, -		 rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); -  	rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);  	rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);  	rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour); @@ -164,6 +160,11 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)  	rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);  	rtc_tm->tm_year += 100; + +	pr_debug("read time %04d.%02d.%02d %02d:%02d:%02d\n", +		 1900 + rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, +		 rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); +  	rtc_tm->tm_mon -= 1;  	clk_disable(rtc_clk); @@ -269,10 +270,9 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)  	clk_enable(rtc_clk);  	pr_debug("s3c_rtc_setalarm: %d, %04d.%02d.%02d %02d:%02d:%02d\n",  		 alrm->enabled, -		 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, +		 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday,  		 tm->tm_hour, tm->tm_min, tm->tm_sec); -  	alrm_en = readb(base + S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN;  	writeb(0x00, base + S3C2410_RTCALM); @@ -319,49 +319,7 @@ static int s3c_rtc_proc(struct device *dev, struct seq_file *seq)  	return 0;  } -static int s3c_rtc_open(struct device *dev) -{ -	struct platform_device *pdev = to_platform_device(dev); -	struct rtc_device *rtc_dev = platform_get_drvdata(pdev); -	int ret; - -	ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, -			  IRQF_DISABLED,  "s3c2410-rtc alarm", rtc_dev); - -	if (ret) { -		dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); -		return ret; -	} - -	ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, -			  IRQF_DISABLED,  "s3c2410-rtc tick", rtc_dev); - -	if (ret) { -		dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); -		goto tick_err; -	} - -	return ret; - - tick_err: -	free_irq(s3c_rtc_alarmno, rtc_dev); -	return ret; -} - -static void s3c_rtc_release(struct device *dev) -{ -	struct platform_device *pdev = to_platform_device(dev); -	struct rtc_device *rtc_dev = platform_get_drvdata(pdev); - -	/* do not clear AIE here, it may be needed for wake */ - -	free_irq(s3c_rtc_alarmno, rtc_dev); -	free_irq(s3c_rtc_tickno, rtc_dev); -} -  static const struct rtc_class_ops s3c_rtcops = { -	.open		= s3c_rtc_open, -	.release	= s3c_rtc_release,  	.read_time	= s3c_rtc_gettime,  	.set_time	= s3c_rtc_settime,  	.read_alarm	= s3c_rtc_getalarm, @@ -425,6 +383,9 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)  {  	struct rtc_device *rtc = platform_get_drvdata(dev); +	free_irq(s3c_rtc_alarmno, rtc); +	free_irq(s3c_rtc_tickno, rtc); +  	platform_set_drvdata(dev, NULL);  	rtc_device_unregister(rtc); @@ -548,10 +509,32 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)  	s3c_rtc_setfreq(&pdev->dev, 1); +	ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, +			  IRQF_DISABLED,  "s3c2410-rtc alarm", rtc); +	if (ret) { +		dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); +		goto err_alarm_irq; +	} + +	ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, +			  IRQF_DISABLED,  "s3c2410-rtc tick", rtc); +	if (ret) { +		dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); +		free_irq(s3c_rtc_alarmno, rtc); +		goto err_tick_irq; +	} +  	clk_disable(rtc_clk);  	return 0; + err_tick_irq: +	free_irq(s3c_rtc_alarmno, rtc); + + err_alarm_irq: +	platform_set_drvdata(pdev, NULL); +	rtc_device_unregister(rtc); +   err_nortc:  	s3c_rtc_enable(pdev, 0);  	clk_disable(rtc_clk); | 
