diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-09-10 15:44:41 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-09-10 15:44:41 +0200 |
commit | a9ee361f27e0439530387765924574e5358c8a5c (patch) | |
tree | 3104aecc4d574f7d7bbb269223814586277b1797 /src/plugins/serial/serial_basic.c | |
parent | 82ac6c87ce0b0af2fb8de25d70442fec406bb742 (diff) |
New upstream version 1.8.19upstream/1.8.19upstream
Diffstat (limited to 'src/plugins/serial/serial_basic.c')
-rw-r--r-- | src/plugins/serial/serial_basic.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/plugins/serial/serial_basic.c b/src/plugins/serial/serial_basic.c index 21a239a..e134c9c 100644 --- a/src/plugins/serial/serial_basic.c +++ b/src/plugins/serial/serial_basic.c @@ -29,7 +29,6 @@ * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#define _GNU_SOURCE 1 /* Serial Interface, Basic Mode plugin. */ @@ -242,12 +241,12 @@ serial_bm_open(struct ipmi_intf * intf) return -1; } - for (i = 0; i < sizeof(rates) / sizeof(rates[0]); i++) { + for (i = 0; i < ARRAY_SIZE(rates); i++) { if (rates[i].baudrate == rate) { break; } } - if (i >= sizeof(rates) / sizeof(rates[0])) { + if (i >= ARRAY_SIZE(rates)) { lprintf(LOG_ERR, "Unsupported baud rate %i specified", rate); return -1; } @@ -613,18 +612,7 @@ serial_bm_build_msg(const struct ipmi_intf * intf, uint8_t * data = msg, seq; struct ipmb_msg_hdr * hdr = (struct ipmb_msg_hdr *) msg; struct ipmi_send_message_rq * inner_rq = NULL, * outer_rq = NULL; - int bridging_level; - - /* acquire bridging level */ - if (intf->target_addr && intf->target_addr != intf->my_addr) { - if (intf->transit_addr != 0) { - bridging_level = 2; - } else { - bridging_level = 1; - } - } else { - bridging_level = 0; - } + int bridging_level = ipmi_intf_get_bridging_level(intf); /* check overall packet length */ if(req->msg.data_len + 7 + bridging_level * 8 > max_len) { @@ -656,7 +644,7 @@ serial_bm_build_msg(const struct ipmi_intf * intf, /* inner send message request is further */ inner_rq = (outer_rq + 1); } else { - /* there is only outer send message reuest */ + /* there is only outer send message request */ inner_rq = outer_rq; } @@ -817,12 +805,14 @@ serial_bm_wait_response(struct ipmi_intf * intf, /* * Get message from receive message queue + * + * Note: kept max_len in case later use. */ static int serial_bm_get_message(struct ipmi_intf * intf, struct serial_bm_request_ctx * req_ctx, struct serial_bm_recv_ctx * read_ctx, - uint8_t * msg, size_t max_len) + uint8_t * msg, size_t __UNUSED__(max_len)) { uint8_t data[SERIAL_BM_MAX_MSG_SIZE]; struct serial_bm_request_ctx tmp_ctx; |