diff mbox series

[2/5] qmimodem: Use ell endianness converter helpers

Message ID 20240304203506.1725220-2-denkenz@gmail.com (mailing list archive)
State Accepted
Commit f4b626316d3ecbe9d67dd1693a0ece456fc8f78a
Headers show
Series [1/5] qmimodem: Use stdbool instead of gboolean | expand

Commit Message

Denis Kenzior March 4, 2024, 8:34 p.m. UTC
---
 drivers/qmimodem/netmon.c               |  8 ++++----
 drivers/qmimodem/network-registration.c | 12 ++++++------
 drivers/qmimodem/sim.c                  |  4 ++--
 drivers/qmimodem/sms.c                  | 24 ++++++++++++------------
 4 files changed, 24 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/netmon.c b/drivers/qmimodem/netmon.c
index f9f85eeeae0e..1190a37d66a7 100644
--- a/drivers/qmimodem/netmon.c
+++ b/drivers/qmimodem/netmon.c
@@ -90,7 +90,7 @@  static void get_rssi_cb(struct qmi_result *result, void *user_data)
 	/* RSSI */
 	rssi = qmi_result_get(result, 0x11, &len);
 	if (rssi) {
-		num = GUINT16_FROM_LE(rssi->count);
+		num = L_LE16_TO_CPU(rssi->count);
 		for (i = 0; i < num; i++) {
 			DBG("RSSI: %hhu on RAT %hhd",
 				rssi->info[i].rssi,
@@ -127,14 +127,14 @@  static void get_rssi_cb(struct qmi_result *result, void *user_data)
 	/* Bit error rate */
 	ber = qmi_result_get(result, 0x15, &len);
 	if (ber) {
-		num = GUINT16_FROM_LE(ber->count);
+		num = L_LE16_TO_CPU(ber->count);
 		for (i = 0; i < ber->count; i++) {
 			DBG("Bit error rate: %hu on RAT %hhd",
-				GUINT16_FROM_LE(ber->info[i].rate),
+				L_LE16_TO_CPU(ber->info[i].rate),
 				ber->info[i].rat);
 		}
 
-		props.ber = GUINT16_FROM_LE(ber->info[0].rate);
+		props.ber = L_LE16_TO_CPU(ber->info[0].rate);
 		if (props.ber > 7)
 			props.ber = -1;
 	} else {
diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c
index 6bc8fbc5d226..a1c507eb371f 100644
--- a/drivers/qmimodem/network-registration.c
+++ b/drivers/qmimodem/network-registration.c
@@ -134,8 +134,8 @@  static bool extract_ss_info(struct qmi_result *result, int *status,
 
 	plmn = qmi_result_get(result, QMI_NAS_RESULT_CURRENT_PLMN, &len);
 	if (plmn) {
-		uint16_t mcc = GUINT16_FROM_LE(plmn->mcc);
-		uint16_t mnc = GUINT16_FROM_LE(plmn->mnc);
+		uint16_t mcc = L_LE16_TO_CPU(plmn->mcc);
+		uint16_t mnc = L_LE16_TO_CPU(plmn->mnc);
 
 		if (mcc > 999)
 			mcc = 999;
@@ -311,7 +311,7 @@  static void scan_nets_cb(struct qmi_result *result, void *user_data)
 
 	netlist = ptr;
 
-	num = GUINT16_FROM_LE(netlist->count);
+	num = L_LE16_TO_CPU(netlist->count);
 
 	DBG("found %d operators", num);
 
@@ -325,8 +325,8 @@  static void scan_nets_cb(struct qmi_result *result, void *user_data)
 
 	for (i = 0; i < num; i++) {
 		const struct qmi_nas_network_info *netinfo = ptr + offset;
-		uint16_t mcc = GUINT16_FROM_LE(netinfo->mcc);
-		uint16_t mnc = GUINT16_FROM_LE(netinfo->mnc);
+		uint16_t mcc = L_LE16_TO_CPU(netinfo->mcc);
+		uint16_t mnc = L_LE16_TO_CPU(netinfo->mnc);
 
 		if (mcc > 999)
 			mcc = 999;
@@ -361,7 +361,7 @@  static void scan_nets_cb(struct qmi_result *result, void *user_data)
 	if (!netrat)
 		goto done;
 
-	if (GUINT16_FROM_LE(netrat->count) != num)
+	if (L_LE16_TO_CPU(netrat->count) != num)
 		goto done;
 
 	for (i = 0; i < num; i++) {
diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c
index 0b73b3c7598b..07cbbaa47992 100644
--- a/drivers/qmimodem/sim.c
+++ b/drivers/qmimodem/sim.c
@@ -132,7 +132,7 @@  static void get_file_attributes_cb(struct qmi_result *result, void *user_data)
 	if (!attr)
 		goto error;
 
-	raw_len = GUINT16_FROM_LE(attr->raw_len);
+	raw_len = L_LE16_TO_CPU(attr->raw_len);
 
 	switch (data->app_type) {
 	case 0x01:	/* SIM card */
@@ -547,7 +547,7 @@  static enum get_card_status_result handle_get_card_status_data(
 			info2 = ptr + offset;
 			offset += sizeof(struct qmi_uim_app_info2);
 
-			index = GUINT16_FROM_LE(status->index_gw_pri);
+			index = L_LE16_TO_CPU(status->index_gw_pri);
 
 			if ((index & 0xff) == n && (index >> 8) == i) {
 				if (get_card_status(slot, info1, info2,
diff --git a/drivers/qmimodem/sms.c b/drivers/qmimodem/sms.c
index 041344bb3044..f8ed96c435e0 100644
--- a/drivers/qmimodem/sms.c
+++ b/drivers/qmimodem/sms.c
@@ -197,7 +197,7 @@  static void qmi_submit(struct ofono_sms *sms,
 	message = alloca(3 + pdu_len);
 
 	message->msg_format = 0x06;
-	message->msg_length = GUINT16_TO_LE(pdu_len);
+	message->msg_length = L_CPU_TO_LE16(pdu_len);
 	memcpy(message->msg_data, pdu, pdu_len);
 
 	param = qmi_param_new();
@@ -357,7 +357,7 @@  static void delete_msg_cb(struct qmi_result *result, void *user_data)
 		 */
 		if (msg < data->msg_list->cnt)
 			raw_read(sms, data->msg_list->msg[msg].type,
-				GUINT32_FROM_LE(data->msg_list->msg[msg].ndx));
+				L_LE32_TO_CPU(data->msg_list->msg[msg].ndx));
 		else
 			get_msg_list(sms);
 	}
@@ -422,7 +422,7 @@  static void raw_read_cb(struct qmi_result *result, void *user_data)
 		uint16_t plen;
 		uint16_t tpdu_len;
 
-		plen = GUINT16_FROM_LE(msg->msg_length);
+		plen = L_LE16_TO_CPU(msg->msg_length);
 		tpdu_len = plen - msg->msg_data[0] - 1;
 
 		ofono_sms_deliver_notify(sms, msg->msg_data, plen, tpdu_len);
@@ -482,12 +482,12 @@  static void get_msg_list_cb(struct qmi_result *result, void *user_data)
 		goto done;
 	}
 
-	cnt = GUINT32_FROM_LE(list->cnt);
+	cnt = L_LE32_TO_CPU(list->cnt);
 	DBG("msgs found %d", cnt);
 
 	for (tmp = 0; tmp < cnt; tmp++) {
 		DBG("unread type %d ndx %d", list->msg[tmp].type,
-			GUINT32_FROM_LE(list->msg[tmp].ndx));
+			L_LE32_TO_CPU(list->msg[tmp].ndx));
 	}
 
 	/* free list from last time */
@@ -509,7 +509,7 @@  static void get_msg_list_cb(struct qmi_result *result, void *user_data)
 
 		data->rd_msg_num = 0;
 		raw_read(sms, data->msg_list->msg[0].type,
-				GUINT32_FROM_LE(data->msg_list->msg[0].ndx));
+				L_LE32_TO_CPU(data->msg_list->msg[0].ndx));
 		return;
 	}
 
@@ -612,12 +612,12 @@  static void event_notify(struct qmi_result *result, void *user_data)
 			DBG("msg mode not found, use mode %d", data->msg_mode);
 
 		DBG("msg type %d ndx %d mode %d", notify->storage_type,
-			GUINT32_FROM_LE(notify->storage_index), data->msg_mode);
+			L_LE32_TO_CPU(notify->storage_index), data->msg_mode);
 
 		/* don't read if list is being processed, get this msg later */
 		if (!data->msg_list_chk)
 			raw_read(sms, notify->storage_type,
-					GUINT32_FROM_LE(notify->storage_index));
+					L_LE32_TO_CPU(notify->storage_index));
 	} else {
 		/* route is either transfer only or transfer and ACK */
 		const struct qmi_wms_result_message *message;
@@ -626,11 +626,11 @@  static void event_notify(struct qmi_result *result, void *user_data)
 		if (message) {
 			uint16_t plen;
 
-			plen = GUINT16_FROM_LE(message->msg_length);
+			plen = L_LE16_TO_CPU(message->msg_length);
 
 			DBG("ack_required %d transaction id %u",
 				message->ack_required,
-				GUINT32_FROM_LE(message->transaction_id));
+				L_LE32_TO_CPU(message->transaction_id));
 			DBG("msg format %d PDU length %d",
 				message->msg_format, plen);
 
@@ -688,7 +688,7 @@  static void get_routes_cb(struct qmi_result *result, void *user_data)
         if (!list)
 		goto done;
 
-	num = GUINT16_FROM_LE(list->count);
+	num = L_LE16_TO_CPU(list->count);
 
 	DBG("found %d routes", num);
 
@@ -705,7 +705,7 @@  static void get_routes_cb(struct qmi_result *result, void *user_data)
 	len = 2 + (1 * 4);
 	new_list = alloca(len);
 
-	new_list->count = GUINT16_TO_LE(1);
+	new_list->count = L_CPU_TO_LE16(1);
 	new_list->route[0].msg_type = QMI_WMS_MSG_TYPE_P2P;
 	new_list->route[0].msg_class = QMI_WMS_MSG_CLASS_NONE;
 	new_list->route[0].storage_type = QMI_WMS_STORAGE_TYPE_NV;