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: Sachin Kamat <sachin.kamat@linaro.org> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
adc7b9b68d
commit
7b2f0053b7
|
@ -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)
|
||||||
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
|
||||||
|
@ -335,9 +331,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -417,22 +413,22 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
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)
|
||||||
/*
|
/*
|
||||||
* 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);
|
||||||
|
|
Loading…
Reference in New Issue