aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds2404.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 22:47:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 22:47:50 -0400
commit56847d857cb0c3ee78c22ce776a26f88d9ffd4d4 (patch)
treea85bcf204a53e45d26f6a3984f16ddd525eef3e7 /drivers/rtc/rtc-ds2404.c
parent191a712090bb8a10e6f129360eeed2d68f3d4c9a (diff)
parent8d564368a9a3197f43e56dadf4a18c5738849f94 (diff)
Merge branch 'akpm' (incoming from Andrew)
Merge second batch of fixes from Andrew Morton: - various misc bits - some printk updates - a new "SRAM" driver. - MAINTAINERS updates - the backlight driver queue - checkpatch updates - a few init/ changes - a huge number of drivers/rtc changes - fatfs updates - some lib/idr.c work - some renaming of the random driver interfaces * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (285 commits) net: rename random32 to prandom net/core: remove duplicate statements by do-while loop net/core: rename random32() to prandom_u32() net/netfilter: rename random32() to prandom_u32() net/sched: rename random32() to prandom_u32() net/sunrpc: rename random32() to prandom_u32() scsi: rename random32() to prandom_u32() lguest: rename random32() to prandom_u32() uwb: rename random32() to prandom_u32() video/uvesafb: rename random32() to prandom_u32() mmc: rename random32() to prandom_u32() drbd: rename random32() to prandom_u32() kernel/: rename random32() to prandom_u32() mm/: rename random32() to prandom_u32() lib/: rename random32() to prandom_u32() x86: rename random32() to prandom_u32() x86: pageattr-test: remove srandom32 call uuid: use prandom_bytes() raid6test: use prandom_bytes() sctp: convert sctp_assoc_set_id() to use idr_alloc_cyclic() ...
Diffstat (limited to 'drivers/rtc/rtc-ds2404.c')
-rw-r--r--drivers/rtc/rtc-ds2404.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/rtc/rtc-ds2404.c b/drivers/rtc/rtc-ds2404.c
index b04fc4272fb3..2ca5a23aba8a 100644
--- a/drivers/rtc/rtc-ds2404.c
+++ b/drivers/rtc/rtc-ds2404.c
@@ -228,7 +228,7 @@ static int rtc_probe(struct platform_device *pdev)
228 struct ds2404 *chip; 228 struct ds2404 *chip;
229 int retval = -EBUSY; 229 int retval = -EBUSY;
230 230
231 chip = kzalloc(sizeof(struct ds2404), GFP_KERNEL); 231 chip = devm_kzalloc(&pdev->dev, sizeof(struct ds2404), GFP_KERNEL);
232 if (!chip) 232 if (!chip)
233 return -ENOMEM; 233 return -ENOMEM;
234 234
@@ -244,8 +244,8 @@ static int rtc_probe(struct platform_device *pdev)
244 244
245 platform_set_drvdata(pdev, chip); 245 platform_set_drvdata(pdev, chip);
246 246
247 chip->rtc = rtc_device_register("ds2404", 247 chip->rtc = devm_rtc_device_register(&pdev->dev, "ds2404",
248 &pdev->dev, &ds2404_rtc_ops, THIS_MODULE); 248 &ds2404_rtc_ops, THIS_MODULE);
249 if (IS_ERR(chip->rtc)) { 249 if (IS_ERR(chip->rtc)) {
250 retval = PTR_ERR(chip->rtc); 250 retval = PTR_ERR(chip->rtc);
251 goto err_io; 251 goto err_io;
@@ -257,20 +257,14 @@ static int rtc_probe(struct platform_device *pdev)
257err_io: 257err_io:
258 chip->ops->unmap_io(chip); 258 chip->ops->unmap_io(chip);
259err_chip: 259err_chip:
260 kfree(chip);
261 return retval; 260 return retval;
262} 261}
263 262
264static int rtc_remove(struct platform_device *dev) 263static int rtc_remove(struct platform_device *dev)
265{ 264{
266 struct ds2404 *chip = platform_get_drvdata(dev); 265 struct ds2404 *chip = platform_get_drvdata(dev);
267 struct rtc_device *rtc = chip->rtc;
268
269 if (rtc)
270 rtc_device_unregister(rtc);
271 266
272 chip->ops->unmap_io(chip); 267 chip->ops->unmap_io(chip);
273 kfree(chip);
274 268
275 return 0; 269 return 0;
276} 270}