summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-ds1374.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2013-05-02 15:37:49 (GMT)
committerFrederic Weisbecker <fweisbec@gmail.com>2013-05-02 15:54:19 (GMT)
commitc032862fba51a3ca504752d3a25186b324c5ce83 (patch)
tree955dc2ba4ab3df76ecc2bb780ee84aca04967e8d /drivers/rtc/rtc-ds1374.c
parentfda76e074c7737fc57855dd17c762e50ed526052 (diff)
parent8700c95adb033843fc163d112b9d21d4fda78018 (diff)
downloadlinux-fsl-qoriq-c032862fba51a3ca504752d3a25186b324c5ce83.tar.xz
Merge commit '8700c95adb03' into timers/nohz
The full dynticks tree needs the latest RCU and sched upstream updates in order to fix some dependencies. Merge a common upstream merge point that has these updates. Conflicts: include/linux/perf_event.h kernel/rcutree.h kernel/rcutree_plugin.h Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'drivers/rtc/rtc-ds1374.c')
-rw-r--r--drivers/rtc/rtc-ds1374.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index fef7686..94366e1 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -347,7 +347,7 @@ static int ds1374_probe(struct i2c_client *client,
struct ds1374 *ds1374;
int ret;
- ds1374 = kzalloc(sizeof(struct ds1374), GFP_KERNEL);
+ ds1374 = devm_kzalloc(&client->dev, sizeof(struct ds1374), GFP_KERNEL);
if (!ds1374)
return -ENOMEM;
@@ -359,36 +359,27 @@ static int ds1374_probe(struct i2c_client *client,
ret = ds1374_check_rtc_status(client);
if (ret)
- goto out_free;
+ return ret;
if (client->irq > 0) {
- ret = request_irq(client->irq, ds1374_irq, 0,
+ ret = devm_request_irq(&client->dev, client->irq, ds1374_irq, 0,
"ds1374", client);
if (ret) {
dev_err(&client->dev, "unable to request IRQ\n");
- goto out_free;
+ return ret;
}
device_set_wakeup_capable(&client->dev, 1);
}
- ds1374->rtc = rtc_device_register(client->name, &client->dev,
+ ds1374->rtc = devm_rtc_device_register(&client->dev, client->name,
&ds1374_rtc_ops, THIS_MODULE);
if (IS_ERR(ds1374->rtc)) {
- ret = PTR_ERR(ds1374->rtc);
dev_err(&client->dev, "unable to register the class device\n");
- goto out_irq;
+ return PTR_ERR(ds1374->rtc);
}
return 0;
-
-out_irq:
- if (client->irq > 0)
- free_irq(client->irq, client);
-
-out_free:
- kfree(ds1374);
- return ret;
}
static int ds1374_remove(struct i2c_client *client)
@@ -400,16 +391,14 @@ static int ds1374_remove(struct i2c_client *client)
ds1374->exiting = 1;
mutex_unlock(&ds1374->mutex);
- free_irq(client->irq, client);
+ devm_free_irq(&client->dev, client->irq, client);
cancel_work_sync(&ds1374->work);
}
- rtc_device_unregister(ds1374->rtc);
- kfree(ds1374);
return 0;
}
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
static int ds1374_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@@ -427,19 +416,15 @@ static int ds1374_resume(struct device *dev)
disable_irq_wake(client->irq);
return 0;
}
+#endif
static SIMPLE_DEV_PM_OPS(ds1374_pm, ds1374_suspend, ds1374_resume);
-#define DS1374_PM (&ds1374_pm)
-#else
-#define DS1374_PM NULL
-#endif
-
static struct i2c_driver ds1374_driver = {
.driver = {
.name = "rtc-ds1374",
.owner = THIS_MODULE,
- .pm = DS1374_PM,
+ .pm = &ds1374_pm,
},
.probe = ds1374_probe,
.remove = ds1374_remove,