aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1302.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-ds1302.c')
-rw-r--r--drivers/rtc/rtc-ds1302.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/rtc/rtc-ds1302.c b/drivers/rtc/rtc-ds1302.c
index fdbcdb289d60..d13954346286 100644
--- a/drivers/rtc/rtc-ds1302.c
+++ b/drivers/rtc/rtc-ds1302.c
@@ -224,7 +224,7 @@ static int __init ds1302_rtc_probe(struct platform_device *pdev)
224 return -ENODEV; 224 return -ENODEV;
225 } 225 }
226 226
227 rtc = rtc_device_register("ds1302", &pdev->dev, 227 rtc = devm_rtc_device_register(&pdev->dev, "ds1302",
228 &ds1302_rtc_ops, THIS_MODULE); 228 &ds1302_rtc_ops, THIS_MODULE);
229 if (IS_ERR(rtc)) 229 if (IS_ERR(rtc))
230 return PTR_ERR(rtc); 230 return PTR_ERR(rtc);
@@ -234,11 +234,8 @@ static int __init ds1302_rtc_probe(struct platform_device *pdev)
234 return 0; 234 return 0;
235} 235}
236 236
237static int ds1302_rtc_remove(struct platform_device *pdev) 237static int __exit ds1302_rtc_remove(struct platform_device *pdev)
238{ 238{
239 struct rtc_device *rtc = platform_get_drvdata(pdev);
240
241 rtc_device_unregister(rtc);
242 platform_set_drvdata(pdev, NULL); 239 platform_set_drvdata(pdev, NULL);
243 240
244 return 0; 241 return 0;
@@ -249,21 +246,10 @@ static struct platform_driver ds1302_platform_driver = {
249 .name = DRV_NAME, 246 .name = DRV_NAME,
250 .owner = THIS_MODULE, 247 .owner = THIS_MODULE,
251 }, 248 },
252 .remove = ds1302_rtc_remove, 249 .remove = __exit_p(ds1302_rtc_remove),
253}; 250};
254 251
255static int __init ds1302_rtc_init(void) 252module_platform_driver_probe(ds1302_platform_driver, ds1302_rtc_probe);
256{
257 return platform_driver_probe(&ds1302_platform_driver, ds1302_rtc_probe);
258}
259
260static void __exit ds1302_rtc_exit(void)
261{
262 platform_driver_unregister(&ds1302_platform_driver);
263}
264
265module_init(ds1302_rtc_init);
266module_exit(ds1302_rtc_exit);
267 253
268MODULE_DESCRIPTION("Dallas DS1302 RTC driver"); 254MODULE_DESCRIPTION("Dallas DS1302 RTC driver");
269MODULE_VERSION(DRV_VERSION); 255MODULE_VERSION(DRV_VERSION);