diff options
| author | dongly <[email protected]> | 2022-08-03 00:09:49 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-08-02 12:09:49 -0400 |
| commit | 3363586cbbf507937a6be74397f4ffd5c6966fe5 (patch) | |
| tree | 8eaac87aa11b72c93a96b128d5a15134f097e95d /components/drivers | |
| parent | 7882e42c614c24a1750cba4a3e2936b6bf68f42f (diff) | |
Fix some compilation warning (#5744)
* Fix some compilation warning
* 补充修正一些数据类型的使用错误
Co-authored-by: Meco Man <[email protected]>
Diffstat (limited to 'components/drivers')
| -rw-r--r-- | components/drivers/i2c/i2c-bit-ops.c | 6 | ||||
| -rw-r--r-- | components/drivers/i2c/i2c_core.c | 6 | ||||
| -rw-r--r-- | components/drivers/serial/serial.c | 10 |
3 files changed, 13 insertions, 9 deletions
diff --git a/components/drivers/i2c/i2c-bit-ops.c b/components/drivers/i2c/i2c-bit-ops.c index ae1f4db9c0..08fa5a836c 100644 --- a/components/drivers/i2c/i2c-bit-ops.c +++ b/components/drivers/i2c/i2c-bit-ops.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -404,7 +404,9 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, { ret = i2c_recv_bytes(bus, msg); if (ret >= 1) + { LOG_D("read %d byte%s", ret, ret == 1 ? "" : "s"); + } if (ret < msg->len) { if (ret >= 0) @@ -416,7 +418,9 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, { ret = i2c_send_bytes(bus, msg); if (ret >= 1) + { LOG_D("write %d byte%s", ret, ret == 1 ? "" : "s"); + } if (ret < msg->len) { if (ret >= 0) diff --git a/components/drivers/i2c/i2c_core.c b/components/drivers/i2c/i2c_core.c index c629765f65..39147be605 100644 --- a/components/drivers/i2c/i2c_core.c +++ b/components/drivers/i2c/i2c_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -108,7 +108,7 @@ rt_size_t rt_i2c_master_send(struct rt_i2c_bus_device *bus, const rt_uint8_t *buf, rt_uint32_t count) { - rt_err_t ret; + rt_size_t ret; struct rt_i2c_msg msg; msg.addr = addr; @@ -127,7 +127,7 @@ rt_size_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus, rt_uint8_t *buf, rt_uint32_t count) { - rt_err_t ret; + rt_size_t ret; struct rt_i2c_msg msg; RT_ASSERT(bus != RT_NULL); diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index d39acb298f..00d6671f37 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -200,7 +200,7 @@ static int serial_fops_poll(struct dfs_fd *fd, struct rt_pollreq *req) return mask; } -const static struct dfs_file_ops _serial_fops = +static const struct dfs_file_ops _serial_fops = { serial_fops_open, serial_fops_close, @@ -900,7 +900,7 @@ struct speed_baudrate_item int baudrate; }; -const static struct speed_baudrate_item _tbl[] = +static const struct speed_baudrate_item _tbl[] = { {B2400, BAUD_RATE_2400}, {B4800, BAUD_RATE_4800}, @@ -918,7 +918,7 @@ const static struct speed_baudrate_item _tbl[] = static speed_t _get_speed(int baudrate) { - int index; + size_t index; for (index = 0; index < sizeof(_tbl)/sizeof(_tbl[0]); index ++) { @@ -931,7 +931,7 @@ static speed_t _get_speed(int baudrate) static int _get_baudrate(speed_t speed) { - int index; + size_t index; for (index = 0; index < sizeof(_tbl)/sizeof(_tbl[0]); index ++) { |
