diff options
Diffstat (limited to 'drivers/rtc')
40 files changed, 233 insertions, 444 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 8e286259a007..8a1c031391d6 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -228,11 +228,11 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
228 | alarm->time.tm_hour = now.tm_hour; | 228 | alarm->time.tm_hour = now.tm_hour; |
229 | 229 | ||
230 | /* For simplicity, only support date rollover for now */ | 230 | /* For simplicity, only support date rollover for now */ |
231 | if (alarm->time.tm_mday == -1) { | 231 | if (alarm->time.tm_mday < 1 || alarm->time.tm_mday > 31) { |
232 | alarm->time.tm_mday = now.tm_mday; | 232 | alarm->time.tm_mday = now.tm_mday; |
233 | missing = day; | 233 | missing = day; |
234 | } | 234 | } |
235 | if (alarm->time.tm_mon == -1) { | 235 | if ((unsigned)alarm->time.tm_mon >= 12) { |
236 | alarm->time.tm_mon = now.tm_mon; | 236 | alarm->time.tm_mon = now.tm_mon; |
237 | if (missing == none) | 237 | if (missing == none) |
238 | missing = month; | 238 | missing = month; |
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c index 64b847b7f970..f04761e6622d 100644 --- a/drivers/rtc/rtc-88pm860x.c +++ b/drivers/rtc/rtc-88pm860x.c | |||
@@ -410,17 +410,7 @@ static struct platform_driver pm860x_rtc_driver = { | |||
410 | .remove = __devexit_p(pm860x_rtc_remove), | 410 | .remove = __devexit_p(pm860x_rtc_remove), |
411 | }; | 411 | }; |
412 | 412 | ||
413 | static int __init pm860x_rtc_init(void) | 413 | module_platform_driver(pm860x_rtc_driver); |
414 | { | ||
415 | return platform_driver_register(&pm860x_rtc_driver); | ||
416 | } | ||
417 | module_init(pm860x_rtc_init); | ||
418 | |||
419 | static void __exit pm860x_rtc_exit(void) | ||
420 | { | ||
421 | platform_driver_unregister(&pm860x_rtc_driver); | ||
422 | } | ||
423 | module_exit(pm860x_rtc_exit); | ||
424 | 414 | ||
425 | MODULE_DESCRIPTION("Marvell 88PM860x RTC driver"); | 415 | MODULE_DESCRIPTION("Marvell 88PM860x RTC driver"); |
426 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | 416 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index e346705aae92..a0a9810adf0b 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c | |||
@@ -90,7 +90,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
90 | 90 | ||
91 | /* Early AB8500 chips will not clear the rtc read request bit */ | 91 | /* Early AB8500 chips will not clear the rtc read request bit */ |
92 | if (abx500_get_chip_id(dev) == 0) { | 92 | if (abx500_get_chip_id(dev) == 0) { |
93 | msleep(1); | 93 | usleep_range(1000, 1000); |
94 | } else { | 94 | } else { |
95 | /* Wait for some cycles after enabling the rtc read in ab8500 */ | 95 | /* Wait for some cycles after enabling the rtc read in ab8500 */ |
96 | while (time_before(jiffies, timeout)) { | 96 | while (time_before(jiffies, timeout)) { |
@@ -102,7 +102,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
102 | if (!(value & RTC_READ_REQUEST)) | 102 | if (!(value & RTC_READ_REQUEST)) |
103 | break; | 103 | break; |
104 | 104 | ||
105 | msleep(1); | 105 | usleep_range(1000, 5000); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
@@ -258,6 +258,109 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
258 | return ab8500_rtc_irq_enable(dev, alarm->enabled); | 258 | return ab8500_rtc_irq_enable(dev, alarm->enabled); |
259 | } | 259 | } |
260 | 260 | ||
261 | |||
262 | static int ab8500_rtc_set_calibration(struct device *dev, int calibration) | ||
263 | { | ||
264 | int retval; | ||
265 | u8 rtccal = 0; | ||
266 | |||
267 | /* | ||
268 | * Check that the calibration value (which is in units of 0.5 | ||
269 | * parts-per-million) is in the AB8500's range for RtcCalibration | ||
270 | * register. -128 (0x80) is not permitted because the AB8500 uses | ||
271 | * a sign-bit rather than two's complement, so 0x80 is just another | ||
272 | * representation of zero. | ||
273 | */ | ||
274 | if ((calibration < -127) || (calibration > 127)) { | ||
275 | dev_err(dev, "RtcCalibration value outside permitted range\n"); | ||
276 | return -EINVAL; | ||
277 | } | ||
278 | |||
279 | /* | ||
280 | * The AB8500 uses sign (in bit7) and magnitude (in bits0-7) | ||
281 | * so need to convert to this sort of representation before writing | ||
282 | * into RtcCalibration register... | ||
283 | */ | ||
284 | if (calibration >= 0) | ||
285 | rtccal = 0x7F & calibration; | ||
286 | else | ||
287 | rtccal = ~(calibration - 1) | 0x80; | ||
288 | |||
289 | retval = abx500_set_register_interruptible(dev, AB8500_RTC, | ||
290 | AB8500_RTC_CALIB_REG, rtccal); | ||
291 | |||
292 | return retval; | ||
293 | } | ||
294 | |||
295 | static int ab8500_rtc_get_calibration(struct device *dev, int *calibration) | ||
296 | { | ||
297 | int retval; | ||
298 | u8 rtccal = 0; | ||
299 | |||
300 | retval = abx500_get_register_interruptible(dev, AB8500_RTC, | ||
301 | AB8500_RTC_CALIB_REG, &rtccal); | ||
302 | if (retval >= 0) { | ||
303 | /* | ||
304 | * The AB8500 uses sign (in bit7) and magnitude (in bits0-7) | ||
305 | * so need to convert value from RtcCalibration register into | ||
306 | * a two's complement signed value... | ||
307 | */ | ||
308 | if (rtccal & 0x80) | ||
309 | *calibration = 0 - (rtccal & 0x7F); | ||
310 | else | ||
311 | *calibration = 0x7F & rtccal; | ||
312 | } | ||
313 | |||
314 | return retval; | ||
315 | } | ||
316 | |||
317 | static ssize_t ab8500_sysfs_store_rtc_calibration(struct device *dev, | ||
318 | struct device_attribute *attr, | ||
319 | const char *buf, size_t count) | ||
320 | { | ||
321 | int retval; | ||
322 | int calibration = 0; | ||
323 | |||
324 | if (sscanf(buf, " %i ", &calibration) != 1) { | ||
325 | dev_err(dev, "Failed to store RTC calibration attribute\n"); | ||
326 | return -EINVAL; | ||
327 | } | ||
328 | |||
329 | retval = ab8500_rtc_set_calibration(dev, calibration); | ||
330 | |||
331 | return retval ? retval : count; | ||
332 | } | ||
333 | |||
334 | static ssize_t ab8500_sysfs_show_rtc_calibration(struct device *dev, | ||
335 | struct device_attribute *attr, char *buf) | ||
336 | { | ||
337 | int retval = 0; | ||
338 | int calibration = 0; | ||
339 | |||
340 | retval = ab8500_rtc_get_calibration(dev, &calibration); | ||
341 | if (retval < 0) { | ||
342 | dev_err(dev, "Failed to read RTC calibration attribute\n"); | ||
343 | sprintf(buf, "0\n"); | ||
344 | return retval; | ||
345 | } | ||
346 | |||
347 | return sprintf(buf, "%d\n", calibration); | ||
348 | } | ||
349 | |||
350 | static DEVICE_ATTR(rtc_calibration, S_IRUGO | S_IWUSR, | ||
351 | ab8500_sysfs_show_rtc_calibration, | ||
352 | ab8500_sysfs_store_rtc_calibration); | ||
353 | |||
354 | static int ab8500_sysfs_rtc_register(struct device *dev) | ||
355 | { | ||
356 | return device_create_file(dev, &dev_attr_rtc_calibration); | ||
357 | } | ||
358 | |||
359 | static void ab8500_sysfs_rtc_unregister(struct device *dev) | ||
360 | { | ||
361 | device_remove_file(dev, &dev_attr_rtc_calibration); | ||
362 | } | ||
363 | |||
261 | static irqreturn_t rtc_alarm_handler(int irq, void *data) | 364 | static irqreturn_t rtc_alarm_handler(int irq, void *data) |
262 | { | 365 | { |
263 | struct rtc_device *rtc = data; | 366 | struct rtc_device *rtc = data; |
@@ -295,7 +398,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
295 | return err; | 398 | return err; |
296 | 399 | ||
297 | /* Wait for reset by the PorRtc */ | 400 | /* Wait for reset by the PorRtc */ |
298 | msleep(1); | 401 | usleep_range(1000, 5000); |
299 | 402 | ||
300 | err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC, | 403 | err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC, |
301 | AB8500_RTC_STAT_REG, &rtc_ctrl); | 404 | AB8500_RTC_STAT_REG, &rtc_ctrl); |
@@ -308,6 +411,8 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
308 | return -ENODEV; | 411 | return -ENODEV; |
309 | } | 412 | } |
310 | 413 | ||
414 | device_init_wakeup(&pdev->dev, true); | ||
415 | |||
311 | rtc = rtc_device_register("ab8500-rtc", &pdev->dev, &ab8500_rtc_ops, | 416 | rtc = rtc_device_register("ab8500-rtc", &pdev->dev, &ab8500_rtc_ops, |
312 | THIS_MODULE); | 417 | THIS_MODULE); |
313 | if (IS_ERR(rtc)) { | 418 | if (IS_ERR(rtc)) { |
@@ -316,8 +421,8 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
316 | return err; | 421 | return err; |
317 | } | 422 | } |
318 | 423 | ||
319 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, 0, | 424 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, |
320 | "ab8500-rtc", rtc); | 425 | IRQF_NO_SUSPEND, "ab8500-rtc", rtc); |
321 | if (err < 0) { | 426 | if (err < 0) { |
322 | rtc_device_unregister(rtc); | 427 | rtc_device_unregister(rtc); |
323 | return err; | 428 | return err; |
@@ -325,6 +430,13 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
325 | 430 | ||
326 | platform_set_drvdata(pdev, rtc); | 431 | platform_set_drvdata(pdev, rtc); |
327 | 432 | ||
433 | |||
434 | err = ab8500_sysfs_rtc_register(&pdev->dev); | ||
435 | if (err) { | ||
436 | dev_err(&pdev->dev, "sysfs RTC failed to register\n"); | ||
437 | return err; | ||
438 | } | ||
439 | |||
328 | return 0; | 440 | return 0; |
329 | } | 441 | } |
330 | 442 | ||
@@ -333,6 +445,8 @@ static int __devexit ab8500_rtc_remove(struct platform_device *pdev) | |||
333 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 445 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
334 | int irq = platform_get_irq_byname(pdev, "ALARM"); | 446 | int irq = platform_get_irq_byname(pdev, "ALARM"); |
335 | 447 | ||
448 | ab8500_sysfs_rtc_unregister(&pdev->dev); | ||
449 | |||
336 | free_irq(irq, rtc); | 450 | free_irq(irq, rtc); |
337 | rtc_device_unregister(rtc); | 451 | rtc_device_unregister(rtc); |
338 | platform_set_drvdata(pdev, NULL); | 452 | platform_set_drvdata(pdev, NULL); |
@@ -349,18 +463,8 @@ static struct platform_driver ab8500_rtc_driver = { | |||
349 | .remove = __devexit_p(ab8500_rtc_remove), | 463 | .remove = __devexit_p(ab8500_rtc_remove), |
350 | }; | 464 | }; |
351 | 465 | ||
352 | static int __init ab8500_rtc_init(void) | 466 | module_platform_driver(ab8500_rtc_driver); |
353 | { | ||
354 | return platform_driver_register(&ab8500_rtc_driver); | ||
355 | } | ||
356 | |||
357 | static void __exit ab8500_rtc_exit(void) | ||
358 | { | ||
359 | platform_driver_unregister(&ab8500_rtc_driver); | ||
360 | } | ||
361 | 467 | ||
362 | module_init(ab8500_rtc_init); | ||
363 | module_exit(ab8500_rtc_exit); | ||
364 | MODULE_AUTHOR("Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>"); | 468 | MODULE_AUTHOR("Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>"); |
365 | MODULE_DESCRIPTION("AB8500 RTC Driver"); | 469 | MODULE_DESCRIPTION("AB8500 RTC Driver"); |
366 | MODULE_LICENSE("GPL v2"); | 470 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 90d866272c8e..abfc1a0c07d9 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
@@ -456,18 +456,7 @@ static struct platform_driver bfin_rtc_driver = { | |||
456 | .resume = bfin_rtc_resume, | 456 | .resume = bfin_rtc_resume, |
457 | }; | 457 | }; |
458 | 458 | ||
459 | static int __init bfin_rtc_init(void) | 459 | module_platform_driver(bfin_rtc_driver); |
460 | { | ||
461 | return platform_driver_register(&bfin_rtc_driver); | ||
462 | } | ||
463 | |||
464 | static void __exit bfin_rtc_exit(void) | ||
465 | { | ||
466 | platform_driver_unregister(&bfin_rtc_driver); | ||
467 | } | ||
468 | |||
469 | module_init(bfin_rtc_init); | ||
470 | module_exit(bfin_rtc_exit); | ||
471 | 460 | ||
472 | MODULE_DESCRIPTION("Blackfin On-Chip Real Time Clock Driver"); | 461 | MODULE_DESCRIPTION("Blackfin On-Chip Real Time Clock Driver"); |
473 | MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); | 462 | MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); |
diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c index 128270ce355d..bf612ef22941 100644 --- a/drivers/rtc/rtc-bq4802.c +++ b/drivers/rtc/rtc-bq4802.c | |||
@@ -218,15 +218,4 @@ static struct platform_driver bq4802_driver = { | |||
218 | .remove = __devexit_p(bq4802_remove), | 218 | .remove = __devexit_p(bq4802_remove), |
219 | }; | 219 | }; |
220 | 220 | ||
221 | static int __init bq4802_init(void) | 221 | module_platform_driver(bq4802_driver); |
222 | { | ||
223 | return platform_driver_register(&bq4802_driver); | ||
224 | } | ||
225 | |||
226 | static void __exit bq4802_exit(void) | ||
227 | { | ||
228 | platform_driver_unregister(&bq4802_driver); | ||
229 | } | ||
230 | |||
231 | module_init(bq4802_init); | ||
232 | module_exit(bq4802_exit); | ||
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 05beb6c1ca79..d7782aa09943 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -164,7 +164,7 @@ static inline unsigned char cmos_read_bank2(unsigned char addr) | |||
164 | static inline void cmos_write_bank2(unsigned char val, unsigned char addr) | 164 | static inline void cmos_write_bank2(unsigned char val, unsigned char addr) |
165 | { | 165 | { |
166 | outb(addr, RTC_PORT(2)); | 166 | outb(addr, RTC_PORT(2)); |
167 | outb(val, RTC_PORT(2)); | 167 | outb(val, RTC_PORT(3)); |
168 | } | 168 | } |
169 | 169 | ||
170 | #else | 170 | #else |
diff --git a/drivers/rtc/rtc-dm355evm.c b/drivers/rtc/rtc-dm355evm.c index 2322c43af201..d4457afcba89 100644 --- a/drivers/rtc/rtc-dm355evm.c +++ b/drivers/rtc/rtc-dm355evm.c | |||
@@ -161,16 +161,6 @@ static struct platform_driver rtc_dm355evm_driver = { | |||
161 | }, | 161 | }, |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static int __init dm355evm_rtc_init(void) | 164 | module_platform_driver(rtc_dm355evm_driver); |
165 | { | ||
166 | return platform_driver_register(&rtc_dm355evm_driver); | ||
167 | } | ||
168 | module_init(dm355evm_rtc_init); | ||
169 | |||
170 | static void __exit dm355evm_rtc_exit(void) | ||
171 | { | ||
172 | platform_driver_unregister(&rtc_dm355evm_driver); | ||
173 | } | ||
174 | module_exit(dm355evm_rtc_exit); | ||
175 | 165 | ||
176 | MODULE_LICENSE("GPL"); | 166 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c index 68e6caf25496..990c3ff489bf 100644 --- a/drivers/rtc/rtc-ds1286.c +++ b/drivers/rtc/rtc-ds1286.c | |||
@@ -396,21 +396,10 @@ static struct platform_driver ds1286_platform_driver = { | |||
396 | .remove = __devexit_p(ds1286_remove), | 396 | .remove = __devexit_p(ds1286_remove), |
397 | }; | 397 | }; |
398 | 398 | ||
399 | static int __init ds1286_init(void) | 399 | module_platform_driver(ds1286_platform_driver); |
400 | { | ||
401 | return platform_driver_register(&ds1286_platform_driver); | ||
402 | } | ||
403 | |||
404 | static void __exit ds1286_exit(void) | ||
405 | { | ||
406 | platform_driver_unregister(&ds1286_platform_driver); | ||
407 | } | ||
408 | 400 | ||
409 | MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); | 401 | MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); |
410 | MODULE_DESCRIPTION("DS1286 RTC driver"); | 402 | MODULE_DESCRIPTION("DS1286 RTC driver"); |
411 | MODULE_LICENSE("GPL"); | 403 | MODULE_LICENSE("GPL"); |
412 | MODULE_VERSION(DRV_VERSION); | 404 | MODULE_VERSION(DRV_VERSION); |
413 | MODULE_ALIAS("platform:rtc-ds1286"); | 405 | MODULE_ALIAS("platform:rtc-ds1286"); |
414 | |||
415 | module_init(ds1286_init); | ||
416 | module_exit(ds1286_exit); | ||
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index 586c244a05d8..761f36bc83a9 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
@@ -580,20 +580,7 @@ static struct platform_driver ds1511_rtc_driver = { | |||
580 | }, | 580 | }, |
581 | }; | 581 | }; |
582 | 582 | ||
583 | static int __init | 583 | module_platform_driver(ds1511_rtc_driver); |
584 | ds1511_rtc_init(void) | ||
585 | { | ||
586 | return platform_driver_register(&ds1511_rtc_driver); | ||
587 | } | ||
588 | |||
589 | static void __exit | ||
590 | ds1511_rtc_exit(void) | ||
591 | { | ||
592 | platform_driver_unregister(&ds1511_rtc_driver); | ||
593 | } | ||
594 | |||
595 | module_init(ds1511_rtc_init); | ||
596 | module_exit(ds1511_rtc_exit); | ||
597 | 584 | ||
598 | MODULE_AUTHOR("Andrew Sharp <andy.sharp@lsi.com>"); | 585 | MODULE_AUTHOR("Andrew Sharp <andy.sharp@lsi.com>"); |
599 | MODULE_DESCRIPTION("Dallas DS1511 RTC driver"); | 586 | MODULE_DESCRIPTION("Dallas DS1511 RTC driver"); |
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index 1350029044e6..6f0a1b530f2e 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
@@ -361,18 +361,7 @@ static struct platform_driver ds1553_rtc_driver = { | |||
361 | }, | 361 | }, |
362 | }; | 362 | }; |
363 | 363 | ||
364 | static __init int ds1553_init(void) | 364 | module_platform_driver(ds1553_rtc_driver); |
365 | { | ||
366 | return platform_driver_register(&ds1553_rtc_driver); | ||
367 | } | ||
368 | |||
369 | static __exit void ds1553_exit(void) | ||
370 | { | ||
371 | platform_driver_unregister(&ds1553_rtc_driver); | ||
372 | } | ||
373 | |||
374 | module_init(ds1553_init); | ||
375 | module_exit(ds1553_exit); | ||
376 | 365 | ||
377 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); | 366 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); |
378 | MODULE_DESCRIPTION("Dallas DS1553 RTC driver"); | 367 | MODULE_DESCRIPTION("Dallas DS1553 RTC driver"); |
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index e3e0f92b60f0..76112667c507 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
@@ -240,18 +240,7 @@ static struct platform_driver ds1742_rtc_driver = { | |||
240 | }, | 240 | }, |
241 | }; | 241 | }; |
242 | 242 | ||
243 | static __init int ds1742_init(void) | 243 | module_platform_driver(ds1742_rtc_driver); |
244 | { | ||
245 | return platform_driver_register(&ds1742_rtc_driver); | ||
246 | } | ||
247 | |||
248 | static __exit void ds1742_exit(void) | ||
249 | { | ||
250 | platform_driver_unregister(&ds1742_rtc_driver); | ||
251 | } | ||
252 | |||
253 | module_init(ds1742_init); | ||
254 | module_exit(ds1742_exit); | ||
255 | 244 | ||
256 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); | 245 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); |
257 | MODULE_DESCRIPTION("Dallas DS1742 RTC driver"); | 246 | MODULE_DESCRIPTION("Dallas DS1742 RTC driver"); |
diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c index b6473631d182..05ab227eeff7 100644 --- a/drivers/rtc/rtc-jz4740.c +++ b/drivers/rtc/rtc-jz4740.c | |||
@@ -345,7 +345,7 @@ static const struct dev_pm_ops jz4740_pm_ops = { | |||
345 | #define JZ4740_RTC_PM_OPS NULL | 345 | #define JZ4740_RTC_PM_OPS NULL |
346 | #endif /* CONFIG_PM */ | 346 | #endif /* CONFIG_PM */ |
347 | 347 | ||
348 | struct platform_driver jz4740_rtc_driver = { | 348 | static struct platform_driver jz4740_rtc_driver = { |
349 | .probe = jz4740_rtc_probe, | 349 | .probe = jz4740_rtc_probe, |
350 | .remove = __devexit_p(jz4740_rtc_remove), | 350 | .remove = __devexit_p(jz4740_rtc_remove), |
351 | .driver = { | 351 | .driver = { |
@@ -355,17 +355,7 @@ struct platform_driver jz4740_rtc_driver = { | |||
355 | }, | 355 | }, |
356 | }; | 356 | }; |
357 | 357 | ||
358 | static int __init jz4740_rtc_init(void) | 358 | module_platform_driver(jz4740_rtc_driver); |
359 | { | ||
360 | return platform_driver_register(&jz4740_rtc_driver); | ||
361 | } | ||
362 | module_init(jz4740_rtc_init); | ||
363 | |||
364 | static void __exit jz4740_rtc_exit(void) | ||
365 | { | ||
366 | platform_driver_unregister(&jz4740_rtc_driver); | ||
367 | } | ||
368 | module_exit(jz4740_rtc_exit); | ||
369 | 359 | ||
370 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | 360 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); |
371 | MODULE_LICENSE("GPL"); | 361 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c index ae16250c762f..ecc1713b2b4f 100644 --- a/drivers/rtc/rtc-lpc32xx.c +++ b/drivers/rtc/rtc-lpc32xx.c | |||
@@ -396,17 +396,7 @@ static struct platform_driver lpc32xx_rtc_driver = { | |||
396 | }, | 396 | }, |
397 | }; | 397 | }; |
398 | 398 | ||
399 | static int __init lpc32xx_rtc_init(void) | 399 | module_platform_driver(lpc32xx_rtc_driver); |
400 | { | ||
401 | return platform_driver_register(&lpc32xx_rtc_driver); | ||
402 | } | ||
403 | module_init(lpc32xx_rtc_init); | ||
404 | |||
405 | static void __exit lpc32xx_rtc_exit(void) | ||
406 | { | ||
407 | platform_driver_unregister(&lpc32xx_rtc_driver); | ||
408 | } | ||
409 | module_exit(lpc32xx_rtc_exit); | ||
410 | 400 | ||
411 | MODULE_AUTHOR("Kevin Wells <wellsk40@gmail.com"); | 401 | MODULE_AUTHOR("Kevin Wells <wellsk40@gmail.com"); |
412 | MODULE_DESCRIPTION("RTC driver for the LPC32xx SoC"); | 402 | MODULE_DESCRIPTION("RTC driver for the LPC32xx SoC"); |
diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c index 7317d3b9a3d5..ef71132ff205 100644 --- a/drivers/rtc/rtc-m41t93.c +++ b/drivers/rtc/rtc-m41t93.c | |||
@@ -200,7 +200,6 @@ static int __devexit m41t93_remove(struct spi_device *spi) | |||
200 | static struct spi_driver m41t93_driver = { | 200 | static struct spi_driver m41t93_driver = { |
201 | .driver = { | 201 | .driver = { |
202 | .name = "rtc-m41t93", | 202 | .name = "rtc-m41t93", |
203 | .bus = &spi_bus_type, | ||
204 | .owner = THIS_MODULE, | 203 | .owner = THIS_MODULE, |
205 | }, | 204 | }, |
206 | .probe = m41t93_probe, | 205 | .probe = m41t93_probe, |
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c index e259ed76ae85..2a4721f61797 100644 --- a/drivers/rtc/rtc-m41t94.c +++ b/drivers/rtc/rtc-m41t94.c | |||
@@ -147,7 +147,6 @@ static int __devexit m41t94_remove(struct spi_device *spi) | |||
147 | static struct spi_driver m41t94_driver = { | 147 | static struct spi_driver m41t94_driver = { |
148 | .driver = { | 148 | .driver = { |
149 | .name = "rtc-m41t94", | 149 | .name = "rtc-m41t94", |
150 | .bus = &spi_bus_type, | ||
151 | .owner = THIS_MODULE, | 150 | .owner = THIS_MODULE, |
152 | }, | 151 | }, |
153 | .probe = m41t94_probe, | 152 | .probe = m41t94_probe, |
diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c index 8e2a24e33ed6..f9e3b3583733 100644 --- a/drivers/rtc/rtc-m48t35.c +++ b/drivers/rtc/rtc-m48t35.c | |||
@@ -216,21 +216,10 @@ static struct platform_driver m48t35_platform_driver = { | |||
216 | .remove = __devexit_p(m48t35_remove), | 216 | .remove = __devexit_p(m48t35_remove), |
217 | }; | 217 | }; |
218 | 218 | ||
219 | static int __init m48t35_init(void) | 219 | module_platform_driver(m48t35_platform_driver); |
220 | { | ||
221 | return platform_driver_register(&m48t35_platform_driver); | ||
222 | } | ||
223 | |||
224 | static void __exit m48t35_exit(void) | ||
225 | { | ||
226 | platform_driver_unregister(&m48t35_platform_driver); | ||
227 | } | ||
228 | 220 | ||
229 | MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); | 221 | MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); |
230 | MODULE_DESCRIPTION("M48T35 RTC driver"); | 222 | MODULE_DESCRIPTION("M48T35 RTC driver"); |
231 | MODULE_LICENSE("GPL"); | 223 | MODULE_LICENSE("GPL"); |
232 | MODULE_VERSION(DRV_VERSION); | 224 | MODULE_VERSION(DRV_VERSION); |
233 | MODULE_ALIAS("platform:rtc-m48t35"); | 225 | MODULE_ALIAS("platform:rtc-m48t35"); |
234 | |||
235 | module_init(m48t35_init); | ||
236 | module_exit(m48t35_exit); | ||
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 28365388fb6c..30ebfec9fd2b 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -530,18 +530,7 @@ static struct platform_driver m48t59_rtc_driver = { | |||
530 | .remove = __devexit_p(m48t59_rtc_remove), | 530 | .remove = __devexit_p(m48t59_rtc_remove), |
531 | }; | 531 | }; |
532 | 532 | ||
533 | static int __init m48t59_rtc_init(void) | 533 | module_platform_driver(m48t59_rtc_driver); |
534 | { | ||
535 | return platform_driver_register(&m48t59_rtc_driver); | ||
536 | } | ||
537 | |||
538 | static void __exit m48t59_rtc_exit(void) | ||
539 | { | ||
540 | platform_driver_unregister(&m48t59_rtc_driver); | ||
541 | } | ||
542 | |||
543 | module_init(m48t59_rtc_init); | ||
544 | module_exit(m48t59_rtc_exit); | ||
545 | 534 | ||
546 | MODULE_AUTHOR("Mark Zhan <rongkai.zhan@windriver.com>"); | 535 | MODULE_AUTHOR("Mark Zhan <rongkai.zhan@windriver.com>"); |
547 | MODULE_DESCRIPTION("M48T59/M48T02/M48T08 RTC driver"); | 536 | MODULE_DESCRIPTION("M48T59/M48T02/M48T08 RTC driver"); |
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c index f981287d582b..863fb3363aa6 100644 --- a/drivers/rtc/rtc-m48t86.c +++ b/drivers/rtc/rtc-m48t86.c | |||
@@ -185,21 +185,10 @@ static struct platform_driver m48t86_rtc_platform_driver = { | |||
185 | .remove = __devexit_p(m48t86_rtc_remove), | 185 | .remove = __devexit_p(m48t86_rtc_remove), |
186 | }; | 186 | }; |
187 | 187 | ||
188 | static int __init m48t86_rtc_init(void) | 188 | module_platform_driver(m48t86_rtc_platform_driver); |
189 | { | ||
190 | return platform_driver_register(&m48t86_rtc_platform_driver); | ||
191 | } | ||
192 | |||
193 | static void __exit m48t86_rtc_exit(void) | ||
194 | { | ||
195 | platform_driver_unregister(&m48t86_rtc_platform_driver); | ||
196 | } | ||
197 | 189 | ||
198 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | 190 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); |
199 | MODULE_DESCRIPTION("M48T86 RTC driver"); | 191 | MODULE_DESCRIPTION("M48T86 RTC driver"); |
200 | MODULE_LICENSE("GPL"); | 192 | MODULE_LICENSE("GPL"); |
201 | MODULE_VERSION(DRV_VERSION); | 193 | MODULE_VERSION(DRV_VERSION); |
202 | MODULE_ALIAS("platform:rtc-m48t86"); | 194 | MODULE_ALIAS("platform:rtc-m48t86"); |
203 | |||
204 | module_init(m48t86_rtc_init); | ||
205 | module_exit(m48t86_rtc_exit); | ||
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 0ec3f588a255..1f6b3cc58e8a 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
@@ -154,7 +154,6 @@ static int __devexit max6902_remove(struct spi_device *spi) | |||
154 | static struct spi_driver max6902_driver = { | 154 | static struct spi_driver max6902_driver = { |
155 | .driver = { | 155 | .driver = { |
156 | .name = "rtc-max6902", | 156 | .name = "rtc-max6902", |
157 | .bus = &spi_bus_type, | ||
158 | .owner = THIS_MODULE, | 157 | .owner = THIS_MODULE, |
159 | }, | 158 | }, |
160 | .probe = max6902_probe, | 159 | .probe = max6902_probe, |
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c index 3bc046f427e0..4a5529346b47 100644 --- a/drivers/rtc/rtc-max8925.c +++ b/drivers/rtc/rtc-max8925.c | |||
@@ -299,17 +299,7 @@ static struct platform_driver max8925_rtc_driver = { | |||
299 | .remove = __devexit_p(max8925_rtc_remove), | 299 | .remove = __devexit_p(max8925_rtc_remove), |
300 | }; | 300 | }; |
301 | 301 | ||
302 | static int __init max8925_rtc_init(void) | 302 | module_platform_driver(max8925_rtc_driver); |
303 | { | ||
304 | return platform_driver_register(&max8925_rtc_driver); | ||
305 | } | ||
306 | module_init(max8925_rtc_init); | ||
307 | |||
308 | static void __exit max8925_rtc_exit(void) | ||
309 | { | ||
310 | platform_driver_unregister(&max8925_rtc_driver); | ||
311 | } | ||
312 | module_exit(max8925_rtc_exit); | ||
313 | 303 | ||
314 | MODULE_DESCRIPTION("Maxim MAX8925 RTC driver"); | 304 | MODULE_DESCRIPTION("Maxim MAX8925 RTC driver"); |
315 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | 305 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index 2e48aa604273..7196f438c089 100644 --- a/drivers/rtc/rtc-max8998.c +++ b/drivers/rtc/rtc-max8998.c | |||
@@ -327,17 +327,7 @@ static struct platform_driver max8998_rtc_driver = { | |||
327 | .id_table = max8998_rtc_id, | 327 | .id_table = max8998_rtc_id, |
328 | }; | 328 | }; |
329 | 329 | ||
330 | static int __init max8998_rtc_init(void) | 330 | module_platform_driver(max8998_rtc_driver); |
331 | { | ||
332 | return platform_driver_register(&max8998_rtc_driver); | ||
333 | } | ||
334 | module_init(max8998_rtc_init); | ||
335 | |||
336 | static void __exit max8998_rtc_exit(void) | ||
337 | { | ||
338 | platform_driver_unregister(&max8998_rtc_driver); | ||
339 | } | ||
340 | module_exit(max8998_rtc_exit); | ||
341 | 331 | ||
342 | MODULE_AUTHOR("Minkyu Kang <mk7.kang@samsung.com>"); | 332 | MODULE_AUTHOR("Minkyu Kang <mk7.kang@samsung.com>"); |
343 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); | 333 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); |
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c index 9d0c3b478d55..546f6850bffb 100644 --- a/drivers/rtc/rtc-mc13xxx.c +++ b/drivers/rtc/rtc-mc13xxx.c | |||
@@ -399,7 +399,7 @@ static int __exit mc13xxx_rtc_remove(struct platform_device *pdev) | |||
399 | return 0; | 399 | return 0; |
400 | } | 400 | } |
401 | 401 | ||
402 | const struct platform_device_id mc13xxx_rtc_idtable[] = { | 402 | static const struct platform_device_id mc13xxx_rtc_idtable[] = { |
403 | { | 403 | { |
404 | .name = "mc13783-rtc", | 404 | .name = "mc13783-rtc", |
405 | }, { | 405 | }, { |
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index da60915818b6..9d3caccfc250 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
@@ -418,17 +418,7 @@ static struct platform_driver mpc5121_rtc_driver = { | |||
418 | .remove = __devexit_p(mpc5121_rtc_remove), | 418 | .remove = __devexit_p(mpc5121_rtc_remove), |
419 | }; | 419 | }; |
420 | 420 | ||
421 | static int __init mpc5121_rtc_init(void) | 421 | module_platform_driver(mpc5121_rtc_driver); |
422 | { | ||
423 | return platform_driver_register(&mpc5121_rtc_driver); | ||
424 | } | ||
425 | module_init(mpc5121_rtc_init); | ||
426 | |||
427 | static void __exit mpc5121_rtc_exit(void) | ||
428 | { | ||
429 | platform_driver_unregister(&mpc5121_rtc_driver); | ||
430 | } | ||
431 | module_exit(mpc5121_rtc_exit); | ||
432 | 422 | ||
433 | MODULE_LICENSE("GPL"); | 423 | MODULE_LICENSE("GPL"); |
434 | MODULE_AUTHOR("John Rigby <jcrigby@gmail.com>"); | 424 | MODULE_AUTHOR("John Rigby <jcrigby@gmail.com>"); |
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index bb21f443fb70..6cd6c7235344 100644 --- a/drivers/rtc/rtc-mrst.c +++ b/drivers/rtc/rtc-mrst.c | |||
@@ -537,18 +537,7 @@ static struct platform_driver vrtc_mrst_platform_driver = { | |||
537 | } | 537 | } |
538 | }; | 538 | }; |
539 | 539 | ||
540 | static int __init vrtc_mrst_init(void) | 540 | module_platform_driver(vrtc_mrst_platform_driver); |
541 | { | ||
542 | return platform_driver_register(&vrtc_mrst_platform_driver); | ||
543 | } | ||
544 | |||
545 | static void __exit vrtc_mrst_exit(void) | ||
546 | { | ||
547 | platform_driver_unregister(&vrtc_mrst_platform_driver); | ||
548 | } | ||
549 | |||
550 | module_init(vrtc_mrst_init); | ||
551 | module_exit(vrtc_mrst_exit); | ||
552 | 541 | ||
553 | MODULE_AUTHOR("Jacob Pan; Feng Tang"); | 542 | MODULE_AUTHOR("Jacob Pan; Feng Tang"); |
554 | MODULE_DESCRIPTION("Driver for Moorestown virtual RTC"); | 543 | MODULE_DESCRIPTION("Driver for Moorestown virtual RTC"); |
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 39e41fbdf08b..5e1d64ee5228 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c | |||
@@ -155,7 +155,6 @@ static int rtc_update_alarm(struct device *dev, struct rtc_time *alrm) | |||
155 | { | 155 | { |
156 | struct rtc_time alarm_tm, now_tm; | 156 | struct rtc_time alarm_tm, now_tm; |
157 | unsigned long now, time; | 157 | unsigned long now, time; |
158 | int ret; | ||
159 | struct platform_device *pdev = to_platform_device(dev); | 158 | struct platform_device *pdev = to_platform_device(dev); |
160 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 159 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
161 | void __iomem *ioaddr = pdata->ioaddr; | 160 | void __iomem *ioaddr = pdata->ioaddr; |
@@ -168,21 +167,33 @@ static int rtc_update_alarm(struct device *dev, struct rtc_time *alrm) | |||
168 | alarm_tm.tm_hour = alrm->tm_hour; | 167 | alarm_tm.tm_hour = alrm->tm_hour; |
169 | alarm_tm.tm_min = alrm->tm_min; | 168 | alarm_tm.tm_min = alrm->tm_min; |
170 | alarm_tm.tm_sec = alrm->tm_sec; | 169 | alarm_tm.tm_sec = alrm->tm_sec; |
171 | rtc_tm_to_time(&now_tm, &now); | ||
172 | rtc_tm_to_time(&alarm_tm, &time); | 170 | rtc_tm_to_time(&alarm_tm, &time); |
173 | 171 | ||
174 | if (time < now) { | ||
175 | time += 60 * 60 * 24; | ||
176 | rtc_time_to_tm(time, &alarm_tm); | ||
177 | } | ||
178 | |||
179 | ret = rtc_tm_to_time(&alarm_tm, &time); | ||
180 | |||
181 | /* clear all the interrupt status bits */ | 172 | /* clear all the interrupt status bits */ |
182 | writew(readw(ioaddr + RTC_RTCISR), ioaddr + RTC_RTCISR); | 173 | writew(readw(ioaddr + RTC_RTCISR), ioaddr + RTC_RTCISR); |
183 | set_alarm_or_time(dev, MXC_RTC_ALARM, time); | 174 | set_alarm_or_time(dev, MXC_RTC_ALARM, time); |
184 | 175 | ||
185 | return ret; | 176 | return 0; |
177 | } | ||
178 | |||
179 | static void mxc_rtc_irq_enable(struct device *dev, unsigned int bit, | ||
180 | unsigned int enabled) | ||
181 | { | ||
182 | struct platform_device *pdev = to_platform_device(dev); | ||
183 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | ||
184 | void __iomem *ioaddr = pdata->ioaddr; | ||
185 | u32 reg; | ||
186 | |||
187 | spin_lock_irq(&pdata->rtc->irq_lock); | ||
188 | reg = readw(ioaddr + RTC_RTCIENR); | ||
189 | |||
190 | if (enabled) | ||
191 | reg |= bit; | ||
192 | else | ||
193 | reg &= ~bit; | ||
194 | |||
195 | writew(reg, ioaddr + RTC_RTCIENR); | ||
196 | spin_unlock_irq(&pdata->rtc->irq_lock); | ||
186 | } | 197 | } |
187 | 198 | ||
188 | /* This function is the RTC interrupt service routine. */ | 199 | /* This function is the RTC interrupt service routine. */ |
@@ -199,13 +210,12 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
199 | /* clear interrupt sources */ | 210 | /* clear interrupt sources */ |
200 | writew(status, ioaddr + RTC_RTCISR); | 211 | writew(status, ioaddr + RTC_RTCISR); |
201 | 212 | ||
202 | /* clear alarm interrupt if it has occurred */ | ||
203 | if (status & RTC_ALM_BIT) | ||
204 | status &= ~RTC_ALM_BIT; | ||
205 | |||
206 | /* update irq data & counter */ | 213 | /* update irq data & counter */ |
207 | if (status & RTC_ALM_BIT) | 214 | if (status & RTC_ALM_BIT) { |
208 | events |= (RTC_AF | RTC_IRQF); | 215 | events |= (RTC_AF | RTC_IRQF); |
216 | /* RTC alarm should be one-shot */ | ||
217 | mxc_rtc_irq_enable(&pdev->dev, RTC_ALM_BIT, 0); | ||
218 | } | ||
209 | 219 | ||
210 | if (status & RTC_1HZ_BIT) | 220 | if (status & RTC_1HZ_BIT) |
211 | events |= (RTC_UF | RTC_IRQF); | 221 | events |= (RTC_UF | RTC_IRQF); |
@@ -213,9 +223,6 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
213 | if (status & PIT_ALL_ON) | 223 | if (status & PIT_ALL_ON) |
214 | events |= (RTC_PF | RTC_IRQF); | 224 | events |= (RTC_PF | RTC_IRQF); |
215 | 225 | ||
216 | if ((status & RTC_ALM_BIT) && rtc_valid_tm(&pdata->g_rtc_alarm)) | ||
217 | rtc_update_alarm(&pdev->dev, &pdata->g_rtc_alarm); | ||
218 | |||
219 | rtc_update_irq(pdata->rtc, 1, events); | 226 | rtc_update_irq(pdata->rtc, 1, events); |
220 | spin_unlock_irq(&pdata->rtc->irq_lock); | 227 | spin_unlock_irq(&pdata->rtc->irq_lock); |
221 | 228 | ||
@@ -242,26 +249,6 @@ static void mxc_rtc_release(struct device *dev) | |||
242 | spin_unlock_irq(&pdata->rtc->irq_lock); | 249 | spin_unlock_irq(&pdata->rtc->irq_lock); |
243 | } | 250 | } |
244 | 251 | ||
245 | static void mxc_rtc_irq_enable(struct device *dev, unsigned int bit, | ||
246 | unsigned int enabled) | ||
247 | { | ||
248 | struct platform_device *pdev = to_platform_device(dev); | ||
249 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | ||
250 | void __iomem *ioaddr = pdata->ioaddr; | ||
251 | u32 reg; | ||
252 | |||
253 | spin_lock_irq(&pdata->rtc->irq_lock); | ||
254 | reg = readw(ioaddr + RTC_RTCIENR); | ||
255 | |||
256 | if (enabled) | ||
257 | reg |= bit; | ||
258 | else | ||
259 | reg &= ~bit; | ||
260 | |||
261 | writew(reg, ioaddr + RTC_RTCIENR); | ||
262 | spin_unlock_irq(&pdata->rtc->irq_lock); | ||
263 | } | ||
264 | |||
265 | static int mxc_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | 252 | static int mxc_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
266 | { | 253 | { |
267 | mxc_rtc_irq_enable(dev, RTC_ALM_BIT, enabled); | 254 | mxc_rtc_irq_enable(dev, RTC_ALM_BIT, enabled); |
@@ -290,6 +277,17 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
290 | */ | 277 | */ |
291 | static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) | 278 | static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) |
292 | { | 279 | { |
280 | /* | ||
281 | * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only | ||
282 | */ | ||
283 | if (cpu_is_mx1()) { | ||
284 | struct rtc_time tm; | ||
285 | |||
286 | rtc_time_to_tm(time, &tm); | ||
287 | tm.tm_year = 70; | ||
288 | rtc_tm_to_time(&tm, &time); | ||
289 | } | ||
290 | |||
293 | /* Avoid roll-over from reading the different registers */ | 291 | /* Avoid roll-over from reading the different registers */ |
294 | do { | 292 | do { |
295 | set_alarm_or_time(dev, MXC_RTC_TIME, time); | 293 | set_alarm_or_time(dev, MXC_RTC_TIME, time); |
@@ -324,21 +322,7 @@ static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
324 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 322 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
325 | int ret; | 323 | int ret; |
326 | 324 | ||
327 | if (rtc_valid_tm(&alrm->time)) { | 325 | ret = rtc_update_alarm(dev, &alrm->time); |
328 | if (alrm->time.tm_sec > 59 || | ||
329 | alrm->time.tm_hour > 23 || | ||
330 | alrm->time.tm_min > 59) | ||
331 | return -EINVAL; | ||
332 | |||
333 | ret = rtc_update_alarm(dev, &alrm->time); | ||
334 | } else { | ||
335 | ret = rtc_valid_tm(&alrm->time); | ||
336 | if (ret) | ||
337 | return ret; | ||
338 | |||
339 | ret = rtc_update_alarm(dev, &alrm->time); | ||
340 | } | ||
341 | |||
342 | if (ret) | 326 | if (ret) |
343 | return ret; | 327 | return ret; |
344 | 328 | ||
@@ -424,6 +408,9 @@ static int __init mxc_rtc_probe(struct platform_device *pdev) | |||
424 | pdata->irq = -1; | 408 | pdata->irq = -1; |
425 | } | 409 | } |
426 | 410 | ||
411 | if (pdata->irq >=0) | ||
412 | device_init_wakeup(&pdev->dev, 1); | ||
413 | |||
427 | rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops, | 414 | rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops, |
428 | THIS_MODULE); | 415 | THIS_MODULE); |
429 | if (IS_ERR(rtc)) { | 416 | if (IS_ERR(rtc)) { |
@@ -459,9 +446,39 @@ static int __exit mxc_rtc_remove(struct platform_device *pdev) | |||
459 | return 0; | 446 | return 0; |
460 | } | 447 | } |
461 | 448 | ||
449 | #ifdef CONFIG_PM | ||
450 | static int mxc_rtc_suspend(struct device *dev) | ||
451 | { | ||
452 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); | ||
453 | |||
454 | if (device_may_wakeup(dev)) | ||
455 | enable_irq_wake(pdata->irq); | ||
456 | |||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | static int mxc_rtc_resume(struct device *dev) | ||
461 | { | ||
462 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); | ||
463 | |||
464 | if (device_may_wakeup(dev)) | ||
465 | disable_irq_wake(pdata->irq); | ||
466 | |||
467 | return 0; | ||
468 | } | ||
469 | |||
470 | static struct dev_pm_ops mxc_rtc_pm_ops = { | ||
471 | .suspend = mxc_rtc_suspend, | ||
472 | .resume = mxc_rtc_resume, | ||
473 | }; | ||
474 | #endif | ||
475 | |||
462 | static struct platform_driver mxc_rtc_driver = { | 476 | static struct platform_driver mxc_rtc_driver = { |
463 | .driver = { | 477 | .driver = { |
464 | .name = "mxc_rtc", | 478 | .name = "mxc_rtc", |
479 | #ifdef CONFIG_PM | ||
480 | .pm = &mxc_rtc_pm_ops, | ||
481 | #endif | ||
465 | .owner = THIS_MODULE, | 482 | .owner = THIS_MODULE, |
466 | }, | 483 | }, |
467 | .remove = __exit_p(mxc_rtc_remove), | 484 | .remove = __exit_p(mxc_rtc_remove), |
diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c index 2ee3bbf7e5ea..b46c4004d8fe 100644 --- a/drivers/rtc/rtc-pcf2123.c +++ b/drivers/rtc/rtc-pcf2123.c | |||
@@ -340,7 +340,6 @@ static int __devexit pcf2123_remove(struct spi_device *spi) | |||
340 | static struct spi_driver pcf2123_driver = { | 340 | static struct spi_driver pcf2123_driver = { |
341 | .driver = { | 341 | .driver = { |
342 | .name = "rtc-pcf2123", | 342 | .name = "rtc-pcf2123", |
343 | .bus = &spi_bus_type, | ||
344 | .owner = THIS_MODULE, | 343 | .owner = THIS_MODULE, |
345 | }, | 344 | }, |
346 | .probe = pcf2123_probe, | 345 | .probe = pcf2123_probe, |
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c index 0c423892923c..a20202f9ee57 100644 --- a/drivers/rtc/rtc-pcf50633.c +++ b/drivers/rtc/rtc-pcf50633.c | |||
@@ -294,17 +294,7 @@ static struct platform_driver pcf50633_rtc_driver = { | |||
294 | .remove = __devexit_p(pcf50633_rtc_remove), | 294 | .remove = __devexit_p(pcf50633_rtc_remove), |
295 | }; | 295 | }; |
296 | 296 | ||
297 | static int __init pcf50633_rtc_init(void) | 297 | module_platform_driver(pcf50633_rtc_driver); |
298 | { | ||
299 | return platform_driver_register(&pcf50633_rtc_driver); | ||
300 | } | ||
301 | module_init(pcf50633_rtc_init); | ||
302 | |||
303 | static void __exit pcf50633_rtc_exit(void) | ||
304 | { | ||
305 | platform_driver_unregister(&pcf50633_rtc_driver); | ||
306 | } | ||
307 | module_exit(pcf50633_rtc_exit); | ||
308 | 298 | ||
309 | MODULE_DESCRIPTION("PCF50633 RTC driver"); | 299 | MODULE_DESCRIPTION("PCF50633 RTC driver"); |
310 | MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>"); | 300 | MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>"); |
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index d420e9d877e8..9f1d6bcbdf6c 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c | |||
@@ -532,17 +532,7 @@ static struct platform_driver pm8xxx_rtc_driver = { | |||
532 | }, | 532 | }, |
533 | }; | 533 | }; |
534 | 534 | ||
535 | static int __init pm8xxx_rtc_init(void) | 535 | module_platform_driver(pm8xxx_rtc_driver); |
536 | { | ||
537 | return platform_driver_register(&pm8xxx_rtc_driver); | ||
538 | } | ||
539 | module_init(pm8xxx_rtc_init); | ||
540 | |||
541 | static void __exit pm8xxx_rtc_exit(void) | ||
542 | { | ||
543 | platform_driver_unregister(&pm8xxx_rtc_driver); | ||
544 | } | ||
545 | module_exit(pm8xxx_rtc_exit); | ||
546 | 536 | ||
547 | MODULE_ALIAS("platform:rtc-pm8xxx"); | 537 | MODULE_ALIAS("platform:rtc-pm8xxx"); |
548 | MODULE_DESCRIPTION("PMIC8xxx RTC driver"); | 538 | MODULE_DESCRIPTION("PMIC8xxx RTC driver"); |
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c index 971bc8e08da6..ce2ca8523ddd 100644 --- a/drivers/rtc/rtc-rs5c348.c +++ b/drivers/rtc/rtc-rs5c348.c | |||
@@ -229,7 +229,6 @@ static int __devexit rs5c348_remove(struct spi_device *spi) | |||
229 | static struct spi_driver rs5c348_driver = { | 229 | static struct spi_driver rs5c348_driver = { |
230 | .driver = { | 230 | .driver = { |
231 | .name = "rtc-rs5c348", | 231 | .name = "rtc-rs5c348", |
232 | .bus = &spi_bus_type, | ||
233 | .owner = THIS_MODULE, | 232 | .owner = THIS_MODULE, |
234 | }, | 233 | }, |
235 | .probe = rs5c348_probe, | 234 | .probe = rs5c348_probe, |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 175067a17c46..aef40bd2957b 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -673,21 +673,7 @@ static struct platform_driver s3c_rtc_driver = { | |||
673 | }, | 673 | }, |
674 | }; | 674 | }; |
675 | 675 | ||
676 | static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics\n"; | 676 | module_platform_driver(s3c_rtc_driver); |
677 | |||
678 | static int __init s3c_rtc_init(void) | ||
679 | { | ||
680 | printk(banner); | ||
681 | return platform_driver_register(&s3c_rtc_driver); | ||
682 | } | ||
683 | |||
684 | static void __exit s3c_rtc_exit(void) | ||
685 | { | ||
686 | platform_driver_unregister(&s3c_rtc_driver); | ||
687 | } | ||
688 | |||
689 | module_init(s3c_rtc_init); | ||
690 | module_exit(s3c_rtc_exit); | ||
691 | 677 | ||
692 | MODULE_DESCRIPTION("Samsung S3C RTC Driver"); | 678 | MODULE_DESCRIPTION("Samsung S3C RTC Driver"); |
693 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | 679 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index fc1ffe97fca1..4595d3e645a7 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -435,18 +435,7 @@ static struct platform_driver sa1100_rtc_driver = { | |||
435 | }, | 435 | }, |
436 | }; | 436 | }; |
437 | 437 | ||
438 | static int __init sa1100_rtc_init(void) | 438 | module_platform_driver(sa1100_rtc_driver); |
439 | { | ||
440 | return platform_driver_register(&sa1100_rtc_driver); | ||
441 | } | ||
442 | |||
443 | static void __exit sa1100_rtc_exit(void) | ||
444 | { | ||
445 | platform_driver_unregister(&sa1100_rtc_driver); | ||
446 | } | ||
447 | |||
448 | module_init(sa1100_rtc_init); | ||
449 | module_exit(sa1100_rtc_exit); | ||
450 | 439 | ||
451 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); | 440 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); |
452 | MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)"); | 441 | MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)"); |
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index 893bac2bb21b..19a28a671a8e 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c | |||
@@ -516,17 +516,7 @@ static struct platform_driver spear_rtc_driver = { | |||
516 | }, | 516 | }, |
517 | }; | 517 | }; |
518 | 518 | ||
519 | static int __init rtc_init(void) | 519 | module_platform_driver(spear_rtc_driver); |
520 | { | ||
521 | return platform_driver_register(&spear_rtc_driver); | ||
522 | } | ||
523 | module_init(rtc_init); | ||
524 | |||
525 | static void __exit rtc_exit(void) | ||
526 | { | ||
527 | platform_driver_unregister(&spear_rtc_driver); | ||
528 | } | ||
529 | module_exit(rtc_exit); | ||
530 | 520 | ||
531 | MODULE_ALIAS("platform:rtc-spear"); | 521 | MODULE_ALIAS("platform:rtc-spear"); |
532 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 522 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); |
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index ed3e9b599031..7621116bd20d 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c | |||
@@ -370,18 +370,7 @@ static struct platform_driver stk17ta8_rtc_driver = { | |||
370 | }, | 370 | }, |
371 | }; | 371 | }; |
372 | 372 | ||
373 | static __init int stk17ta8_init(void) | 373 | module_platform_driver(stk17ta8_rtc_driver); |
374 | { | ||
375 | return platform_driver_register(&stk17ta8_rtc_driver); | ||
376 | } | ||
377 | |||
378 | static __exit void stk17ta8_exit(void) | ||
379 | { | ||
380 | platform_driver_unregister(&stk17ta8_rtc_driver); | ||
381 | } | ||
382 | |||
383 | module_init(stk17ta8_init); | ||
384 | module_exit(stk17ta8_exit); | ||
385 | 374 | ||
386 | MODULE_AUTHOR("Thomas Hommel <thomas.hommel@ge.com>"); | 375 | MODULE_AUTHOR("Thomas Hommel <thomas.hommel@ge.com>"); |
387 | MODULE_DESCRIPTION("Simtek STK17TA8 RTC driver"); | 376 | MODULE_DESCRIPTION("Simtek STK17TA8 RTC driver"); |
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c index 7315068daa59..10287865e330 100644 --- a/drivers/rtc/rtc-stmp3xxx.c +++ b/drivers/rtc/rtc-stmp3xxx.c | |||
@@ -276,18 +276,7 @@ static struct platform_driver stmp3xxx_rtcdrv = { | |||
276 | }, | 276 | }, |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static int __init stmp3xxx_rtc_init(void) | 279 | module_platform_driver(stmp3xxx_rtcdrv); |
280 | { | ||
281 | return platform_driver_register(&stmp3xxx_rtcdrv); | ||
282 | } | ||
283 | |||
284 | static void __exit stmp3xxx_rtc_exit(void) | ||
285 | { | ||
286 | platform_driver_unregister(&stmp3xxx_rtcdrv); | ||
287 | } | ||
288 | |||
289 | module_init(stmp3xxx_rtc_init); | ||
290 | module_exit(stmp3xxx_rtc_exit); | ||
291 | 280 | ||
292 | MODULE_DESCRIPTION("STMP3xxx RTC Driver"); | 281 | MODULE_DESCRIPTION("STMP3xxx RTC Driver"); |
293 | MODULE_AUTHOR("dmitry pervushin <dpervushin@embeddedalley.com> and " | 282 | MODULE_AUTHOR("dmitry pervushin <dpervushin@embeddedalley.com> and " |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 20687d55e7a7..d43b4f6eb4e4 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -550,6 +550,11 @@ static int twl_rtc_resume(struct platform_device *pdev) | |||
550 | #define twl_rtc_resume NULL | 550 | #define twl_rtc_resume NULL |
551 | #endif | 551 | #endif |
552 | 552 | ||
553 | static const struct of_device_id twl_rtc_of_match[] = { | ||
554 | {.compatible = "ti,twl4030-rtc", }, | ||
555 | { }, | ||
556 | }; | ||
557 | MODULE_DEVICE_TABLE(of, twl_rtc_of_match); | ||
553 | MODULE_ALIAS("platform:twl_rtc"); | 558 | MODULE_ALIAS("platform:twl_rtc"); |
554 | 559 | ||
555 | static struct platform_driver twl4030rtc_driver = { | 560 | static struct platform_driver twl4030rtc_driver = { |
@@ -559,8 +564,9 @@ static struct platform_driver twl4030rtc_driver = { | |||
559 | .suspend = twl_rtc_suspend, | 564 | .suspend = twl_rtc_suspend, |
560 | .resume = twl_rtc_resume, | 565 | .resume = twl_rtc_resume, |
561 | .driver = { | 566 | .driver = { |
562 | .owner = THIS_MODULE, | 567 | .owner = THIS_MODULE, |
563 | .name = "twl_rtc", | 568 | .name = "twl_rtc", |
569 | .of_match_table = twl_rtc_of_match, | ||
564 | }, | 570 | }, |
565 | }; | 571 | }; |
566 | 572 | ||
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c index f71c3ce18036..bca5d677bc85 100644 --- a/drivers/rtc/rtc-v3020.c +++ b/drivers/rtc/rtc-v3020.c | |||
@@ -393,18 +393,7 @@ static struct platform_driver rtc_device_driver = { | |||
393 | }, | 393 | }, |
394 | }; | 394 | }; |
395 | 395 | ||
396 | static __init int v3020_init(void) | 396 | module_platform_driver(rtc_device_driver); |
397 | { | ||
398 | return platform_driver_register(&rtc_device_driver); | ||
399 | } | ||
400 | |||
401 | static __exit void v3020_exit(void) | ||
402 | { | ||
403 | platform_driver_unregister(&rtc_device_driver); | ||
404 | } | ||
405 | |||
406 | module_init(v3020_init); | ||
407 | module_exit(v3020_exit); | ||
408 | 397 | ||
409 | MODULE_DESCRIPTION("V3020 RTC"); | 398 | MODULE_DESCRIPTION("V3020 RTC"); |
410 | MODULE_AUTHOR("Raphael Assenat"); | 399 | MODULE_AUTHOR("Raphael Assenat"); |
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index c5698cda366a..fcbfdda2993b 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
@@ -405,15 +405,4 @@ static struct platform_driver rtc_platform_driver = { | |||
405 | }, | 405 | }, |
406 | }; | 406 | }; |
407 | 407 | ||
408 | static int __init vr41xx_rtc_init(void) | 408 | module_platform_driver(rtc_platform_driver); |
409 | { | ||
410 | return platform_driver_register(&rtc_platform_driver); | ||
411 | } | ||
412 | |||
413 | static void __exit vr41xx_rtc_exit(void) | ||
414 | { | ||
415 | platform_driver_unregister(&rtc_platform_driver); | ||
416 | } | ||
417 | |||
418 | module_init(vr41xx_rtc_init); | ||
419 | module_exit(vr41xx_rtc_exit); | ||
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index f93f412423c6..9e94fb147c26 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c | |||
@@ -311,17 +311,7 @@ static struct platform_driver vt8500_rtc_driver = { | |||
311 | }, | 311 | }, |
312 | }; | 312 | }; |
313 | 313 | ||
314 | static int __init vt8500_rtc_init(void) | 314 | module_platform_driver(vt8500_rtc_driver); |
315 | { | ||
316 | return platform_driver_register(&vt8500_rtc_driver); | ||
317 | } | ||
318 | module_init(vt8500_rtc_init); | ||
319 | |||
320 | static void __exit vt8500_rtc_exit(void) | ||
321 | { | ||
322 | platform_driver_unregister(&vt8500_rtc_driver); | ||
323 | } | ||
324 | module_exit(vt8500_rtc_exit); | ||
325 | 315 | ||
326 | MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>"); | 316 | MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>"); |
327 | MODULE_DESCRIPTION("VIA VT8500 SoC Realtime Clock Driver (RTC)"); | 317 | MODULE_DESCRIPTION("VIA VT8500 SoC Realtime Clock Driver (RTC)"); |
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c index bdc909bd56da..3b6e6a67e765 100644 --- a/drivers/rtc/rtc-wm831x.c +++ b/drivers/rtc/rtc-wm831x.c | |||
@@ -324,15 +324,6 @@ static irqreturn_t wm831x_alm_irq(int irq, void *data) | |||
324 | return IRQ_HANDLED; | 324 | return IRQ_HANDLED; |
325 | } | 325 | } |
326 | 326 | ||
327 | static irqreturn_t wm831x_per_irq(int irq, void *data) | ||
328 | { | ||
329 | struct wm831x_rtc *wm831x_rtc = data; | ||
330 | |||
331 | rtc_update_irq(wm831x_rtc->rtc, 1, RTC_IRQF | RTC_UF); | ||
332 | |||
333 | return IRQ_HANDLED; | ||
334 | } | ||
335 | |||
336 | static const struct rtc_class_ops wm831x_rtc_ops = { | 327 | static const struct rtc_class_ops wm831x_rtc_ops = { |
337 | .read_time = wm831x_rtc_readtime, | 328 | .read_time = wm831x_rtc_readtime, |
338 | .set_mmss = wm831x_rtc_set_mmss, | 329 | .set_mmss = wm831x_rtc_set_mmss, |
@@ -405,11 +396,10 @@ static int wm831x_rtc_probe(struct platform_device *pdev) | |||
405 | { | 396 | { |
406 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 397 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
407 | struct wm831x_rtc *wm831x_rtc; | 398 | struct wm831x_rtc *wm831x_rtc; |
408 | int per_irq = platform_get_irq_byname(pdev, "PER"); | ||
409 | int alm_irq = platform_get_irq_byname(pdev, "ALM"); | 399 | int alm_irq = platform_get_irq_byname(pdev, "ALM"); |
410 | int ret = 0; | 400 | int ret = 0; |
411 | 401 | ||
412 | wm831x_rtc = kzalloc(sizeof(*wm831x_rtc), GFP_KERNEL); | 402 | wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL); |
413 | if (wm831x_rtc == NULL) | 403 | if (wm831x_rtc == NULL) |
414 | return -ENOMEM; | 404 | return -ENOMEM; |
415 | 405 | ||
@@ -433,14 +423,6 @@ static int wm831x_rtc_probe(struct platform_device *pdev) | |||
433 | goto err; | 423 | goto err; |
434 | } | 424 | } |
435 | 425 | ||
436 | ret = request_threaded_irq(per_irq, NULL, wm831x_per_irq, | ||
437 | IRQF_TRIGGER_RISING, "RTC period", | ||
438 | wm831x_rtc); | ||
439 | if (ret != 0) { | ||
440 | dev_err(&pdev->dev, "Failed to request periodic IRQ %d: %d\n", | ||
441 | per_irq, ret); | ||
442 | } | ||
443 | |||
444 | ret = request_threaded_irq(alm_irq, NULL, wm831x_alm_irq, | 426 | ret = request_threaded_irq(alm_irq, NULL, wm831x_alm_irq, |
445 | IRQF_TRIGGER_RISING, "RTC alarm", | 427 | IRQF_TRIGGER_RISING, "RTC alarm", |
446 | wm831x_rtc); | 428 | wm831x_rtc); |
@@ -452,20 +434,16 @@ static int wm831x_rtc_probe(struct platform_device *pdev) | |||
452 | return 0; | 434 | return 0; |
453 | 435 | ||
454 | err: | 436 | err: |
455 | kfree(wm831x_rtc); | ||
456 | return ret; | 437 | return ret; |
457 | } | 438 | } |
458 | 439 | ||
459 | static int __devexit wm831x_rtc_remove(struct platform_device *pdev) | 440 | static int __devexit wm831x_rtc_remove(struct platform_device *pdev) |
460 | { | 441 | { |
461 | struct wm831x_rtc *wm831x_rtc = platform_get_drvdata(pdev); | 442 | struct wm831x_rtc *wm831x_rtc = platform_get_drvdata(pdev); |
462 | int per_irq = platform_get_irq_byname(pdev, "PER"); | ||
463 | int alm_irq = platform_get_irq_byname(pdev, "ALM"); | 443 | int alm_irq = platform_get_irq_byname(pdev, "ALM"); |
464 | 444 | ||
465 | free_irq(alm_irq, wm831x_rtc); | 445 | free_irq(alm_irq, wm831x_rtc); |
466 | free_irq(per_irq, wm831x_rtc); | ||
467 | rtc_device_unregister(wm831x_rtc->rtc); | 446 | rtc_device_unregister(wm831x_rtc->rtc); |
468 | kfree(wm831x_rtc); | ||
469 | 447 | ||
470 | return 0; | 448 | return 0; |
471 | } | 449 | } |
@@ -490,17 +468,7 @@ static struct platform_driver wm831x_rtc_driver = { | |||
490 | }, | 468 | }, |
491 | }; | 469 | }; |
492 | 470 | ||
493 | static int __init wm831x_rtc_init(void) | 471 | module_platform_driver(wm831x_rtc_driver); |
494 | { | ||
495 | return platform_driver_register(&wm831x_rtc_driver); | ||
496 | } | ||
497 | module_init(wm831x_rtc_init); | ||
498 | |||
499 | static void __exit wm831x_rtc_exit(void) | ||
500 | { | ||
501 | platform_driver_unregister(&wm831x_rtc_driver); | ||
502 | } | ||
503 | module_exit(wm831x_rtc_exit); | ||
504 | 472 | ||
505 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 473 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
506 | MODULE_DESCRIPTION("RTC driver for the WM831x series PMICs"); | 474 | MODULE_DESCRIPTION("RTC driver for the WM831x series PMICs"); |
diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c index 66421426e404..c2e52d15abb2 100644 --- a/drivers/rtc/rtc-wm8350.c +++ b/drivers/rtc/rtc-wm8350.c | |||
@@ -486,17 +486,7 @@ static struct platform_driver wm8350_rtc_driver = { | |||
486 | }, | 486 | }, |
487 | }; | 487 | }; |
488 | 488 | ||
489 | static int __init wm8350_rtc_init(void) | 489 | module_platform_driver(wm8350_rtc_driver); |
490 | { | ||
491 | return platform_driver_register(&wm8350_rtc_driver); | ||
492 | } | ||
493 | module_init(wm8350_rtc_init); | ||
494 | |||
495 | static void __exit wm8350_rtc_exit(void) | ||
496 | { | ||
497 | platform_driver_unregister(&wm8350_rtc_driver); | ||
498 | } | ||
499 | module_exit(wm8350_rtc_exit); | ||
500 | 490 | ||
501 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 491 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
502 | MODULE_DESCRIPTION("RTC driver for the WM8350"); | 492 | MODULE_DESCRIPTION("RTC driver for the WM8350"); |