aboutsummaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-ds3232.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 19:47:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 19:47:50 -0700
commit56847d857cb0c3ee78c22ce776a26f88d9ffd4d4 (patch)
treea85bcf204a53e45d26f6a3984f16ddd525eef3e7 /drivers/rtc/rtc-ds3232.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-ds3232.c')
-rw-r--r--drivers/rtc/rtc-ds3232.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index db0ca08db31..b83bb5a527f 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -397,7 +397,7 @@ static int ds3232_probe(struct i2c_client *client,
struct ds3232 *ds3232;
int ret;
- ds3232 = kzalloc(sizeof(struct ds3232), GFP_KERNEL);
+ ds3232 = devm_kzalloc(&client->dev, sizeof(struct ds3232), GFP_KERNEL);
if (!ds3232)
return -ENOMEM;
@@ -409,34 +409,25 @@ static int ds3232_probe(struct i2c_client *client,
ret = ds3232_check_rtc_status(client);
if (ret)
- goto out_free;
+ return ret;
- ds3232->rtc = rtc_device_register(client->name, &client->dev,
+ ds3232->rtc = devm_rtc_device_register(&client->dev, client->name,
&ds3232_rtc_ops, THIS_MODULE);
if (IS_ERR(ds3232->rtc)) {
- ret = PTR_ERR(ds3232->rtc);
dev_err(&client->dev, "unable to register the class device\n");
- goto out_irq;
+ return PTR_ERR(ds3232->rtc);
}
if (client->irq >= 0) {
- ret = request_irq(client->irq, ds3232_irq, 0,
+ ret = devm_request_irq(&client->dev, client->irq, ds3232_irq, 0,
"ds3232", client);
if (ret) {
dev_err(&client->dev, "unable to request IRQ\n");
- goto out_free;
+ return ret;
}
}
return 0;
-
-out_irq:
- if (client->irq >= 0)
- free_irq(client->irq, client);
-
-out_free:
- kfree(ds3232);
- return ret;
}
static int ds3232_remove(struct i2c_client *client)
@@ -448,12 +439,10 @@ static int ds3232_remove(struct i2c_client *client)
ds3232->exiting = 1;
mutex_unlock(&ds3232->mutex);
- free_irq(client->irq, client);
+ devm_free_irq(&client->dev, client->irq, client);
cancel_work_sync(&ds3232->work);
}
- rtc_device_unregister(ds3232->rtc);
- kfree(ds3232);
return 0;
}