Commit 7b2f0053 authored by Sachin Kamat's avatar Sachin Kamat Committed by Linus Torvalds

drivers/rtc/rtc-ds1511.c: fix issues related to spaces and braces

Fixes the following types of issues:

  WARNING: please, no spaces at the start of a line
  WARNING: braces {} are not necessary for single statement blocks
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent adc7b9b6
...@@ -104,31 +104,31 @@ static DEFINE_SPINLOCK(ds1511_lock); ...@@ -104,31 +104,31 @@ static DEFINE_SPINLOCK(ds1511_lock);
static __iomem char *ds1511_base; static __iomem char *ds1511_base;
static u32 reg_spacing = 1; static u32 reg_spacing = 1;
static noinline void static noinline void
rtc_write(uint8_t val, uint32_t reg) rtc_write(uint8_t val, uint32_t reg)
{ {
writeb(val, ds1511_base + (reg * reg_spacing)); writeb(val, ds1511_base + (reg * reg_spacing));
} }
static inline void static inline void
rtc_write_alarm(uint8_t val, enum ds1511reg reg) rtc_write_alarm(uint8_t val, enum ds1511reg reg)
{ {
rtc_write((val | 0x80), reg); rtc_write((val | 0x80), reg);
} }
static noinline uint8_t static noinline uint8_t
rtc_read(enum ds1511reg reg) rtc_read(enum ds1511reg reg)
{ {
return readb(ds1511_base + (reg * reg_spacing)); return readb(ds1511_base + (reg * reg_spacing));
} }
static inline void static inline void
rtc_disable_update(void) rtc_disable_update(void)
{ {
rtc_write((rtc_read(RTC_CMD) & ~RTC_TE), RTC_CMD); rtc_write((rtc_read(RTC_CMD) & ~RTC_TE), RTC_CMD);
} }
static void static void
rtc_enable_update(void) rtc_enable_update(void)
{ {
rtc_write((rtc_read(RTC_CMD) | RTC_TE), RTC_CMD); rtc_write((rtc_read(RTC_CMD) | RTC_TE), RTC_CMD);
...@@ -145,7 +145,7 @@ rtc_enable_update(void) ...@@ -145,7 +145,7 @@ rtc_enable_update(void)
* just enough code to set the watchdog timer so that it * just enough code to set the watchdog timer so that it
* will reboot the system * will reboot the system
*/ */
void void
ds1511_wdog_set(unsigned long deciseconds) ds1511_wdog_set(unsigned long deciseconds)
{ {
/* /*
...@@ -163,7 +163,7 @@ ds1511_wdog_set(unsigned long deciseconds) ...@@ -163,7 +163,7 @@ ds1511_wdog_set(unsigned long deciseconds)
rtc_write(DS1511_WDE | DS1511_WDS, RTC_CMD); rtc_write(DS1511_WDE | DS1511_WDS, RTC_CMD);
} }
void void
ds1511_wdog_disable(void) ds1511_wdog_disable(void)
{ {
/* /*
...@@ -191,13 +191,12 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) ...@@ -191,13 +191,12 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
/* /*
* won't have to change this for a while * won't have to change this for a while
*/ */
if (rtc_tm->tm_year < 1900) { if (rtc_tm->tm_year < 1900)
rtc_tm->tm_year += 1900; rtc_tm->tm_year += 1900;
}
if (rtc_tm->tm_year < 1970) { if (rtc_tm->tm_year < 1970)
return -EINVAL; return -EINVAL;
}
yrs = rtc_tm->tm_year % 100; yrs = rtc_tm->tm_year % 100;
cen = rtc_tm->tm_year / 100; cen = rtc_tm->tm_year / 100;
mon = rtc_tm->tm_mon + 1; /* tm_mon starts at zero */ mon = rtc_tm->tm_mon + 1; /* tm_mon starts at zero */
...@@ -207,17 +206,14 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) ...@@ -207,17 +206,14 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
min = rtc_tm->tm_min; min = rtc_tm->tm_min;
sec = rtc_tm->tm_sec; sec = rtc_tm->tm_sec;
if ((mon > 12) || (day == 0)) { if ((mon > 12) || (day == 0))
return -EINVAL; return -EINVAL;
}
if (day > rtc_month_days(rtc_tm->tm_mon, rtc_tm->tm_year)) { if (day > rtc_month_days(rtc_tm->tm_mon, rtc_tm->tm_year))
return -EINVAL; return -EINVAL;
}
if ((hrs >= 24) || (min >= 60) || (sec >= 60)) { if ((hrs >= 24) || (min >= 60) || (sec >= 60))
return -EINVAL; return -EINVAL;
}
/* /*
* each register is a different number of valid bits * each register is a different number of valid bits
...@@ -299,7 +295,7 @@ static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) ...@@ -299,7 +295,7 @@ static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm)
* date/hours/mins/secs matches. the ds1511 has many more * date/hours/mins/secs matches. the ds1511 has many more
* permutations, but the kernel doesn't. * permutations, but the kernel doesn't.
*/ */
static void static void
ds1511_rtc_update_alarm(struct rtc_plat_data *pdata) ds1511_rtc_update_alarm(struct rtc_plat_data *pdata)
{ {
unsigned long flags; unsigned long flags;
...@@ -322,7 +318,7 @@ ds1511_rtc_update_alarm(struct rtc_plat_data *pdata) ...@@ -322,7 +318,7 @@ ds1511_rtc_update_alarm(struct rtc_plat_data *pdata)
spin_unlock_irqrestore(&pdata->lock, flags); spin_unlock_irqrestore(&pdata->lock, flags);
} }
static int static int
ds1511_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) ds1511_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
...@@ -335,14 +331,14 @@ ds1511_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -335,14 +331,14 @@ ds1511_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
pdata->alrm_hour = alrm->time.tm_hour; pdata->alrm_hour = alrm->time.tm_hour;
pdata->alrm_min = alrm->time.tm_min; pdata->alrm_min = alrm->time.tm_min;
pdata->alrm_sec = alrm->time.tm_sec; pdata->alrm_sec = alrm->time.tm_sec;
if (alrm->enabled) { if (alrm->enabled)
pdata->irqen |= RTC_AF; pdata->irqen |= RTC_AF;
}
ds1511_rtc_update_alarm(pdata); ds1511_rtc_update_alarm(pdata);
return 0; return 0;
} }
static int static int
ds1511_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) ds1511_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
...@@ -359,7 +355,7 @@ ds1511_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -359,7 +355,7 @@ ds1511_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
return 0; return 0;
} }
static irqreturn_t static irqreturn_t
ds1511_interrupt(int irq, void *dev_id) ds1511_interrupt(int irq, void *dev_id)
{ {
struct platform_device *pdev = dev_id; struct platform_device *pdev = dev_id;
...@@ -406,7 +402,7 @@ static const struct rtc_class_ops ds1511_rtc_ops = { ...@@ -406,7 +402,7 @@ static const struct rtc_class_ops ds1511_rtc_ops = {
.alarm_irq_enable = ds1511_rtc_alarm_irq_enable, .alarm_irq_enable = ds1511_rtc_alarm_irq_enable,
}; };
static ssize_t static ssize_t
ds1511_nvram_read(struct file *filp, struct kobject *kobj, ds1511_nvram_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *ba, struct bin_attribute *ba,
char *buf, loff_t pos, size_t size) char *buf, loff_t pos, size_t size)
...@@ -417,26 +413,26 @@ ds1511_nvram_read(struct file *filp, struct kobject *kobj, ...@@ -417,26 +413,26 @@ ds1511_nvram_read(struct file *filp, struct kobject *kobj,
* if count is more than one, turn on "burst" mode * if count is more than one, turn on "burst" mode
* turn it off when you're done * turn it off when you're done
*/ */
if (size > 1) { if (size > 1)
rtc_write((rtc_read(RTC_CMD) | DS1511_BME), RTC_CMD); rtc_write((rtc_read(RTC_CMD) | DS1511_BME), RTC_CMD);
}
if (pos > DS1511_RAM_MAX) { if (pos > DS1511_RAM_MAX)
pos = DS1511_RAM_MAX; pos = DS1511_RAM_MAX;
}
if (size + pos > DS1511_RAM_MAX + 1) { if (size + pos > DS1511_RAM_MAX + 1)
size = DS1511_RAM_MAX - pos + 1; size = DS1511_RAM_MAX - pos + 1;
}
rtc_write(pos, DS1511_RAMADDR_LSB); rtc_write(pos, DS1511_RAMADDR_LSB);
for (count = 0; size > 0; count++, size--) { for (count = 0; size > 0; count++, size--)
*buf++ = rtc_read(DS1511_RAMDATA); *buf++ = rtc_read(DS1511_RAMDATA);
}
if (count > 1) { if (count > 1)
rtc_write((rtc_read(RTC_CMD) & ~DS1511_BME), RTC_CMD); rtc_write((rtc_read(RTC_CMD) & ~DS1511_BME), RTC_CMD);
}
return count; return count;
} }
static ssize_t static ssize_t
ds1511_nvram_write(struct file *filp, struct kobject *kobj, ds1511_nvram_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size) char *buf, loff_t pos, size_t size)
...@@ -447,22 +443,22 @@ ds1511_nvram_write(struct file *filp, struct kobject *kobj, ...@@ -447,22 +443,22 @@ ds1511_nvram_write(struct file *filp, struct kobject *kobj,
* if count is more than one, turn on "burst" mode * if count is more than one, turn on "burst" mode
* turn it off when you're done * turn it off when you're done
*/ */
if (size > 1) { if (size > 1)
rtc_write((rtc_read(RTC_CMD) | DS1511_BME), RTC_CMD); rtc_write((rtc_read(RTC_CMD) | DS1511_BME), RTC_CMD);
}
if (pos > DS1511_RAM_MAX) { if (pos > DS1511_RAM_MAX)
pos = DS1511_RAM_MAX; pos = DS1511_RAM_MAX;
}
if (size + pos > DS1511_RAM_MAX + 1) { if (size + pos > DS1511_RAM_MAX + 1)
size = DS1511_RAM_MAX - pos + 1; size = DS1511_RAM_MAX - pos + 1;
}
rtc_write(pos, DS1511_RAMADDR_LSB); rtc_write(pos, DS1511_RAMADDR_LSB);
for (count = 0; size > 0; count++, size--) { for (count = 0; size > 0; count++, size--)
rtc_write(*buf++, DS1511_RAMDATA); rtc_write(*buf++, DS1511_RAMDATA);
}
if (count > 1) { if (count > 1)
rtc_write((rtc_read(RTC_CMD) & ~DS1511_BME), RTC_CMD); rtc_write((rtc_read(RTC_CMD) & ~DS1511_BME), RTC_CMD);
}
return count; return count;
} }
...@@ -484,9 +480,9 @@ static int ds1511_rtc_probe(struct platform_device *pdev) ...@@ -484,9 +480,9 @@ static int ds1511_rtc_probe(struct platform_device *pdev)
int ret = 0; int ret = 0;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) { if (!res)
return -ENODEV; return -ENODEV;
}
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
...@@ -518,9 +514,8 @@ static int ds1511_rtc_probe(struct platform_device *pdev) ...@@ -518,9 +514,8 @@ static int ds1511_rtc_probe(struct platform_device *pdev)
/* /*
* check for a dying bat-tree * check for a dying bat-tree
*/ */
if (rtc_read(RTC_CMD1) & DS1511_BLF1) { if (rtc_read(RTC_CMD1) & DS1511_BLF1)
dev_warn(&pdev->dev, "voltage-low detected.\n"); dev_warn(&pdev->dev, "voltage-low detected.\n");
}
spin_lock_init(&pdata->lock); spin_lock_init(&pdata->lock);
platform_set_drvdata(pdev, pdata); platform_set_drvdata(pdev, pdata);
......
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