Commit 40ce972d authored by David Anders's avatar David Anders Committed by Linus Torvalds

rtc: ds1307: comment and format cleanup

Do some cleanup of the comment sections as well as correct some
formatting issues reported by checkpatch.pl.
Signed-off-by: default avatarDavid Anders <x0132446@ti.com>
Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Cc: Austin Boyle <Austin.Boyle@aviatnet.com>
Cc: Alessandro Zummo <alessandro.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b24a7267
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
/* We can't determine type by probing, but if we expect pre-Linux code /*
* We can't determine type by probing, but if we expect pre-Linux code
* to have set the chip up as a clock (turning on the oscillator and * to have set the chip up as a clock (turning on the oscillator and
* setting the date and time), Linux can ignore the non-clock features. * setting the date and time), Linux can ignore the non-clock features.
* That's a natural job for a factory or repair bench. * That's a natural job for a factory or repair bench.
...@@ -37,7 +38,7 @@ enum ds_type { ...@@ -37,7 +38,7 @@ enum ds_type {
mcp7941x, mcp7941x,
rx_8025, rx_8025,
last_ds_type /* always last */ last_ds_type /* always last */
// rs5c372 too? different address... /* rs5c372 too? different address... */
}; };
...@@ -59,7 +60,8 @@ enum ds_type { ...@@ -59,7 +60,8 @@ enum ds_type {
# define DS1337_BIT_CENTURY 0x80 /* in REG_MONTH */ # define DS1337_BIT_CENTURY 0x80 /* in REG_MONTH */
#define DS1307_REG_YEAR 0x06 /* 00-99 */ #define DS1307_REG_YEAR 0x06 /* 00-99 */
/* Other registers (control, status, alarms, trickle charge, NVRAM, etc) /*
* Other registers (control, status, alarms, trickle charge, NVRAM, etc)
* start at 7, and they differ a LOT. Only control and status matter for * start at 7, and they differ a LOT. Only control and status matter for
* basic RTC date and time functionality; be careful using them. * basic RTC date and time functionality; be careful using them.
*/ */
...@@ -366,6 +368,11 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t) ...@@ -366,6 +368,11 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t)
| DS1340_BIT_CENTURY; | DS1340_BIT_CENTURY;
break; break;
case mcp7941x: case mcp7941x:
/*
* these bits were cleared when preparing the date/time
* values and need to be set again before writing the
* buffer out to the device.
*/
buf[DS1307_REG_SECS] |= MCP7941X_BIT_ST; buf[DS1307_REG_SECS] |= MCP7941X_BIT_ST;
buf[DS1307_REG_WDAY] |= MCP7941X_BIT_VBATEN; buf[DS1307_REG_WDAY] |= MCP7941X_BIT_VBATEN;
break; break;
...@@ -411,7 +418,8 @@ static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t) ...@@ -411,7 +418,8 @@ static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t)
ds1307->regs[6], ds1307->regs[7], ds1307->regs[6], ds1307->regs[7],
ds1307->regs[8]); ds1307->regs[8]);
/* report alarm time (ALARM1); assume 24 hour and day-of-month modes, /*
* report alarm time (ALARM1); assume 24 hour and day-of-month modes,
* and that all four fields are checked matches * and that all four fields are checked matches
*/ */
t->time.tm_sec = bcd2bin(ds1307->regs[0] & 0x7f); t->time.tm_sec = bcd2bin(ds1307->regs[0] & 0x7f);
...@@ -602,8 +610,6 @@ static struct bin_attribute nvram = { ...@@ -602,8 +610,6 @@ static struct bin_attribute nvram = {
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
static struct i2c_driver ds1307_driver;
static int __devinit ds1307_probe(struct i2c_client *client, static int __devinit ds1307_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -624,7 +630,8 @@ static int __devinit ds1307_probe(struct i2c_client *client, ...@@ -624,7 +630,8 @@ static int __devinit ds1307_probe(struct i2c_client *client,
&& !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
return -EIO; return -EIO;
if (!(ds1307 = kzalloc(sizeof(struct ds1307), GFP_KERNEL))) ds1307 = kzalloc(sizeof(struct ds1307), GFP_KERNEL);
if (!ds1307)
return -ENOMEM; return -ENOMEM;
i2c_set_clientdata(client, ds1307); i2c_set_clientdata(client, ds1307);
...@@ -659,7 +666,8 @@ static int __devinit ds1307_probe(struct i2c_client *client, ...@@ -659,7 +666,8 @@ static int __devinit ds1307_probe(struct i2c_client *client,
if (ds1307->regs[0] & DS1337_BIT_nEOSC) if (ds1307->regs[0] & DS1337_BIT_nEOSC)
ds1307->regs[0] &= ~DS1337_BIT_nEOSC; ds1307->regs[0] &= ~DS1337_BIT_nEOSC;
/* Using IRQ? Disable the square wave and both alarms. /*
* Using IRQ? Disable the square wave and both alarms.
* For some variants, be sure alarms can trigger when we're * For some variants, be sure alarms can trigger when we're
* running on Vbackup (BBSQI/BBSQW) * running on Vbackup (BBSQI/BBSQW)
*/ */
...@@ -765,7 +773,8 @@ static int __devinit ds1307_probe(struct i2c_client *client, ...@@ -765,7 +773,8 @@ static int __devinit ds1307_probe(struct i2c_client *client,
goto exit_free; goto exit_free;
} }
/* minimal sanity checking; some chips (like DS1340) don't /*
* minimal sanity checking; some chips (like DS1340) don't
* specify the extra bits as must-be-zero, but there are * specify the extra bits as must-be-zero, but there are
* still a few values that are clearly out-of-range. * still a few values that are clearly out-of-range.
*/ */
...@@ -837,7 +846,8 @@ static int __devinit ds1307_probe(struct i2c_client *client, ...@@ -837,7 +846,8 @@ static int __devinit ds1307_probe(struct i2c_client *client,
switch (ds1307->type) { switch (ds1307->type) {
case ds_1340: case ds_1340:
case m41t00: case m41t00:
/* NOTE: ignores century bits; fix before deploying /*
* NOTE: ignores century bits; fix before deploying
* systems that will run through year 2100. * systems that will run through year 2100.
*/ */
break; break;
...@@ -847,7 +857,8 @@ static int __devinit ds1307_probe(struct i2c_client *client, ...@@ -847,7 +857,8 @@ static int __devinit ds1307_probe(struct i2c_client *client,
if (!(tmp & DS1307_BIT_12HR)) if (!(tmp & DS1307_BIT_12HR))
break; break;
/* Be sure we're in 24 hour mode. Multi-master systems /*
* Be sure we're in 24 hour mode. Multi-master systems
* take note... * take note...
*/ */
tmp = bcd2bin(tmp & 0x1f); tmp = bcd2bin(tmp & 0x1f);
......
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