diff options
author | Johan Hovold <johan@kernel.org> | 2014-12-10 18:53:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:14 -0500 |
commit | 10211ae34691934f87ea53dd193ea0c64f86b77c (patch) | |
tree | a97851eb5563da6c4ad336d095e9c1c9af1ab41c /drivers/rtc/rtc-omap.c | |
parent | 8ad5c722d592ae1965195651965c02396b42fe1a (diff) |
rtc: omap: fix minor coding style issues
Fix minor coding style issues like comment style, indentation and remove
a few unnecessary casts.
Also drop the 1 from OMAP1 in the driver description.
Signed-off-by: Johan Hovold <johan@kernel.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Benot Cousson <bcousson@baylibre.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Keerthy J <j-keerthy@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-omap.c')
-rw-r--r-- | drivers/rtc/rtc-omap.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 0dfb0404f867..3128be5e3644 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * TI OMAP1 Real Time Clock interface for Linux | 2 | * TI OMAP Real Time Clock interface for Linux |
3 | * | 3 | * |
4 | * Copyright (C) 2003 MontaVista Software, Inc. | 4 | * Copyright (C) 2003 MontaVista Software, Inc. |
5 | * Author: George G. Davis <gdavis@mvista.com> or <source@mvista.com> | 5 | * Author: George G. Davis <gdavis@mvista.com> or <source@mvista.com> |
@@ -25,7 +25,8 @@ | |||
25 | #include <linux/pm_runtime.h> | 25 | #include <linux/pm_runtime.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | 27 | ||
28 | /* The OMAP1 RTC is a year/month/day/hours/minutes/seconds BCD clock | 28 | /* |
29 | * The OMAP RTC is a year/month/day/hours/minutes/seconds BCD clock | ||
29 | * with century-range alarm matching, driven by the 32kHz clock. | 30 | * with century-range alarm matching, driven by the 32kHz clock. |
30 | * | 31 | * |
31 | * The main user-visible ways it differs from PC RTCs are by omitting | 32 | * The main user-visible ways it differs from PC RTCs are by omitting |
@@ -154,19 +155,20 @@ static inline void rtc_writel(struct omap_rtc *rtc, unsigned int reg, u32 val) | |||
154 | writel(val, rtc->base + reg); | 155 | writel(val, rtc->base + reg); |
155 | } | 156 | } |
156 | 157 | ||
157 | /* we rely on the rtc framework to handle locking (rtc->ops_lock), | 158 | /* |
159 | * We rely on the rtc framework to handle locking (rtc->ops_lock), | ||
158 | * so the only other requirement is that register accesses which | 160 | * so the only other requirement is that register accesses which |
159 | * require BUSY to be clear are made with IRQs locally disabled | 161 | * require BUSY to be clear are made with IRQs locally disabled |
160 | */ | 162 | */ |
161 | static void rtc_wait_not_busy(struct omap_rtc *rtc) | 163 | static void rtc_wait_not_busy(struct omap_rtc *rtc) |
162 | { | 164 | { |
163 | int count = 0; | 165 | int count; |
164 | u8 status; | 166 | u8 status; |
165 | 167 | ||
166 | /* BUSY may stay active for 1/32768 second (~30 usec) */ | 168 | /* BUSY may stay active for 1/32768 second (~30 usec) */ |
167 | for (count = 0; count < 50; count++) { | 169 | for (count = 0; count < 50; count++) { |
168 | status = rtc_read(rtc, OMAP_RTC_STATUS_REG); | 170 | status = rtc_read(rtc, OMAP_RTC_STATUS_REG); |
169 | if ((status & (u8)OMAP_RTC_STATUS_BUSY) == 0) | 171 | if (!(status & OMAP_RTC_STATUS_BUSY)) |
170 | break; | 172 | break; |
171 | udelay(1); | 173 | udelay(1); |
172 | } | 174 | } |
@@ -175,9 +177,9 @@ static void rtc_wait_not_busy(struct omap_rtc *rtc) | |||
175 | 177 | ||
176 | static irqreturn_t rtc_irq(int irq, void *dev_id) | 178 | static irqreturn_t rtc_irq(int irq, void *dev_id) |
177 | { | 179 | { |
178 | struct omap_rtc *rtc = dev_id; | 180 | struct omap_rtc *rtc = dev_id; |
179 | unsigned long events = 0; | 181 | unsigned long events = 0; |
180 | u8 irq_data; | 182 | u8 irq_data; |
181 | 183 | ||
182 | irq_data = rtc_read(rtc, OMAP_RTC_STATUS_REG); | 184 | irq_data = rtc_read(rtc, OMAP_RTC_STATUS_REG); |
183 | 185 | ||
@@ -276,6 +278,7 @@ static int omap_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
276 | local_irq_enable(); | 278 | local_irq_enable(); |
277 | 279 | ||
278 | bcd2tm(tm); | 280 | bcd2tm(tm); |
281 | |||
279 | return 0; | 282 | return 0; |
280 | } | 283 | } |
281 | 284 | ||
@@ -285,6 +288,7 @@ static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
285 | 288 | ||
286 | if (tm2bcd(tm) < 0) | 289 | if (tm2bcd(tm) < 0) |
287 | return -EINVAL; | 290 | return -EINVAL; |
291 | |||
288 | local_irq_disable(); | 292 | local_irq_disable(); |
289 | rtc_wait_not_busy(rtc); | 293 | rtc_wait_not_busy(rtc); |
290 | 294 | ||
@@ -303,6 +307,7 @@ static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
303 | static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) | 307 | static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) |
304 | { | 308 | { |
305 | struct omap_rtc *rtc = dev_get_drvdata(dev); | 309 | struct omap_rtc *rtc = dev_get_drvdata(dev); |
310 | u8 interrupts; | ||
306 | 311 | ||
307 | local_irq_disable(); | 312 | local_irq_disable(); |
308 | rtc_wait_not_busy(rtc); | 313 | rtc_wait_not_busy(rtc); |
@@ -317,8 +322,9 @@ static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
317 | local_irq_enable(); | 322 | local_irq_enable(); |
318 | 323 | ||
319 | bcd2tm(&alm->time); | 324 | bcd2tm(&alm->time); |
320 | alm->enabled = !!(rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG) | 325 | |
321 | & OMAP_RTC_INTERRUPTS_IT_ALARM); | 326 | interrupts = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG); |
327 | alm->enabled = !!(interrupts & OMAP_RTC_INTERRUPTS_IT_ALARM); | ||
322 | 328 | ||
323 | return 0; | 329 | return 0; |
324 | } | 330 | } |
@@ -479,9 +485,9 @@ MODULE_DEVICE_TABLE(of, omap_rtc_of_match); | |||
479 | 485 | ||
480 | static int __init omap_rtc_probe(struct platform_device *pdev) | 486 | static int __init omap_rtc_probe(struct platform_device *pdev) |
481 | { | 487 | { |
482 | struct omap_rtc *rtc; | 488 | struct omap_rtc *rtc; |
483 | struct resource *res; | 489 | struct resource *res; |
484 | u8 reg, mask, new_ctrl; | 490 | u8 reg, mask, new_ctrl; |
485 | const struct platform_device_id *id_entry; | 491 | const struct platform_device_id *id_entry; |
486 | const struct of_device_id *of_id; | 492 | const struct of_device_id *of_id; |
487 | int ret; | 493 | int ret; |
@@ -558,14 +564,15 @@ static int __init omap_rtc_probe(struct platform_device *pdev) | |||
558 | 564 | ||
559 | /* On boards with split power, RTC_ON_NOFF won't reset the RTC */ | 565 | /* On boards with split power, RTC_ON_NOFF won't reset the RTC */ |
560 | reg = rtc_read(rtc, OMAP_RTC_CTRL_REG); | 566 | reg = rtc_read(rtc, OMAP_RTC_CTRL_REG); |
561 | if (reg & (u8) OMAP_RTC_CTRL_STOP) | 567 | if (reg & OMAP_RTC_CTRL_STOP) |
562 | dev_info(&pdev->dev, "already running\n"); | 568 | dev_info(&pdev->dev, "already running\n"); |
563 | 569 | ||
564 | /* force to 24 hour mode */ | 570 | /* force to 24 hour mode */ |
565 | new_ctrl = reg & (OMAP_RTC_CTRL_SPLIT|OMAP_RTC_CTRL_AUTO_COMP); | 571 | new_ctrl = reg & (OMAP_RTC_CTRL_SPLIT | OMAP_RTC_CTRL_AUTO_COMP); |
566 | new_ctrl |= OMAP_RTC_CTRL_STOP; | 572 | new_ctrl |= OMAP_RTC_CTRL_STOP; |
567 | 573 | ||
568 | /* BOARD-SPECIFIC CUSTOMIZATION CAN GO HERE: | 574 | /* |
575 | * BOARD-SPECIFIC CUSTOMIZATION CAN GO HERE: | ||
569 | * | 576 | * |
570 | * - Device wake-up capability setting should come through chip | 577 | * - Device wake-up capability setting should come through chip |
571 | * init logic. OMAP1 boards should initialize the "wakeup capable" | 578 | * init logic. OMAP1 boards should initialize the "wakeup capable" |
@@ -579,7 +586,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) | |||
579 | * is write-only, and always reads as zero...) | 586 | * is write-only, and always reads as zero...) |
580 | */ | 587 | */ |
581 | 588 | ||
582 | if (new_ctrl & (u8) OMAP_RTC_CTRL_SPLIT) | 589 | if (new_ctrl & OMAP_RTC_CTRL_SPLIT) |
583 | dev_info(&pdev->dev, "split power mode\n"); | 590 | dev_info(&pdev->dev, "split power mode\n"); |
584 | 591 | ||
585 | if (reg != new_ctrl) | 592 | if (reg != new_ctrl) |
@@ -658,7 +665,8 @@ static int omap_rtc_suspend(struct device *dev) | |||
658 | 665 | ||
659 | rtc->interrupts_reg = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG); | 666 | rtc->interrupts_reg = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG); |
660 | 667 | ||
661 | /* FIXME the RTC alarm is not currently acting as a wakeup event | 668 | /* |
669 | * FIXME: the RTC alarm is not currently acting as a wakeup event | ||
662 | * source on some platforms, and in fact this enable() call is just | 670 | * source on some platforms, and in fact this enable() call is just |
663 | * saving a flag that's never used... | 671 | * saving a flag that's never used... |
664 | */ | 672 | */ |