aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-v3020.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-v3020.c')
-rw-r--r--drivers/rtc/rtc-v3020.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index ad164056feb6..f71c3ce18036 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -28,6 +28,7 @@
28#include <linux/rtc-v3020.h> 28#include <linux/rtc-v3020.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/gpio.h> 30#include <linux/gpio.h>
31#include <linux/slab.h>
31 32
32#include <linux/io.h> 33#include <linux/io.h>
33 34
@@ -96,7 +97,7 @@ static void v3020_mmio_write_bit(struct v3020 *chip, unsigned char bit)
96 97
97static unsigned char v3020_mmio_read_bit(struct v3020 *chip) 98static unsigned char v3020_mmio_read_bit(struct v3020 *chip)
98{ 99{
99 return readl(chip->ioaddress) & (1 << chip->leftshift); 100 return !!(readl(chip->ioaddress) & (1 << chip->leftshift));
100} 101}
101 102
102static struct v3020_chip_ops v3020_mmio_ops = { 103static struct v3020_chip_ops v3020_mmio_ops = {
@@ -304,7 +305,6 @@ static int rtc_probe(struct platform_device *pdev)
304{ 305{
305 struct v3020_platform_data *pdata = pdev->dev.platform_data; 306 struct v3020_platform_data *pdata = pdev->dev.platform_data;
306 struct v3020 *chip; 307 struct v3020 *chip;
307 struct rtc_device *rtc;
308 int retval = -EBUSY; 308 int retval = -EBUSY;
309 int i; 309 int i;
310 int temp; 310 int temp;
@@ -335,7 +335,7 @@ static int rtc_probe(struct platform_device *pdev)
335 goto err_io; 335 goto err_io;
336 } 336 }
337 337
338 /* Make sure frequency measurment mode, test modes, and lock 338 /* Make sure frequency measurement mode, test modes, and lock
339 * are all disabled */ 339 * are all disabled */
340 v3020_set_reg(chip, V3020_STATUS_0, 0x0); 340 v3020_set_reg(chip, V3020_STATUS_0, 0x0);
341 341
@@ -353,13 +353,12 @@ static int rtc_probe(struct platform_device *pdev)
353 353
354 platform_set_drvdata(pdev, chip); 354 platform_set_drvdata(pdev, chip);
355 355
356 rtc = rtc_device_register("v3020", 356 chip->rtc = rtc_device_register("v3020",
357 &pdev->dev, &v3020_rtc_ops, THIS_MODULE); 357 &pdev->dev, &v3020_rtc_ops, THIS_MODULE);
358 if (IS_ERR(rtc)) { 358 if (IS_ERR(chip->rtc)) {
359 retval = PTR_ERR(rtc); 359 retval = PTR_ERR(chip->rtc);
360 goto err_io; 360 goto err_io;
361 } 361 }
362 chip->rtc = rtc;
363 362
364 return 0; 363 return 0;
365 364