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

rtc: rv3029: Remove some checks and warnings

Remove some checks from checkpatch such as spaces around arithmetic
operations or prefer "unsigned int".
Signed-off-by: default avatarMylène Josserand <mylene.josserand@free-electrons.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent c2a1c145
...@@ -125,7 +125,7 @@ struct rv3029_data { ...@@ -125,7 +125,7 @@ struct rv3029_data {
}; };
static int rv3029_read_regs(struct device *dev, u8 reg, u8 *buf, static int rv3029_read_regs(struct device *dev, u8 reg, u8 *buf,
unsigned len) unsigned int len)
{ {
struct rv3029_data *rv3029 = dev_get_drvdata(dev); struct rv3029_data *rv3029 = dev_get_drvdata(dev);
...@@ -137,7 +137,7 @@ static int rv3029_read_regs(struct device *dev, u8 reg, u8 *buf, ...@@ -137,7 +137,7 @@ static int rv3029_read_regs(struct device *dev, u8 reg, u8 *buf,
} }
static int rv3029_write_regs(struct device *dev, u8 reg, u8 const buf[], static int rv3029_write_regs(struct device *dev, u8 reg, u8 const buf[],
unsigned len) unsigned int len)
{ {
struct rv3029_data *rv3029 = dev_get_drvdata(dev); struct rv3029_data *rv3029 = dev_get_drvdata(dev);
...@@ -347,12 +347,12 @@ static int rv3029_read_time(struct device *dev, struct rtc_time *tm) ...@@ -347,12 +347,12 @@ static int rv3029_read_time(struct device *dev, struct rtc_time *tm)
return ret; return ret;
} }
tm->tm_sec = bcd2bin(regs[RV3029_W_SEC-RV3029_W_SEC]); tm->tm_sec = bcd2bin(regs[RV3029_W_SEC - RV3029_W_SEC]);
tm->tm_min = bcd2bin(regs[RV3029_W_MINUTES-RV3029_W_SEC]); tm->tm_min = bcd2bin(regs[RV3029_W_MINUTES - RV3029_W_SEC]);
/* HR field has a more complex interpretation */ /* HR field has a more complex interpretation */
{ {
const u8 _hr = regs[RV3029_W_HOURS-RV3029_W_SEC]; const u8 _hr = regs[RV3029_W_HOURS - RV3029_W_SEC];
if (_hr & RV3029_REG_HR_12_24) { if (_hr & RV3029_REG_HR_12_24) {
/* 12h format */ /* 12h format */
...@@ -363,10 +363,10 @@ static int rv3029_read_time(struct device *dev, struct rtc_time *tm) ...@@ -363,10 +363,10 @@ static int rv3029_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_hour = bcd2bin(_hr & 0x3f); tm->tm_hour = bcd2bin(_hr & 0x3f);
} }
tm->tm_mday = bcd2bin(regs[RV3029_W_DATE-RV3029_W_SEC]); tm->tm_mday = bcd2bin(regs[RV3029_W_DATE - RV3029_W_SEC]);
tm->tm_mon = bcd2bin(regs[RV3029_W_MONTHS-RV3029_W_SEC]) - 1; tm->tm_mon = bcd2bin(regs[RV3029_W_MONTHS - RV3029_W_SEC]) - 1;
tm->tm_year = bcd2bin(regs[RV3029_W_YEARS-RV3029_W_SEC]) + 100; tm->tm_year = bcd2bin(regs[RV3029_W_YEARS - RV3029_W_SEC]) + 100;
tm->tm_wday = bcd2bin(regs[RV3029_W_DAYS-RV3029_W_SEC]) - 1; tm->tm_wday = bcd2bin(regs[RV3029_W_DAYS - RV3029_W_SEC]) - 1;
return 0; return 0;
} }
...@@ -391,13 +391,13 @@ static int rv3029_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) ...@@ -391,13 +391,13 @@ static int rv3029_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
return ret; return ret;
} }
tm->tm_sec = bcd2bin(regs[RV3029_A_SC-RV3029_A_SC] & 0x7f); tm->tm_sec = bcd2bin(regs[RV3029_A_SC - RV3029_A_SC] & 0x7f);
tm->tm_min = bcd2bin(regs[RV3029_A_MN-RV3029_A_SC] & 0x7f); tm->tm_min = bcd2bin(regs[RV3029_A_MN - RV3029_A_SC] & 0x7f);
tm->tm_hour = bcd2bin(regs[RV3029_A_HR-RV3029_A_SC] & 0x3f); tm->tm_hour = bcd2bin(regs[RV3029_A_HR - RV3029_A_SC] & 0x3f);
tm->tm_mday = bcd2bin(regs[RV3029_A_DT-RV3029_A_SC] & 0x3f); tm->tm_mday = bcd2bin(regs[RV3029_A_DT - RV3029_A_SC] & 0x3f);
tm->tm_mon = bcd2bin(regs[RV3029_A_MO-RV3029_A_SC] & 0x1f) - 1; tm->tm_mon = bcd2bin(regs[RV3029_A_MO - RV3029_A_SC] & 0x1f) - 1;
tm->tm_year = bcd2bin(regs[RV3029_A_YR-RV3029_A_SC] & 0x7f) + 100; tm->tm_year = bcd2bin(regs[RV3029_A_YR - RV3029_A_SC] & 0x7f) + 100;
tm->tm_wday = bcd2bin(regs[RV3029_A_DW-RV3029_A_SC] & 0x07) - 1; tm->tm_wday = bcd2bin(regs[RV3029_A_DW - RV3029_A_SC] & 0x07) - 1;
return 0; return 0;
} }
...@@ -436,13 +436,13 @@ static int rv3029_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) ...@@ -436,13 +436,13 @@ static int rv3029_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
dev_err(dev, "%s: reading SR failed\n", __func__); dev_err(dev, "%s: reading SR failed\n", __func__);
return -EIO; return -EIO;
} }
regs[RV3029_A_SC-RV3029_A_SC] = bin2bcd(tm->tm_sec & 0x7f); regs[RV3029_A_SC - RV3029_A_SC] = bin2bcd(tm->tm_sec & 0x7f);
regs[RV3029_A_MN-RV3029_A_SC] = bin2bcd(tm->tm_min & 0x7f); regs[RV3029_A_MN - RV3029_A_SC] = bin2bcd(tm->tm_min & 0x7f);
regs[RV3029_A_HR-RV3029_A_SC] = bin2bcd(tm->tm_hour & 0x3f); regs[RV3029_A_HR - RV3029_A_SC] = bin2bcd(tm->tm_hour & 0x3f);
regs[RV3029_A_DT-RV3029_A_SC] = bin2bcd(tm->tm_mday & 0x3f); regs[RV3029_A_DT - RV3029_A_SC] = bin2bcd(tm->tm_mday & 0x3f);
regs[RV3029_A_MO-RV3029_A_SC] = bin2bcd((tm->tm_mon & 0x1f) - 1); regs[RV3029_A_MO - RV3029_A_SC] = bin2bcd((tm->tm_mon & 0x1f) - 1);
regs[RV3029_A_DW-RV3029_A_SC] = bin2bcd((tm->tm_wday & 7) - 1); regs[RV3029_A_DW - RV3029_A_SC] = bin2bcd((tm->tm_wday & 7) - 1);
regs[RV3029_A_YR-RV3029_A_SC] = bin2bcd((tm->tm_year & 0x7f) - 100); regs[RV3029_A_YR - RV3029_A_SC] = bin2bcd((tm->tm_year & 0x7f) - 100);
ret = rv3029_write_regs(dev, RV3029_A_SC, regs, ret = rv3029_write_regs(dev, RV3029_A_SC, regs,
RV3029_ALARM_SECTION_LEN); RV3029_ALARM_SECTION_LEN);
...@@ -488,13 +488,13 @@ static int rv3029_set_time(struct device *dev, struct rtc_time *tm) ...@@ -488,13 +488,13 @@ static int rv3029_set_time(struct device *dev, struct rtc_time *tm)
if (tm->tm_year < 100) if (tm->tm_year < 100)
return -EINVAL; return -EINVAL;
regs[RV3029_W_SEC-RV3029_W_SEC] = bin2bcd(tm->tm_sec); regs[RV3029_W_SEC - RV3029_W_SEC] = bin2bcd(tm->tm_sec);
regs[RV3029_W_MINUTES-RV3029_W_SEC] = bin2bcd(tm->tm_min); regs[RV3029_W_MINUTES - RV3029_W_SEC] = bin2bcd(tm->tm_min);
regs[RV3029_W_HOURS-RV3029_W_SEC] = bin2bcd(tm->tm_hour); regs[RV3029_W_HOURS - RV3029_W_SEC] = bin2bcd(tm->tm_hour);
regs[RV3029_W_DATE-RV3029_W_SEC] = bin2bcd(tm->tm_mday); regs[RV3029_W_DATE - RV3029_W_SEC] = bin2bcd(tm->tm_mday);
regs[RV3029_W_MONTHS-RV3029_W_SEC] = bin2bcd(tm->tm_mon+1); regs[RV3029_W_MONTHS - RV3029_W_SEC] = bin2bcd(tm->tm_mon + 1);
regs[RV3029_W_DAYS-RV3029_W_SEC] = bin2bcd((tm->tm_wday & 7)+1); regs[RV3029_W_DAYS - RV3029_W_SEC] = bin2bcd((tm->tm_wday & 7) + 1);
regs[RV3029_W_YEARS-RV3029_W_SEC] = bin2bcd(tm->tm_year - 100); regs[RV3029_W_YEARS - RV3029_W_SEC] = bin2bcd(tm->tm_year - 100);
ret = rv3029_write_regs(dev, RV3029_W_SEC, regs, ret = rv3029_write_regs(dev, RV3029_W_SEC, regs,
RV3029_WATCH_SECTION_LEN); RV3029_WATCH_SECTION_LEN);
...@@ -515,6 +515,7 @@ static int rv3029_set_time(struct device *dev, struct rtc_time *tm) ...@@ -515,6 +515,7 @@ static int rv3029_set_time(struct device *dev, struct rtc_time *tm)
return 0; return 0;
} }
static const struct rv3029_trickle_tab_elem { static const struct rv3029_trickle_tab_elem {
u32 r; /* resistance in ohms */ u32 r; /* resistance in ohms */
u8 conf; /* trickle config bits */ u8 conf; /* trickle config bits */
...@@ -603,9 +604,8 @@ static void rv3029_trickle_config(struct device *dev) ...@@ -603,9 +604,8 @@ static void rv3029_trickle_config(struct device *dev)
err = rv3029_eeprom_update_bits(dev, RV3029_CONTROL_E2P_EECTRL, err = rv3029_eeprom_update_bits(dev, RV3029_CONTROL_E2P_EECTRL,
RV3029_TRICKLE_MASK, RV3029_TRICKLE_MASK,
trickle_set_bits); trickle_set_bits);
if (err < 0) { if (err < 0)
dev_err(dev, "Failed to update trickle charger config\n"); dev_err(dev, "Failed to update trickle charger config\n");
}
} }
#ifdef CONFIG_RTC_DRV_RV3029_HWMON #ifdef CONFIG_RTC_DRV_RV3029_HWMON
......
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