Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] at91_rtc updates

Various bug fixes to the at91rm9200 RTC:

- alarm: setalarm() should pay attention to the "enabled" flag

- init: cleaner handling of the wakeup flags, which cpu init should
really have set up. Doing it here is just a workaround.

- linkage: since the at91_rtc driver probe() routine is in the init
section, it should use platform_driver_probe() instead of leaving
that pointer around in the driver struct after init section removal.

- linkage: likewise, remove() belongs in the exit section.

Among other things, the init and alarm changes ensure that this driver
handles the new sysfs "wakealarm" attribute properly.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Brownell and committed by
Linus Torvalds
5d4675a8 32b49da4

+13 -6
+13 -6
drivers/rtc/rtc-at91rm9200.c
··· 164 164 tm.tm_min = alrm->time.tm_min; 165 165 tm.tm_sec = alrm->time.tm_sec; 166 166 167 + at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); 167 168 at91_sys_write(AT91_RTC_TIMALR, 168 169 BIN2BCD(tm.tm_sec) << 0 169 170 | BIN2BCD(tm.tm_min) << 8 ··· 174 173 BIN2BCD(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ 175 174 | BIN2BCD(tm.tm_mday) << 24 176 175 | AT91_RTC_DATEEN | AT91_RTC_MTHEN); 176 + 177 + if (alrm->enabled) 178 + at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); 177 179 178 180 pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __FUNCTION__, 179 181 at91_alarm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, ··· 307 303 return ret; 308 304 } 309 305 306 + /* cpu init code should really have flagged this device as 307 + * being wake-capable; if it didn't, do that here. 308 + */ 309 + if (!device_can_wakeup(&pdev->dev)) 310 + device_init_wakeup(&pdev->dev, 1); 311 + 310 312 rtc = rtc_device_register(pdev->name, &pdev->dev, 311 313 &at91_rtc_ops, THIS_MODULE); 312 314 if (IS_ERR(rtc)) { ··· 320 310 return PTR_ERR(rtc); 321 311 } 322 312 platform_set_drvdata(pdev, rtc); 323 - device_init_wakeup(&pdev->dev, 1); 324 313 325 314 printk(KERN_INFO "AT91 Real Time Clock driver.\n"); 326 315 return 0; ··· 328 319 /* 329 320 * Disable and remove the RTC driver 330 321 */ 331 - static int __devexit at91_rtc_remove(struct platform_device *pdev) 322 + static int __exit at91_rtc_remove(struct platform_device *pdev) 332 323 { 333 324 struct rtc_device *rtc = platform_get_drvdata(pdev); 334 325 ··· 340 331 341 332 rtc_device_unregister(rtc); 342 333 platform_set_drvdata(pdev, NULL); 343 - device_init_wakeup(&pdev->dev, 0); 344 334 345 335 return 0; 346 336 } ··· 412 404 #endif 413 405 414 406 static struct platform_driver at91_rtc_driver = { 415 - .probe = at91_rtc_probe, 416 - .remove = at91_rtc_remove, 407 + .remove = __exit_p(at91_rtc_remove), 417 408 .suspend = at91_rtc_suspend, 418 409 .resume = at91_rtc_resume, 419 410 .driver = { ··· 423 416 424 417 static int __init at91_rtc_init(void) 425 418 { 426 - return platform_driver_register(&at91_rtc_driver); 419 + return platform_driver_probe(&at91_rtc_driver, at91_rtc_probe); 427 420 } 428 421 429 422 static void __exit at91_rtc_exit(void)