Skip to content

Commit 49ac66a

Browse files
de-nordiccarlescufi
authored andcommitted
mgmt/mcumgr: Drop smp_streamer.tx_rsp_cb
No longer needed, since smp_streamer has smpt pointer to zephyr_smp_transport, it can directly call smpt->zst_output. Signed-off-by: Dominik Ermel <[email protected]>
1 parent b64f611 commit 49ac66a

File tree

3 files changed

+2
-30
lines changed

3 files changed

+2
-30
lines changed

subsys/mgmt/mcumgr/lib/smp/include/smp/smp.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,13 @@ extern "C" {
3434
struct smp_streamer;
3535
struct mgmt_hdr;
3636

37-
/** @typedef smp_tx_rsp_fn
38-
* @brief Transmits an SMP response packet.
39-
*
40-
* @param ss The streamer to transmit via.
41-
* @param buf Buffer containing the response packet.
42-
* @param arg Optional streamer argument.
43-
*
44-
* @return 0 on success, MGMT_ERR_[...] code on failure.
45-
*/
46-
typedef int smp_tx_rsp_fn(struct smp_streamer *ss, void *buf, void *arg);
47-
4837
/**
4938
* @brief Decodes, encodes, and transmits SMP packets.
5039
*/
5140
struct smp_streamer {
5241
struct zephyr_smp_transport *smpt;
5342
struct cbor_nb_reader *reader;
5443
struct cbor_nb_writer *writer;
55-
smp_tx_rsp_fn *tx_rsp_cb;
5644
};
5745

5846
/**

subsys/mgmt/mcumgr/lib/smp/src/smp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ smp_on_err(struct smp_streamer *streamer, const struct mgmt_hdr *req_hdr,
228228
/* Build and transmit the error response. */
229229
rc = smp_build_err_rsp(streamer, req_hdr, status, rsn);
230230
if (rc == 0) {
231-
streamer->tx_rsp_cb(streamer, rsp, streamer->smpt);
231+
streamer->smpt->zst_output(rsp);
232232
rsp = NULL;
233233
}
234234

@@ -306,7 +306,7 @@ smp_process_request_packet(struct smp_streamer *streamer, void *vreq)
306306
}
307307

308308
/* Send the response. */
309-
rc = streamer->tx_rsp_cb(streamer, rsp, streamer->smpt);
309+
rc = streamer->smpt->zst_output(rsp);
310310
rsp = NULL;
311311
if (rc != 0) {
312312
break;

subsys/mgmt/mcumgr/smp.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,6 @@ void zephyr_smp_free_buf(void *buf, void *arg)
8686
mcumgr_buf_free(buf);
8787
}
8888

89-
static int
90-
zephyr_smp_tx_rsp(struct smp_streamer *ns, void *rsp, void *arg)
91-
{
92-
struct zephyr_smp_transport *zst;
93-
struct net_buf *nb;
94-
95-
zst = arg;
96-
nb = rsp;
97-
98-
/* Pass full packet to output function so it can be transmitted or split into frames as
99-
* needed by the transport
100-
*/
101-
return zst->zst_output(nb);
102-
}
103-
10489
/**
10590
* Processes a single SMP packet and sends the corresponding response(s).
10691
*/
@@ -117,7 +102,6 @@ zephyr_smp_process_packet(struct zephyr_smp_transport *zst,
117102
.reader = &reader,
118103
.writer = &writer,
119104
.smpt = zst,
120-
.tx_rsp_cb = zephyr_smp_tx_rsp,
121105
};
122106

123107
rc = smp_process_request_packet(&streamer, nb);

0 commit comments

Comments
 (0)