Commit 10211ae3 authored by Johan Hovold's avatar Johan Hovold Committed by Linus Torvalds

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: default avatarJohan 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: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8ad5c722
/* /*
* TI OMAP1 Real Time Clock interface for Linux * TI OMAP Real Time Clock interface for Linux
* *
* Copyright (C) 2003 MontaVista Software, Inc. * Copyright (C) 2003 MontaVista Software, Inc.
* Author: George G. Davis <gdavis@mvista.com> or <source@mvista.com> * Author: George G. Davis <gdavis@mvista.com> or <source@mvista.com>
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/io.h> #include <linux/io.h>
/* The OMAP1 RTC is a year/month/day/hours/minutes/seconds BCD clock /*
* The OMAP RTC is a year/month/day/hours/minutes/seconds BCD clock
* with century-range alarm matching, driven by the 32kHz clock. * with century-range alarm matching, driven by the 32kHz clock.
* *
* The main user-visible ways it differs from PC RTCs are by omitting * 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,19 +155,20 @@ static inline void rtc_writel(struct omap_rtc *rtc, unsigned int reg, u32 val)
writel(val, rtc->base + reg); writel(val, rtc->base + reg);
} }
/* we rely on the rtc framework to handle locking (rtc->ops_lock), /*
* We rely on the rtc framework to handle locking (rtc->ops_lock),
* so the only other requirement is that register accesses which * so the only other requirement is that register accesses which
* require BUSY to be clear are made with IRQs locally disabled * require BUSY to be clear are made with IRQs locally disabled
*/ */
static void rtc_wait_not_busy(struct omap_rtc *rtc) static void rtc_wait_not_busy(struct omap_rtc *rtc)
{ {
int count = 0; int count;
u8 status; u8 status;
/* BUSY may stay active for 1/32768 second (~30 usec) */ /* BUSY may stay active for 1/32768 second (~30 usec) */
for (count = 0; count < 50; count++) { for (count = 0; count < 50; count++) {
status = rtc_read(rtc, OMAP_RTC_STATUS_REG); status = rtc_read(rtc, OMAP_RTC_STATUS_REG);
if ((status & (u8)OMAP_RTC_STATUS_BUSY) == 0) if (!(status & OMAP_RTC_STATUS_BUSY))
break; break;
udelay(1); udelay(1);
} }
...@@ -175,9 +177,9 @@ static void rtc_wait_not_busy(struct omap_rtc *rtc) ...@@ -175,9 +177,9 @@ static void rtc_wait_not_busy(struct omap_rtc *rtc)
static irqreturn_t rtc_irq(int irq, void *dev_id) static irqreturn_t rtc_irq(int irq, void *dev_id)
{ {
struct omap_rtc *rtc = dev_id; struct omap_rtc *rtc = dev_id;
unsigned long events = 0; unsigned long events = 0;
u8 irq_data; u8 irq_data;
irq_data = rtc_read(rtc, OMAP_RTC_STATUS_REG); irq_data = rtc_read(rtc, OMAP_RTC_STATUS_REG);
...@@ -276,6 +278,7 @@ static int omap_rtc_read_time(struct device *dev, struct rtc_time *tm) ...@@ -276,6 +278,7 @@ static int omap_rtc_read_time(struct device *dev, struct rtc_time *tm)
local_irq_enable(); local_irq_enable();
bcd2tm(tm); bcd2tm(tm);
return 0; return 0;
} }
...@@ -285,6 +288,7 @@ static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -285,6 +288,7 @@ static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm)
if (tm2bcd(tm) < 0) if (tm2bcd(tm) < 0)
return -EINVAL; return -EINVAL;
local_irq_disable(); local_irq_disable();
rtc_wait_not_busy(rtc); rtc_wait_not_busy(rtc);
...@@ -303,6 +307,7 @@ static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -303,6 +307,7 @@ static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm)
static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
{ {
struct omap_rtc *rtc = dev_get_drvdata(dev); struct omap_rtc *rtc = dev_get_drvdata(dev);
u8 interrupts;
local_irq_disable(); local_irq_disable();
rtc_wait_not_busy(rtc); rtc_wait_not_busy(rtc);
...@@ -317,8 +322,9 @@ static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) ...@@ -317,8 +322,9 @@ static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
local_irq_enable(); local_irq_enable();
bcd2tm(&alm->time); bcd2tm(&alm->time);
alm->enabled = !!(rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG)
& OMAP_RTC_INTERRUPTS_IT_ALARM); interrupts = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
alm->enabled = !!(interrupts & OMAP_RTC_INTERRUPTS_IT_ALARM);
return 0; return 0;
} }
...@@ -479,9 +485,9 @@ MODULE_DEVICE_TABLE(of, omap_rtc_of_match); ...@@ -479,9 +485,9 @@ MODULE_DEVICE_TABLE(of, omap_rtc_of_match);
static int __init omap_rtc_probe(struct platform_device *pdev) static int __init omap_rtc_probe(struct platform_device *pdev)
{ {
struct omap_rtc *rtc; struct omap_rtc *rtc;
struct resource *res; struct resource *res;
u8 reg, mask, new_ctrl; u8 reg, mask, new_ctrl;
const struct platform_device_id *id_entry; const struct platform_device_id *id_entry;
const struct of_device_id *of_id; const struct of_device_id *of_id;
int ret; int ret;
...@@ -558,14 +564,15 @@ static int __init omap_rtc_probe(struct platform_device *pdev) ...@@ -558,14 +564,15 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
/* On boards with split power, RTC_ON_NOFF won't reset the RTC */ /* On boards with split power, RTC_ON_NOFF won't reset the RTC */
reg = rtc_read(rtc, OMAP_RTC_CTRL_REG); reg = rtc_read(rtc, OMAP_RTC_CTRL_REG);
if (reg & (u8) OMAP_RTC_CTRL_STOP) if (reg & OMAP_RTC_CTRL_STOP)
dev_info(&pdev->dev, "already running\n"); dev_info(&pdev->dev, "already running\n");
/* force to 24 hour mode */ /* force to 24 hour mode */
new_ctrl = reg & (OMAP_RTC_CTRL_SPLIT|OMAP_RTC_CTRL_AUTO_COMP); new_ctrl = reg & (OMAP_RTC_CTRL_SPLIT | OMAP_RTC_CTRL_AUTO_COMP);
new_ctrl |= OMAP_RTC_CTRL_STOP; new_ctrl |= OMAP_RTC_CTRL_STOP;
/* BOARD-SPECIFIC CUSTOMIZATION CAN GO HERE: /*
* BOARD-SPECIFIC CUSTOMIZATION CAN GO HERE:
* *
* - Device wake-up capability setting should come through chip * - Device wake-up capability setting should come through chip
* init logic. OMAP1 boards should initialize the "wakeup capable" * init logic. OMAP1 boards should initialize the "wakeup capable"
...@@ -579,7 +586,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) ...@@ -579,7 +586,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
* is write-only, and always reads as zero...) * is write-only, and always reads as zero...)
*/ */
if (new_ctrl & (u8) OMAP_RTC_CTRL_SPLIT) if (new_ctrl & OMAP_RTC_CTRL_SPLIT)
dev_info(&pdev->dev, "split power mode\n"); dev_info(&pdev->dev, "split power mode\n");
if (reg != new_ctrl) if (reg != new_ctrl)
...@@ -658,7 +665,8 @@ static int omap_rtc_suspend(struct device *dev) ...@@ -658,7 +665,8 @@ static int omap_rtc_suspend(struct device *dev)
rtc->interrupts_reg = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG); rtc->interrupts_reg = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
/* FIXME the RTC alarm is not currently acting as a wakeup event /*
* FIXME: the RTC alarm is not currently acting as a wakeup event
* source on some platforms, and in fact this enable() call is just * source on some platforms, and in fact this enable() call is just
* saving a flag that's never used... * saving a flag that's never used...
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment