diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-04-29 19:19:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:31 -0400 |
commit | dd8d8137f54d852dc68bbf31c563ec6396541672 (patch) | |
tree | 422d8ddff03ce81359fb281348e187b26ef2e509 /drivers/rtc/rtc-test.c | |
parent | cc40d642f8f0cd036a105ac0237138fd1812a94f (diff) |
rtc: rtc-test: use devm_rtc_device_register()
devm_rtc_device_register() is device managed and makes cleanup paths
simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-test.c')
-rw-r--r-- | drivers/rtc/rtc-test.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index b92e0f6383e6..7746e65b93f2 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
@@ -99,8 +99,10 @@ static DEVICE_ATTR(irq, S_IRUGO | S_IWUSR, test_irq_show, test_irq_store); | |||
99 | static int test_probe(struct platform_device *plat_dev) | 99 | static int test_probe(struct platform_device *plat_dev) |
100 | { | 100 | { |
101 | int err; | 101 | int err; |
102 | struct rtc_device *rtc = rtc_device_register("test", &plat_dev->dev, | 102 | struct rtc_device *rtc; |
103 | &test_rtc_ops, THIS_MODULE); | 103 | |
104 | rtc = devm_rtc_device_register(&plat_dev->dev, "test", | ||
105 | &test_rtc_ops, THIS_MODULE); | ||
104 | if (IS_ERR(rtc)) { | 106 | if (IS_ERR(rtc)) { |
105 | err = PTR_ERR(rtc); | 107 | err = PTR_ERR(rtc); |
106 | return err; | 108 | return err; |
@@ -115,15 +117,11 @@ static int test_probe(struct platform_device *plat_dev) | |||
115 | return 0; | 117 | return 0; |
116 | 118 | ||
117 | err: | 119 | err: |
118 | rtc_device_unregister(rtc); | ||
119 | return err; | 120 | return err; |
120 | } | 121 | } |
121 | 122 | ||
122 | static int test_remove(struct platform_device *plat_dev) | 123 | static int test_remove(struct platform_device *plat_dev) |
123 | { | 124 | { |
124 | struct rtc_device *rtc = platform_get_drvdata(plat_dev); | ||
125 | |||
126 | rtc_device_unregister(rtc); | ||
127 | device_remove_file(&plat_dev->dev, &dev_attr_irq); | 125 | device_remove_file(&plat_dev->dev, &dev_attr_irq); |
128 | 126 | ||
129 | return 0; | 127 | return 0; |