drivers: Replace printf by printk when applicable

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
This commit is contained in:
Xavier Chapron 2020-05-07 12:07:22 +02:00 committed by Carles Cufí
commit 2a8ff02ef2
6 changed files with 23 additions and 23 deletions

View file

@ -338,7 +338,7 @@ static u8_t *recv_cb(u8_t *buf, size_t *off)
while (bytes && buf) {
char msg[8 + 1];
snprintf(msg, sizeof(msg),
snprintk(msg, sizeof(msg),
">slip %2d", count);
LOG_HEXDUMP_DBG(buf->data, buf->len,

View file

@ -114,7 +114,7 @@ static inline void eswifi_unlock(struct eswifi_dev *eswifi)
int eswifi_at_cmd(struct eswifi_dev *eswifi, char *cmd);
static inline int __select_socket(struct eswifi_dev *eswifi, u8_t idx)
{
snprintf(eswifi->buf, sizeof(eswifi->buf), "P0=%d\r", idx);
snprintk(eswifi->buf, sizeof(eswifi->buf), "P0=%d\r", idx);
return eswifi_at_cmd(eswifi, eswifi->buf);
}

View file

@ -250,7 +250,7 @@ static int eswifi_connect(struct eswifi_dev *eswifi)
eswifi_lock(eswifi);
/* Set SSID */
snprintf(eswifi->buf, sizeof(eswifi->buf), "C1=%s\r", eswifi->sta.ssid);
snprintk(eswifi->buf, sizeof(eswifi->buf), "C1=%s\r", eswifi->sta.ssid);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
LOG_ERR("Unable to set SSID");
@ -258,7 +258,7 @@ static int eswifi_connect(struct eswifi_dev *eswifi)
}
/* Set passphrase */
snprintf(eswifi->buf, sizeof(eswifi->buf), "C2=%s\r", eswifi->sta.pass);
snprintk(eswifi->buf, sizeof(eswifi->buf), "C2=%s\r", eswifi->sta.pass);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
LOG_ERR("Unable to set passphrase");
@ -266,7 +266,7 @@ static int eswifi_connect(struct eswifi_dev *eswifi)
}
/* Set Security type */
snprintf(eswifi->buf, sizeof(eswifi->buf), "C3=%u\r",
snprintk(eswifi->buf, sizeof(eswifi->buf), "C3=%u\r",
eswifi->sta.security);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
@ -525,7 +525,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
}
/* security */
snprintf(eswifi->buf, sizeof(eswifi->buf), "A1=%u\r",
snprintk(eswifi->buf, sizeof(eswifi->buf), "A1=%u\r",
eswifi->sta.security);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
@ -535,7 +535,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
/* Passkey */
if (eswifi->sta.security != ESWIFI_SEC_OPEN) {
snprintf(eswifi->buf, sizeof(eswifi->buf), "A2=%s\r",
snprintk(eswifi->buf, sizeof(eswifi->buf), "A2=%s\r",
eswifi->sta.pass);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
@ -545,7 +545,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
}
/* Set SSID (0=no MAC, 1=append MAC) */
snprintf(eswifi->buf, sizeof(eswifi->buf), "AS=0,%s\r",
snprintk(eswifi->buf, sizeof(eswifi->buf), "AS=0,%s\r",
eswifi->sta.ssid);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
@ -554,7 +554,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
}
/* Set Channel */
snprintf(eswifi->buf, sizeof(eswifi->buf), "AC=%u\r",
snprintk(eswifi->buf, sizeof(eswifi->buf), "AC=%u\r",
eswifi->sta.channel);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
@ -576,7 +576,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
goto error;
}
snprintf(eswifi->buf, sizeof(eswifi->buf), "Z6=%s\r",
snprintk(eswifi->buf, sizeof(eswifi->buf), "Z6=%s\r",
net_sprint_ipv4_addr(&unicast->address.in_addr));
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
@ -585,7 +585,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
}
/* Enable AP */
snprintf(eswifi->buf, sizeof(eswifi->buf), "AD\r");
snprintk(eswifi->buf, sizeof(eswifi->buf), "AD\r");
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
LOG_ERR("Unable to active access point");

View file

@ -50,7 +50,7 @@ static int eswifi_off_listen(struct net_context *context, int backlog)
__select_socket(eswifi, socket->index);
/* Set backlog */
snprintf(eswifi->buf, sizeof(eswifi->buf), "P8=%d\r", backlog);
snprintk(eswifi->buf, sizeof(eswifi->buf), "P8=%d\r", backlog);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
LOG_ERR("Unable to start set listen backlog");
@ -196,7 +196,7 @@ static int __eswifi_off_send_pkt(struct eswifi_dev *eswifi,
__select_socket(eswifi, socket->index);
/* header */
snprintf(eswifi->buf, sizeof(eswifi->buf), "S3=%u\r", bytes);
snprintk(eswifi->buf, sizeof(eswifi->buf), "S3=%u\r", bytes);
offset = strlen(eswifi->buf);
/* copy payload */

View file

@ -41,7 +41,7 @@ static int __read_data(struct eswifi_dev *eswifi, size_t len, char **data)
int ret;
/* Set max read size */
snprintf(size, sizeof(size), "R1=%u\r", len);
snprintk(size, sizeof(size), "R1=%u\r", len);
ret = eswifi_at_cmd(eswifi, size);
if (ret < 0) {
LOG_ERR("Unable to set read size");
@ -49,7 +49,7 @@ static int __read_data(struct eswifi_dev *eswifi, size_t len, char **data)
}
/* Set timeout */
snprintf(timeout, sizeof(timeout), "R2=%u\r", 30); /* 30 ms */
snprintk(timeout, sizeof(timeout), "R2=%u\r", 30); /* 30 ms */
ret = eswifi_at_cmd(eswifi, timeout);
if (ret < 0) {
LOG_ERR("Unable to set timeout");
@ -73,7 +73,7 @@ int __eswifi_bind(struct eswifi_dev *eswifi, struct eswifi_off_socket *socket,
socket->port = sys_be16_to_cpu(net_sin(addr)->sin_port);
/* Set Local Port */
snprintf(eswifi->buf, sizeof(eswifi->buf), "P2=%d\r", socket->port);
snprintk(eswifi->buf, sizeof(eswifi->buf), "P2=%d\r", socket->port);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
LOG_ERR("Unable to set local port");
@ -161,7 +161,7 @@ int __eswifi_off_start_client(struct eswifi_dev *eswifi,
__select_socket(eswifi, socket->index);
/* Set Remote IP */
snprintf(eswifi->buf, sizeof(eswifi->buf), "P3=%u.%u.%u.%u\r",
snprintk(eswifi->buf, sizeof(eswifi->buf), "P3=%u.%u.%u.%u\r",
sin_addr->s4_addr[0], sin_addr->s4_addr[1],
sin_addr->s4_addr[2], sin_addr->s4_addr[3]);
@ -172,7 +172,7 @@ int __eswifi_off_start_client(struct eswifi_dev *eswifi,
}
/* Set Remote Port */
snprintf(eswifi->buf, sizeof(eswifi->buf), "P4=%d\r",
snprintk(eswifi->buf, sizeof(eswifi->buf), "P4=%d\r",
(u16_t)sys_be16_to_cpu(net_sin(addr)->sin_port));
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
@ -181,7 +181,7 @@ int __eswifi_off_start_client(struct eswifi_dev *eswifi,
}
/* Start TCP/UDP client */
snprintf(eswifi->buf, sizeof(eswifi->buf), "P6=1\r");
snprintk(eswifi->buf, sizeof(eswifi->buf), "P6=1\r");
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
LOG_ERR("Unable to start TCP/UDP client");
@ -277,7 +277,7 @@ int __eswifi_socket_new(struct eswifi_dev *eswifi, int family, int type,
return -EIO;
}
snprintf(eswifi->buf, sizeof(eswifi->buf), "P1=%d\r", socket->type);
snprintk(eswifi->buf, sizeof(eswifi->buf), "P1=%d\r", socket->type);
err = eswifi_at_cmd(eswifi, eswifi->buf);
if (err < 0) {
LOG_ERR("Unable to set transport protocol");

View file

@ -171,7 +171,7 @@ static int map_credentials(int sd, const void *optval, socklen_t optlen)
return -EINVAL;
}
snprintf(eswifi->buf, sizeof(eswifi->buf),
snprintk(eswifi->buf, sizeof(eswifi->buf),
"PG=%d,%d,%d\r", 0, id, cert->len);
bytes = strlen(eswifi->buf);
memcpy(&eswifi->buf[bytes], cert->buf, cert->len);
@ -184,7 +184,7 @@ static int map_credentials(int sd, const void *optval, socklen_t optlen)
return ret;
}
snprintf(eswifi->buf, sizeof(eswifi->buf), "PF=0,0\r");
snprintk(eswifi->buf, sizeof(eswifi->buf), "PF=0,0\r");
ret = eswifi_at_cmd(eswifi, eswifi->buf);
if (ret < 0) {
return ret;
@ -251,7 +251,7 @@ static ssize_t eswifi_socket_send(void *obj, const void *buf, size_t len,
__select_socket(eswifi, socket->index);
/* header */
snprintf(eswifi->buf, sizeof(eswifi->buf), "S3=%u\r", len);
snprintk(eswifi->buf, sizeof(eswifi->buf), "S3=%u\r", len);
offset = strlen(eswifi->buf);
/* copy payload */