You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/10/02 21:14:07 UTC
[incubator-nuttx] 01/05: bluetooth: Remove the unnecessary cast in btuart driver
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 11d083b35834285dd27d0d7672c4538ba8c41456
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Oct 2 03:23:04 2022 +0800
bluetooth: Remove the unnecessary cast in btuart driver
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
drivers/wireless/bluetooth/bt_uart.c | 19 +++++++------------
drivers/wireless/bluetooth/bt_uart_shim.c | 6 ++----
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/wireless/bluetooth/bt_uart.c b/drivers/wireless/bluetooth/bt_uart.c
index 2d3bbe092e..d0e3a89687 100644
--- a/drivers/wireless/bluetooth/bt_uart.c
+++ b/drivers/wireless/bluetooth/bt_uart.c
@@ -64,8 +64,7 @@ static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper,
ssize_t ntotal = 0;
ssize_t nread;
- wlinfo("buflen %lu minread %lu\n",
- (unsigned long)buflen, (unsigned long)minread);
+ wlinfo("buflen %zu minread %zu\n", buflen, minread);
DEBUGASSERT(upper != NULL && upper->lower != NULL);
lower = upper->lower;
@@ -86,12 +85,11 @@ static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper,
}
else if (nread < 0)
{
- wlwarn("Returned error %d\n", (int)nread);
+ wlwarn("Returned error %zd\n", nread);
return nread;
}
- wlinfo("read %ld remaining %lu\n",
- (long)nread, (unsigned long)(buflen - nread));
+ wlinfo("read %zd remaining %zu\n", nread, buflen - nread);
buflen -= nread;
ntotal += nread;
@@ -124,10 +122,9 @@ static void btuart_rxwork(FAR void *arg)
*/
nread = btuart_read(upper, data, H4_HEADER_SIZE, 0);
- if (nread != 1)
+ if (nread != H4_HEADER_SIZE)
{
- wlwarn("WARNING: Unable to read H4 packet type: %ld\n",
- (long)nread);
+ wlwarn("WARNING: Unable to read H4 packet type: %zd\n", nread);
goto errout_with_busy;
}
@@ -149,8 +146,7 @@ static void btuart_rxwork(FAR void *arg)
hdrlen, hdrlen);
if (nread != hdrlen)
{
- wlwarn("WARNING: Unable to read H4 packet header: %ld\n",
- (long)nread);
+ wlwarn("WARNING: Unable to read H4 packet header: %zd\n", nread);
goto errout_with_busy;
}
@@ -176,8 +172,7 @@ static void btuart_rxwork(FAR void *arg)
pktlen, pktlen);
if (nread != pktlen)
{
- wlwarn("WARNING: Unable to read H4 packet: %ld\n",
- (long)nread);
+ wlwarn("WARNING: Unable to read H4 packet: %zd\n", nread);
goto errout_with_busy;
}
diff --git a/drivers/wireless/bluetooth/bt_uart_shim.c b/drivers/wireless/bluetooth/bt_uart_shim.c
index 40952504f6..4f86131754 100644
--- a/drivers/wireless/bluetooth/bt_uart_shim.c
+++ b/drivers/wireless/bluetooth/bt_uart_shim.c
@@ -241,8 +241,7 @@ hciuart_read(FAR const struct btuart_lowerhalf_s *lower,
FAR struct hciuart_config_s *config = (FAR struct hciuart_config_s *)lower;
FAR struct hciuart_state_s *state = &config->state;
- wlinfo("config %p buffer %p buflen %lu\n",
- config, buffer, (unsigned long)buflen);
+ wlinfo("config %p buffer %p buflen %zu\n", config, buffer, buflen);
/* NOTE: This assumes that the caller has exclusive access to the Rx
* buffer, i.e., one lower half instance can server only one upper half!
@@ -272,8 +271,7 @@ hciuart_write(FAR const struct btuart_lowerhalf_s *lower,
FAR struct hciuart_config_s *config = (FAR struct hciuart_config_s *)lower;
FAR struct hciuart_state_s *state = &config->state;
- wlinfo("config %p buffer %p buflen %lu\n",
- config, buffer, (unsigned long)buflen);
+ wlinfo("config %p buffer %p buflen %zu\n", config, buffer, buflen);
return file_write(&state->f, buffer, buflen);
}