.. | .. |
---|
366 | 366 | |
---|
367 | 367 | static int rs5c313_rtc_probe(struct platform_device *pdev) |
---|
368 | 368 | { |
---|
369 | | - struct rtc_device *rtc = devm_rtc_device_register(&pdev->dev, "rs5c313", |
---|
370 | | - &rs5c313_rtc_ops, THIS_MODULE); |
---|
| 369 | + struct rtc_device *rtc; |
---|
371 | 370 | |
---|
372 | | - if (IS_ERR(rtc)) |
---|
373 | | - return PTR_ERR(rtc); |
---|
| 371 | + rs5c313_init_port(); |
---|
| 372 | + rs5c313_check_xstp_bit(); |
---|
374 | 373 | |
---|
375 | | - platform_set_drvdata(pdev, rtc); |
---|
| 374 | + rtc = devm_rtc_device_register(&pdev->dev, "rs5c313", &rs5c313_rtc_ops, |
---|
| 375 | + THIS_MODULE); |
---|
376 | 376 | |
---|
377 | | - return 0; |
---|
| 377 | + return PTR_ERR_OR_ZERO(rtc); |
---|
378 | 378 | } |
---|
379 | 379 | |
---|
380 | 380 | static struct platform_driver rs5c313_rtc_platform_driver = { |
---|
.. | .. |
---|
384 | 384 | .probe = rs5c313_rtc_probe, |
---|
385 | 385 | }; |
---|
386 | 386 | |
---|
387 | | -static int __init rs5c313_rtc_init(void) |
---|
388 | | -{ |
---|
389 | | - int err; |
---|
390 | | - |
---|
391 | | - err = platform_driver_register(&rs5c313_rtc_platform_driver); |
---|
392 | | - if (err) |
---|
393 | | - return err; |
---|
394 | | - |
---|
395 | | - rs5c313_init_port(); |
---|
396 | | - rs5c313_check_xstp_bit(); |
---|
397 | | - |
---|
398 | | - return 0; |
---|
399 | | -} |
---|
400 | | - |
---|
401 | | -static void __exit rs5c313_rtc_exit(void) |
---|
402 | | -{ |
---|
403 | | - platform_driver_unregister(&rs5c313_rtc_platform_driver); |
---|
404 | | -} |
---|
405 | | - |
---|
406 | | -module_init(rs5c313_rtc_init); |
---|
407 | | -module_exit(rs5c313_rtc_exit); |
---|
| 387 | +module_platform_driver(rs5c313_rtc_platform_driver); |
---|
408 | 388 | |
---|
409 | 389 | MODULE_AUTHOR("kogiidena , Nobuhiro Iwamatsu <iwamatsu@nigauri.org>"); |
---|
410 | 390 | MODULE_DESCRIPTION("Ricoh RS5C313 RTC device driver"); |
---|