summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Green <evgreen@chromium.org>2019-10-01 13:39:24 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-05 00:47:56 +0000
commit1d82a0592eedcfdaf666111a4ff8e6a9665fa014 (patch)
tree02d30616c04b4e945647dacfb6d254223a593a9f
parent3247d52abeb0ccacc49f0d18dadf47c77f8f0177 (diff)
downloadchrome-ec-1d82a0592eedcfdaf666111a4ff8e6a9665fa014.tar.gz
include: De-longify BIT() macro
The BIT() macro was recently introduced to make things more comfortable to upstream Linux. However, there's no need for it to be a long. Change the macro back to being an int (int and long are the same on 32-bit platforms, which all of our ECs are), so that we can reduce the number of %l specifiers. The semantics of %l have changed, we are deprecating its use on master to reduce the risk that we accidentally cherry-pick one of those printfs to an old firmware branch. BUG=chromium:984041 TEST=make -j buildall BRANCH=None Change-Id: I95b9cd49895cc67998dcb1de9bab5b5591d93243 Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834601 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: caveh jalali <caveh@chromium.org>
-rw-r--r--board/cr50/board.c2
-rw-r--r--board/zinger/usb_pd_policy.c6
-rw-r--r--chip/lm4/i2c.c2
-rw-r--r--chip/mec1322/i2c.c2
-rw-r--r--common/motion_sense.c6
-rw-r--r--driver/accelgyro_bmi160.c2
-rw-r--r--include/compile_time_macros.h2
7 files changed, 11 insertions, 11 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c
index f2b7c7be55..606e8ffb82 100644
--- a/board/cr50/board.c
+++ b/board/cr50/board.c
@@ -1364,7 +1364,7 @@ static uint32_t get_properties(void)
* is no point in checking for a matching config table entry.
* For this case use default properties.
*/
- CPRINTS("Invalid strap pins! Default properties = 0x%lx",
+ CPRINTS("Invalid strap pins! Default properties = 0x%x",
BOARD_PROPERTIES_DEFAULT);
return BOARD_PROPERTIES_DEFAULT;
}
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c
index c18c6073b9..52a87c285b 100644
--- a/board/zinger/usb_pd_policy.c
+++ b/board/zinger/usb_pd_policy.c
@@ -344,7 +344,7 @@ int pd_board_checks(void)
break;
/* trigger the slow OCP iff all 4 samples are above the max */
if (count == 3) {
- debug_printf("OCP %ld mA\n",
+ debug_printf("OCP %d mA\n",
vbus_amp * VDDA_MV / CURR_GAIN * 1000
/ R_SENSE / ADC_SCALE);
pd_log_event(PD_EVENT_PS_FAULT, 0, PS_FAULT_OCP, NULL);
@@ -375,7 +375,7 @@ int pd_board_checks(void)
if ((output_is_enabled() && (vbus_volt > voltages[ovp_idx].ovp)) ||
(fault && (vbus_volt > voltages[ovp_idx].ovp_rec))) {
if (!fault) {
- debug_printf("OVP %ld mV\n",
+ debug_printf("OVP %d mV\n",
ADC_TO_VOLT_MV(vbus_volt));
pd_log_event(PD_EVENT_PS_FAULT, 0, PS_FAULT_OVP, NULL);
}
@@ -395,7 +395,7 @@ int pd_board_checks(void)
discharge_disable();
/* enable over-current monitoring */
adc_enable_watchdog(ADC_CH_A_SENSE, MAX_CURRENT_FAST, 0);
- debug_printf("Disch FAIL %ld mV\n",
+ debug_printf("Disch FAIL %d mV\n",
ADC_TO_VOLT_MV(vbus_volt));
pd_log_event(PD_EVENT_PS_FAULT, 0, PS_FAULT_DISCH, NULL);
fault = FAULT_DISCHARGE;
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index 34e320872c..b95fcba0b0 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -191,7 +191,7 @@ int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags,
(i2c_get_line_levels(port) != I2C_LINE_IDLE))) {
uint32_t tpr = LM4_I2C_MTPR(port);
- CPRINTS("I2C%d Addr:%02X bad status 0x%02x, SCL=%ld, SDA=%ld",
+ CPRINTS("I2C%d Addr:%02X bad status 0x%02x, SCL=%d, SDA=%d",
port,
I2C_GET_ADDR(slave_addr_flags),
reg_mcs,
diff --git a/chip/mec1322/i2c.c b/chip/mec1322/i2c.c
index 5d44f362ea..6a0fa0a5cc 100644
--- a/chip/mec1322/i2c.c
+++ b/chip/mec1322/i2c.c
@@ -265,7 +265,7 @@ int chip_i2c_xfer(const int port,
(((reg & (STS_BER | STS_LAB)) || !(reg & STS_NBB)) ||
(get_line_level(controller)
!= I2C_LINE_IDLE))) {
- CPRINTS("i2c%s bad status 0x%02x, SCL=%ld, SDA=%ld",
+ CPRINTS("i2c%s bad status 0x%02x, SCL=%d, SDA=%d",
i2c_port_names[port], reg,
get_line_level(controller) & I2C_LINE_SCL_HIGH,
get_line_level(controller) & I2C_LINE_SDA_HIGH);
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 73659ab161..ef9cdef185 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -155,11 +155,11 @@ int motion_sense_set_data_rate(struct motion_sensor_t *sensor)
return ret;
#ifdef CONFIG_CONSOLE_VERBOSE
- CPRINTS("%s ODR: %d - roundup %d from config %d [AP %ld]",
+ CPRINTS("%s ODR: %d - roundup %d from config %d [AP %d]",
sensor->name, odr, roundup, config_id,
BASE_ODR(sensor->config[SENSOR_CONFIG_AP].odr));
#else
- CPRINTS("%c%d ODR %d rup %d cfg %d AP %ld",
+ CPRINTS("%c%d ODR %d rup %d cfg %d AP %d",
sensor->name[0], sensor->type, odr, roundup, config_id,
BASE_ODR(sensor->config[SENSOR_CONFIG_AP].odr));
#endif
@@ -1669,7 +1669,7 @@ static int command_display_accel_info(int argc, char **argv)
ccprintf("max_freq: %d\n", motion_sensors[i].max_frequency);
ccprintf("config:\n");
for (j = 0; j < SENSOR_CONFIG_MAX; j++) {
- ccprintf("%d - odr: %lumHz, ec_rate: %uus\n", j,
+ ccprintf("%d - odr: %umHz, ec_rate: %uus\n", j,
motion_sensors[i].config[j].odr &
~ROUND_UP_FLAG,
motion_sensors[i].config[j].ec_rate);
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index 85f8dee7d4..5fd9e3acda 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -961,7 +961,7 @@ static int load_fifo(struct motion_sensor_t *s, uint32_t last_ts)
*/
if (beginning == 0x84848484 ||
(beginning & 0xdcdcdcdc) == 0x40404040) {
- CPRINTS("Suspended FIFO: accel ODR/rate: %ld/%d: 0x%08x",
+ CPRINTS("Suspended FIFO: accel ODR/rate: %d/%d: 0x%08x",
BASE_ODR(s->config[SENSOR_CONFIG_AP].odr),
get_data_rate(s),
beginning);
diff --git a/include/compile_time_macros.h b/include/compile_time_macros.h
index a400736727..8565a3605d 100644
--- a/include/compile_time_macros.h
+++ b/include/compile_time_macros.h
@@ -38,7 +38,7 @@
/*
* Bit operation macros.
*/
-#define BIT(nr) (1UL << (nr))
+#define BIT(nr) (1U << (nr))
#define BIT_ULL(nr) (1ULL << (nr))
#endif /* __CROS_EC_COMPILE_TIME_MACROS_H */