Commit fc99b901 authored by Mylène Josserand's avatar Mylène Josserand Committed by Alexandre Belloni

rtc: m41t80: remove warnings and replace obsolete function

Replace the obsolete "simple_strtoul" function to "kstrtoul".
Remove some checkpatch's errors, warnings and checks :
   - alignment with open parenthesis
   - spaces around '<' and '<<'
   - blank line after structure
   - quoted string split across lines
Signed-off-by: default avatarMylène Josserand <mylene.josserand@free-electrons.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 54339f3b
...@@ -226,7 +226,11 @@ static ssize_t sqwfreq_store(struct device *dev, ...@@ -226,7 +226,11 @@ static ssize_t sqwfreq_store(struct device *dev,
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct m41t80_data *clientdata = i2c_get_clientdata(client); struct m41t80_data *clientdata = i2c_get_clientdata(client);
int almon, sqw, reg_sqw, rc; int almon, sqw, reg_sqw, rc;
int val = simple_strtoul(buf, NULL, 0); unsigned long val;
rc = kstrtoul(buf, 0, &val);
if (rc < 0)
return rc;
if (!(clientdata->features & M41T80_FEATURE_SQ)) if (!(clientdata->features & M41T80_FEATURE_SQ))
return -EINVAL; return -EINVAL;
...@@ -266,7 +270,7 @@ static ssize_t sqwfreq_store(struct device *dev, ...@@ -266,7 +270,7 @@ static ssize_t sqwfreq_store(struct device *dev,
rc = i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, rc = i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON,
almon | M41T80_ALMON_SQWE); almon | M41T80_ALMON_SQWE);
if (rc <0) if (rc < 0)
return rc; return rc;
} }
return count; return count;
...@@ -278,6 +282,7 @@ static struct attribute *attrs[] = { ...@@ -278,6 +282,7 @@ static struct attribute *attrs[] = {
&dev_attr_sqwfreq.attr, &dev_attr_sqwfreq.attr,
NULL, NULL,
}; };
static struct attribute_group attr_group = { static struct attribute_group attr_group = {
.attrs = attrs, .attrs = attrs,
}; };
...@@ -329,7 +334,7 @@ static void wdt_ping(void) ...@@ -329,7 +334,7 @@ static void wdt_ping(void)
/* /*
* WDS = 1 (0x80), mulitplier = WD_TIMO, resolution = 1s (0x02) * WDS = 1 (0x80), mulitplier = WD_TIMO, resolution = 1s (0x02)
*/ */
i2c_data[1] = wdt_margin<<2 | 0x82; i2c_data[1] = wdt_margin << 2 | 0x82;
/* /*
* M41T65 has three bits for watchdog resolution. Don't set bit 7, as * M41T65 has three bits for watchdog resolution. Don't set bit 7, as
...@@ -617,8 +622,7 @@ static int m41t80_probe(struct i2c_client *client, ...@@ -617,8 +622,7 @@ static int m41t80_probe(struct i2c_client *client,
m41t80_get_datetime(client, &tm); m41t80_get_datetime(client, &tm);
dev_info(&client->dev, "HT bit was set!\n"); dev_info(&client->dev, "HT bit was set!\n");
dev_info(&client->dev, dev_info(&client->dev,
"Power Down at " "Power Down at %04i-%02i-%02i %02i:%02i:%02i\n",
"%04i-%02i-%02i %02i:%02i:%02i\n",
tm.tm_year + 1900, tm.tm_year + 1900,
tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
tm.tm_min, tm.tm_sec); tm.tm_min, tm.tm_sec);
......
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