Skip to content

Commit 2a8ff02

Browse files
Xavier Chaproncarlescufi
authored andcommitted
drivers: Replace printf by printk when applicable
Signed-off-by: Xavier Chapron <[email protected]>
1 parent c26b7c8 commit 2a8ff02

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

drivers/net/slip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static u8_t *recv_cb(u8_t *buf, size_t *off)
338338
while (bytes && buf) {
339339
char msg[8 + 1];
340340

341-
snprintf(msg, sizeof(msg),
341+
snprintk(msg, sizeof(msg),
342342
">slip %2d", count);
343343

344344
LOG_HEXDUMP_DBG(buf->data, buf->len,

drivers/wifi/eswifi/eswifi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static inline void eswifi_unlock(struct eswifi_dev *eswifi)
114114
int eswifi_at_cmd(struct eswifi_dev *eswifi, char *cmd);
115115
static inline int __select_socket(struct eswifi_dev *eswifi, u8_t idx)
116116
{
117-
snprintf(eswifi->buf, sizeof(eswifi->buf), "P0=%d\r", idx);
117+
snprintk(eswifi->buf, sizeof(eswifi->buf), "P0=%d\r", idx);
118118
return eswifi_at_cmd(eswifi, eswifi->buf);
119119
}
120120

drivers/wifi/eswifi/eswifi_core.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,23 +250,23 @@ static int eswifi_connect(struct eswifi_dev *eswifi)
250250
eswifi_lock(eswifi);
251251

252252
/* Set SSID */
253-
snprintf(eswifi->buf, sizeof(eswifi->buf), "C1=%s\r", eswifi->sta.ssid);
253+
snprintk(eswifi->buf, sizeof(eswifi->buf), "C1=%s\r", eswifi->sta.ssid);
254254
err = eswifi_at_cmd(eswifi, eswifi->buf);
255255
if (err < 0) {
256256
LOG_ERR("Unable to set SSID");
257257
goto error;
258258
}
259259

260260
/* Set passphrase */
261-
snprintf(eswifi->buf, sizeof(eswifi->buf), "C2=%s\r", eswifi->sta.pass);
261+
snprintk(eswifi->buf, sizeof(eswifi->buf), "C2=%s\r", eswifi->sta.pass);
262262
err = eswifi_at_cmd(eswifi, eswifi->buf);
263263
if (err < 0) {
264264
LOG_ERR("Unable to set passphrase");
265265
goto error;
266266
}
267267

268268
/* Set Security type */
269-
snprintf(eswifi->buf, sizeof(eswifi->buf), "C3=%u\r",
269+
snprintk(eswifi->buf, sizeof(eswifi->buf), "C3=%u\r",
270270
eswifi->sta.security);
271271
err = eswifi_at_cmd(eswifi, eswifi->buf);
272272
if (err < 0) {
@@ -525,7 +525,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
525525
}
526526

527527
/* security */
528-
snprintf(eswifi->buf, sizeof(eswifi->buf), "A1=%u\r",
528+
snprintk(eswifi->buf, sizeof(eswifi->buf), "A1=%u\r",
529529
eswifi->sta.security);
530530
err = eswifi_at_cmd(eswifi, eswifi->buf);
531531
if (err < 0) {
@@ -535,7 +535,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
535535

536536
/* Passkey */
537537
if (eswifi->sta.security != ESWIFI_SEC_OPEN) {
538-
snprintf(eswifi->buf, sizeof(eswifi->buf), "A2=%s\r",
538+
snprintk(eswifi->buf, sizeof(eswifi->buf), "A2=%s\r",
539539
eswifi->sta.pass);
540540
err = eswifi_at_cmd(eswifi, eswifi->buf);
541541
if (err < 0) {
@@ -545,7 +545,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
545545
}
546546

547547
/* Set SSID (0=no MAC, 1=append MAC) */
548-
snprintf(eswifi->buf, sizeof(eswifi->buf), "AS=0,%s\r",
548+
snprintk(eswifi->buf, sizeof(eswifi->buf), "AS=0,%s\r",
549549
eswifi->sta.ssid);
550550
err = eswifi_at_cmd(eswifi, eswifi->buf);
551551
if (err < 0) {
@@ -554,7 +554,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
554554
}
555555

556556
/* Set Channel */
557-
snprintf(eswifi->buf, sizeof(eswifi->buf), "AC=%u\r",
557+
snprintk(eswifi->buf, sizeof(eswifi->buf), "AC=%u\r",
558558
eswifi->sta.channel);
559559
err = eswifi_at_cmd(eswifi, eswifi->buf);
560560
if (err < 0) {
@@ -576,7 +576,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
576576
goto error;
577577
}
578578

579-
snprintf(eswifi->buf, sizeof(eswifi->buf), "Z6=%s\r",
579+
snprintk(eswifi->buf, sizeof(eswifi->buf), "Z6=%s\r",
580580
net_sprint_ipv4_addr(&unicast->address.in_addr));
581581
err = eswifi_at_cmd(eswifi, eswifi->buf);
582582
if (err < 0) {
@@ -585,7 +585,7 @@ static int eswifi_mgmt_ap_enable(struct device *dev,
585585
}
586586

587587
/* Enable AP */
588-
snprintf(eswifi->buf, sizeof(eswifi->buf), "AD\r");
588+
snprintk(eswifi->buf, sizeof(eswifi->buf), "AD\r");
589589
err = eswifi_at_cmd(eswifi, eswifi->buf);
590590
if (err < 0) {
591591
LOG_ERR("Unable to active access point");

drivers/wifi/eswifi/eswifi_offload.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static int eswifi_off_listen(struct net_context *context, int backlog)
5050
__select_socket(eswifi, socket->index);
5151

5252
/* Set backlog */
53-
snprintf(eswifi->buf, sizeof(eswifi->buf), "P8=%d\r", backlog);
53+
snprintk(eswifi->buf, sizeof(eswifi->buf), "P8=%d\r", backlog);
5454
err = eswifi_at_cmd(eswifi, eswifi->buf);
5555
if (err < 0) {
5656
LOG_ERR("Unable to start set listen backlog");
@@ -196,7 +196,7 @@ static int __eswifi_off_send_pkt(struct eswifi_dev *eswifi,
196196
__select_socket(eswifi, socket->index);
197197

198198
/* header */
199-
snprintf(eswifi->buf, sizeof(eswifi->buf), "S3=%u\r", bytes);
199+
snprintk(eswifi->buf, sizeof(eswifi->buf), "S3=%u\r", bytes);
200200
offset = strlen(eswifi->buf);
201201

202202
/* copy payload */

drivers/wifi/eswifi/eswifi_socket.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ static int __read_data(struct eswifi_dev *eswifi, size_t len, char **data)
4141
int ret;
4242

4343
/* Set max read size */
44-
snprintf(size, sizeof(size), "R1=%u\r", len);
44+
snprintk(size, sizeof(size), "R1=%u\r", len);
4545
ret = eswifi_at_cmd(eswifi, size);
4646
if (ret < 0) {
4747
LOG_ERR("Unable to set read size");
4848
return -EIO;
4949
}
5050

5151
/* Set timeout */
52-
snprintf(timeout, sizeof(timeout), "R2=%u\r", 30); /* 30 ms */
52+
snprintk(timeout, sizeof(timeout), "R2=%u\r", 30); /* 30 ms */
5353
ret = eswifi_at_cmd(eswifi, timeout);
5454
if (ret < 0) {
5555
LOG_ERR("Unable to set timeout");
@@ -73,7 +73,7 @@ int __eswifi_bind(struct eswifi_dev *eswifi, struct eswifi_off_socket *socket,
7373
socket->port = sys_be16_to_cpu(net_sin(addr)->sin_port);
7474

7575
/* Set Local Port */
76-
snprintf(eswifi->buf, sizeof(eswifi->buf), "P2=%d\r", socket->port);
76+
snprintk(eswifi->buf, sizeof(eswifi->buf), "P2=%d\r", socket->port);
7777
err = eswifi_at_cmd(eswifi, eswifi->buf);
7878
if (err < 0) {
7979
LOG_ERR("Unable to set local port");
@@ -161,7 +161,7 @@ int __eswifi_off_start_client(struct eswifi_dev *eswifi,
161161
__select_socket(eswifi, socket->index);
162162

163163
/* Set Remote IP */
164-
snprintf(eswifi->buf, sizeof(eswifi->buf), "P3=%u.%u.%u.%u\r",
164+
snprintk(eswifi->buf, sizeof(eswifi->buf), "P3=%u.%u.%u.%u\r",
165165
sin_addr->s4_addr[0], sin_addr->s4_addr[1],
166166
sin_addr->s4_addr[2], sin_addr->s4_addr[3]);
167167

@@ -172,7 +172,7 @@ int __eswifi_off_start_client(struct eswifi_dev *eswifi,
172172
}
173173

174174
/* Set Remote Port */
175-
snprintf(eswifi->buf, sizeof(eswifi->buf), "P4=%d\r",
175+
snprintk(eswifi->buf, sizeof(eswifi->buf), "P4=%d\r",
176176
(u16_t)sys_be16_to_cpu(net_sin(addr)->sin_port));
177177
err = eswifi_at_cmd(eswifi, eswifi->buf);
178178
if (err < 0) {
@@ -181,7 +181,7 @@ int __eswifi_off_start_client(struct eswifi_dev *eswifi,
181181
}
182182

183183
/* Start TCP/UDP client */
184-
snprintf(eswifi->buf, sizeof(eswifi->buf), "P6=1\r");
184+
snprintk(eswifi->buf, sizeof(eswifi->buf), "P6=1\r");
185185
err = eswifi_at_cmd(eswifi, eswifi->buf);
186186
if (err < 0) {
187187
LOG_ERR("Unable to start TCP/UDP client");
@@ -277,7 +277,7 @@ int __eswifi_socket_new(struct eswifi_dev *eswifi, int family, int type,
277277
return -EIO;
278278
}
279279

280-
snprintf(eswifi->buf, sizeof(eswifi->buf), "P1=%d\r", socket->type);
280+
snprintk(eswifi->buf, sizeof(eswifi->buf), "P1=%d\r", socket->type);
281281
err = eswifi_at_cmd(eswifi, eswifi->buf);
282282
if (err < 0) {
283283
LOG_ERR("Unable to set transport protocol");

drivers/wifi/eswifi/eswifi_socket_offload.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static int map_credentials(int sd, const void *optval, socklen_t optlen)
171171
return -EINVAL;
172172
}
173173

174-
snprintf(eswifi->buf, sizeof(eswifi->buf),
174+
snprintk(eswifi->buf, sizeof(eswifi->buf),
175175
"PG=%d,%d,%d\r", 0, id, cert->len);
176176
bytes = strlen(eswifi->buf);
177177
memcpy(&eswifi->buf[bytes], cert->buf, cert->len);
@@ -184,7 +184,7 @@ static int map_credentials(int sd, const void *optval, socklen_t optlen)
184184
return ret;
185185
}
186186

187-
snprintf(eswifi->buf, sizeof(eswifi->buf), "PF=0,0\r");
187+
snprintk(eswifi->buf, sizeof(eswifi->buf), "PF=0,0\r");
188188
ret = eswifi_at_cmd(eswifi, eswifi->buf);
189189
if (ret < 0) {
190190
return ret;
@@ -251,7 +251,7 @@ static ssize_t eswifi_socket_send(void *obj, const void *buf, size_t len,
251251
__select_socket(eswifi, socket->index);
252252

253253
/* header */
254-
snprintf(eswifi->buf, sizeof(eswifi->buf), "S3=%u\r", len);
254+
snprintk(eswifi->buf, sizeof(eswifi->buf), "S3=%u\r", len);
255255
offset = strlen(eswifi->buf);
256256

257257
/* copy payload */

0 commit comments

Comments
 (0)