aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-at32ap700x.c4
-rw-r--r--drivers/rtc/rtc-bq4802.c3
-rw-r--r--drivers/rtc/rtc-ds1302.c1
-rw-r--r--drivers/rtc/rtc-ds1305.c14
-rw-r--r--drivers/rtc/rtc-m48t35.c16
-rw-r--r--drivers/rtc/rtc-m48t59.c11
-rw-r--r--drivers/rtc/rtc-pcf8563.c4
-rw-r--r--drivers/rtc/rtc-pcf8583.c3
-rw-r--r--drivers/rtc/rtc-stk17ta8.c20
-rw-r--r--drivers/rtc/rtc-v3020.c8
10 files changed, 42 insertions, 42 deletions
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index e1ec33e40e38..8825695777df 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -256,6 +256,8 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
256 goto out_iounmap; 256 goto out_iounmap;
257 } 257 }
258 258
259 platform_set_drvdata(pdev, rtc);
260
259 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, 261 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
260 &at32_rtc_ops, THIS_MODULE); 262 &at32_rtc_ops, THIS_MODULE);
261 if (IS_ERR(rtc->rtc)) { 263 if (IS_ERR(rtc->rtc)) {
@@ -264,7 +266,6 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
264 goto out_free_irq; 266 goto out_free_irq;
265 } 267 }
266 268
267 platform_set_drvdata(pdev, rtc);
268 device_init_wakeup(&pdev->dev, 1); 269 device_init_wakeup(&pdev->dev, 1);
269 270
270 dev_info(&pdev->dev, "Atmel RTC for AT32AP700x at %08lx irq %ld\n", 271 dev_info(&pdev->dev, "Atmel RTC for AT32AP700x at %08lx irq %ld\n",
@@ -273,6 +274,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
273 return 0; 274 return 0;
274 275
275out_free_irq: 276out_free_irq:
277 platform_set_drvdata(pdev, NULL);
276 free_irq(irq, rtc); 278 free_irq(irq, rtc);
277out_iounmap: 279out_iounmap:
278 iounmap(rtc->regs); 280 iounmap(rtc->regs);
diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c
index d00a274df8fc..280fe48ada0b 100644
--- a/drivers/rtc/rtc-bq4802.c
+++ b/drivers/rtc/rtc-bq4802.c
@@ -169,6 +169,8 @@ static int __devinit bq4802_probe(struct platform_device *pdev)
169 goto out_free; 169 goto out_free;
170 } 170 }
171 171
172 platform_set_drvdata(pdev, p);
173
172 p->rtc = rtc_device_register("bq4802", &pdev->dev, 174 p->rtc = rtc_device_register("bq4802", &pdev->dev,
173 &bq4802_ops, THIS_MODULE); 175 &bq4802_ops, THIS_MODULE);
174 if (IS_ERR(p->rtc)) { 176 if (IS_ERR(p->rtc)) {
@@ -176,7 +178,6 @@ static int __devinit bq4802_probe(struct platform_device *pdev)
176 goto out_iounmap; 178 goto out_iounmap;
177 } 179 }
178 180
179 platform_set_drvdata(pdev, p);
180 err = 0; 181 err = 0;
181out: 182out:
182 return err; 183 return err;
diff --git a/drivers/rtc/rtc-ds1302.c b/drivers/rtc/rtc-ds1302.c
index 1e73c8f42e38..532acf9b05d8 100644
--- a/drivers/rtc/rtc-ds1302.c
+++ b/drivers/rtc/rtc-ds1302.c
@@ -143,7 +143,6 @@ static int ds1302_rtc_ioctl(struct device *dev, unsigned int cmd,
143#ifdef RTC_SET_CHARGE 143#ifdef RTC_SET_CHARGE
144 case RTC_SET_CHARGE: 144 case RTC_SET_CHARGE:
145 { 145 {
146 struct ds1302_rtc *rtc = dev_get_drvdata(dev);
147 int tcs_val; 146 int tcs_val;
148 147
149 if (copy_from_user(&tcs_val, (int __user *)arg, sizeof(int))) 148 if (copy_from_user(&tcs_val, (int __user *)arg, sizeof(int)))
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 2736b11a1b1e..259db7f3535b 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -617,7 +617,6 @@ static struct bin_attribute nvram = {
617static int __devinit ds1305_probe(struct spi_device *spi) 617static int __devinit ds1305_probe(struct spi_device *spi)
618{ 618{
619 struct ds1305 *ds1305; 619 struct ds1305 *ds1305;
620 struct rtc_device *rtc;
621 int status; 620 int status;
622 u8 addr, value; 621 u8 addr, value;
623 struct ds1305_platform_data *pdata = spi->dev.platform_data; 622 struct ds1305_platform_data *pdata = spi->dev.platform_data;
@@ -756,14 +755,13 @@ static int __devinit ds1305_probe(struct spi_device *spi)
756 dev_dbg(&spi->dev, "AM/PM\n"); 755 dev_dbg(&spi->dev, "AM/PM\n");
757 756
758 /* register RTC ... from here on, ds1305->ctrl needs locking */ 757 /* register RTC ... from here on, ds1305->ctrl needs locking */
759 rtc = rtc_device_register("ds1305", &spi->dev, 758 ds1305->rtc = rtc_device_register("ds1305", &spi->dev,
760 &ds1305_ops, THIS_MODULE); 759 &ds1305_ops, THIS_MODULE);
761 if (IS_ERR(rtc)) { 760 if (IS_ERR(ds1305->rtc)) {
762 status = PTR_ERR(rtc); 761 status = PTR_ERR(ds1305->rtc);
763 dev_dbg(&spi->dev, "register rtc --> %d\n", status); 762 dev_dbg(&spi->dev, "register rtc --> %d\n", status);
764 goto fail0; 763 goto fail0;
765 } 764 }
766 ds1305->rtc = rtc;
767 765
768 /* Maybe set up alarm IRQ; be ready to handle it triggering right 766 /* Maybe set up alarm IRQ; be ready to handle it triggering right
769 * away. NOTE that we don't share this. The signal is active low, 767 * away. NOTE that we don't share this. The signal is active low,
@@ -774,7 +772,7 @@ static int __devinit ds1305_probe(struct spi_device *spi)
774 if (spi->irq) { 772 if (spi->irq) {
775 INIT_WORK(&ds1305->work, ds1305_work); 773 INIT_WORK(&ds1305->work, ds1305_work);
776 status = request_irq(spi->irq, ds1305_irq, 774 status = request_irq(spi->irq, ds1305_irq,
777 0, dev_name(&rtc->dev), ds1305); 775 0, dev_name(&ds1305->rtc->dev), ds1305);
778 if (status < 0) { 776 if (status < 0) {
779 dev_dbg(&spi->dev, "request_irq %d --> %d\n", 777 dev_dbg(&spi->dev, "request_irq %d --> %d\n",
780 spi->irq, status); 778 spi->irq, status);
@@ -794,7 +792,7 @@ static int __devinit ds1305_probe(struct spi_device *spi)
794fail2: 792fail2:
795 free_irq(spi->irq, ds1305); 793 free_irq(spi->irq, ds1305);
796fail1: 794fail1:
797 rtc_device_unregister(rtc); 795 rtc_device_unregister(ds1305->rtc);
798fail0: 796fail0:
799 kfree(ds1305); 797 kfree(ds1305);
800 return status; 798 return status;
@@ -802,7 +800,7 @@ fail0:
802 800
803static int __devexit ds1305_remove(struct spi_device *spi) 801static int __devexit ds1305_remove(struct spi_device *spi)
804{ 802{
805 struct ds1305 *ds1305 = spi_get_drvdata(spi); 803 struct ds1305 *ds1305 = spi_get_drvdata(spi);
806 804
807 sysfs_remove_bin_file(&spi->dev.kobj, &nvram); 805 sysfs_remove_bin_file(&spi->dev.kobj, &nvram);
808 806
diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c
index 0b2197559940..8cb5b8959e5b 100644
--- a/drivers/rtc/rtc-m48t35.c
+++ b/drivers/rtc/rtc-m48t35.c
@@ -142,7 +142,6 @@ static const struct rtc_class_ops m48t35_ops = {
142 142
143static int __devinit m48t35_probe(struct platform_device *pdev) 143static int __devinit m48t35_probe(struct platform_device *pdev)
144{ 144{
145 struct rtc_device *rtc;
146 struct resource *res; 145 struct resource *res;
147 struct m48t35_priv *priv; 146 struct m48t35_priv *priv;
148 int ret = 0; 147 int ret = 0;
@@ -171,20 +170,21 @@ static int __devinit m48t35_probe(struct platform_device *pdev)
171 ret = -ENOMEM; 170 ret = -ENOMEM;
172 goto out; 171 goto out;
173 } 172 }
173
174 spin_lock_init(&priv->lock); 174 spin_lock_init(&priv->lock);
175 rtc = rtc_device_register("m48t35", &pdev->dev, 175
176 platform_set_drvdata(pdev, priv);
177
178 priv->rtc = rtc_device_register("m48t35", &pdev->dev,
176 &m48t35_ops, THIS_MODULE); 179 &m48t35_ops, THIS_MODULE);
177 if (IS_ERR(rtc)) { 180 if (IS_ERR(priv->rtc)) {
178 ret = PTR_ERR(rtc); 181 ret = PTR_ERR(priv->rtc);
179 goto out; 182 goto out;
180 } 183 }
181 priv->rtc = rtc; 184
182 platform_set_drvdata(pdev, priv);
183 return 0; 185 return 0;
184 186
185out: 187out:
186 if (priv->rtc)
187 rtc_device_unregister(priv->rtc);
188 if (priv->reg) 188 if (priv->reg)
189 iounmap(priv->reg); 189 iounmap(priv->reg);
190 if (priv->baseaddr) 190 if (priv->baseaddr)
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 33921a6b1707..ede43b846859 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -481,6 +481,9 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
481 goto out; 481 goto out;
482 } 482 }
483 483
484 spin_lock_init(&m48t59->lock);
485 platform_set_drvdata(pdev, m48t59);
486
484 m48t59->rtc = rtc_device_register(name, &pdev->dev, ops, THIS_MODULE); 487 m48t59->rtc = rtc_device_register(name, &pdev->dev, ops, THIS_MODULE);
485 if (IS_ERR(m48t59->rtc)) { 488 if (IS_ERR(m48t59->rtc)) {
486 ret = PTR_ERR(m48t59->rtc); 489 ret = PTR_ERR(m48t59->rtc);
@@ -490,16 +493,14 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
490 m48t59_nvram_attr.size = pdata->offset; 493 m48t59_nvram_attr.size = pdata->offset;
491 494
492 ret = sysfs_create_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr); 495 ret = sysfs_create_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr);
493 if (ret) 496 if (ret) {
497 rtc_device_unregister(m48t59->rtc);
494 goto out; 498 goto out;
499 }
495 500
496 spin_lock_init(&m48t59->lock);
497 platform_set_drvdata(pdev, m48t59);
498 return 0; 501 return 0;
499 502
500out: 503out:
501 if (!IS_ERR(m48t59->rtc))
502 rtc_device_unregister(m48t59->rtc);
503 if (m48t59->irq != NO_IRQ) 504 if (m48t59->irq != NO_IRQ)
504 free_irq(m48t59->irq, &pdev->dev); 505 free_irq(m48t59->irq, &pdev->dev);
505 if (m48t59->ioaddr) 506 if (m48t59->ioaddr)
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index b725913ccbe8..65f346b2fbae 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -212,6 +212,8 @@ static int pcf8563_probe(struct i2c_client *client,
212 212
213 dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); 213 dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n");
214 214
215 i2c_set_clientdata(client, pcf8563);
216
215 pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name, 217 pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name,
216 &client->dev, &pcf8563_rtc_ops, THIS_MODULE); 218 &client->dev, &pcf8563_rtc_ops, THIS_MODULE);
217 219
@@ -220,8 +222,6 @@ static int pcf8563_probe(struct i2c_client *client,
220 goto exit_kfree; 222 goto exit_kfree;
221 } 223 }
222 224
223 i2c_set_clientdata(client, pcf8563);
224
225 return 0; 225 return 0;
226 226
227exit_kfree: 227exit_kfree:
diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c
index 7d33cda3f8f6..2d201afead3b 100644
--- a/drivers/rtc/rtc-pcf8583.c
+++ b/drivers/rtc/rtc-pcf8583.c
@@ -277,6 +277,8 @@ static int pcf8583_probe(struct i2c_client *client,
277 if (!pcf8583) 277 if (!pcf8583)
278 return -ENOMEM; 278 return -ENOMEM;
279 279
280 i2c_set_clientdata(client, pcf8583);
281
280 pcf8583->rtc = rtc_device_register(pcf8583_driver.driver.name, 282 pcf8583->rtc = rtc_device_register(pcf8583_driver.driver.name,
281 &client->dev, &pcf8583_rtc_ops, THIS_MODULE); 283 &client->dev, &pcf8583_rtc_ops, THIS_MODULE);
282 284
@@ -285,7 +287,6 @@ static int pcf8583_probe(struct i2c_client *client,
285 goto exit_kfree; 287 goto exit_kfree;
286 } 288 }
287 289
288 i2c_set_clientdata(client, pcf8583);
289 return 0; 290 return 0;
290 291
291exit_kfree: 292exit_kfree:
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index d491eb265c38..62c2969436a8 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -288,7 +288,6 @@ static struct bin_attribute stk17ta8_nvram_attr = {
288 288
289static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev) 289static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev)
290{ 290{
291 struct rtc_device *rtc;
292 struct resource *res; 291 struct resource *res;
293 unsigned int cal; 292 unsigned int cal;
294 unsigned int flags; 293 unsigned int flags;
@@ -338,22 +337,23 @@ static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev)
338 } 337 }
339 } 338 }
340 339
341 rtc = rtc_device_register(pdev->name, &pdev->dev, 340 pdata->last_jiffies = jiffies;
341 platform_set_drvdata(pdev, pdata);
342
343 pdata->rtc = rtc_device_register(pdev->name, &pdev->dev,
342 &stk17ta8_rtc_ops, THIS_MODULE); 344 &stk17ta8_rtc_ops, THIS_MODULE);
343 if (IS_ERR(rtc)) { 345 if (IS_ERR(pdata->rtc)) {
344 ret = PTR_ERR(rtc); 346 ret = PTR_ERR(pdata->rtc);
345 goto out; 347 goto out;
346 } 348 }
347 pdata->rtc = rtc; 349
348 pdata->last_jiffies = jiffies;
349 platform_set_drvdata(pdev, pdata);
350 ret = sysfs_create_bin_file(&pdev->dev.kobj, &stk17ta8_nvram_attr); 350 ret = sysfs_create_bin_file(&pdev->dev.kobj, &stk17ta8_nvram_attr);
351 if (ret) 351 if (ret) {
352 rtc_device_unregister(pdata->rtc);
352 goto out; 353 goto out;
354 }
353 return 0; 355 return 0;
354 out: 356 out:
355 if (pdata->rtc)
356 rtc_device_unregister(pdata->rtc);
357 if (pdata->irq > 0) 357 if (pdata->irq > 0)
358 free_irq(pdata->irq, pdev); 358 free_irq(pdata->irq, pdev);
359 if (ioaddr) 359 if (ioaddr)
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index ad741afd47d8..bed4cab07043 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -304,7 +304,6 @@ static int rtc_probe(struct platform_device *pdev)
304{ 304{
305 struct v3020_platform_data *pdata = pdev->dev.platform_data; 305 struct v3020_platform_data *pdata = pdev->dev.platform_data;
306 struct v3020 *chip; 306 struct v3020 *chip;
307 struct rtc_device *rtc;
308 int retval = -EBUSY; 307 int retval = -EBUSY;
309 int i; 308 int i;
310 int temp; 309 int temp;
@@ -353,13 +352,12 @@ static int rtc_probe(struct platform_device *pdev)
353 352
354 platform_set_drvdata(pdev, chip); 353 platform_set_drvdata(pdev, chip);
355 354
356 rtc = rtc_device_register("v3020", 355 chip->rtc = rtc_device_register("v3020",
357 &pdev->dev, &v3020_rtc_ops, THIS_MODULE); 356 &pdev->dev, &v3020_rtc_ops, THIS_MODULE);
358 if (IS_ERR(rtc)) { 357 if (IS_ERR(chip->rtc)) {
359 retval = PTR_ERR(rtc); 358 retval = PTR_ERR(chip->rtc);
360 goto err_io; 359 goto err_io;
361 } 360 }
362 chip->rtc = rtc;
363 361
364 return 0; 362 return 0;
365 363