From patchwork Mon Mar 4 20:34:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13581201 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F6B8B663 for ; Mon, 4 Mar 2024 20:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584510; cv=none; b=Lg/zWSd4Q2QDXZjtBdAasNFKKEIn6GdE4APtj1GeJbHSh1SAdYntdQHnUkuBdTVEmeS4THTBnJKxCuzQShT4vOj+vaMCN635ppCkgkWvhoF2O40wf9vf65G7m3zLu+u6/fO8Fqhpe5sgzmhF2Id+g+Wl/UWbxoAnV1jHW+NJ8XE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584510; c=relaxed/simple; bh=ZsmRnj5Wa5iL3Gd8c0Xgj2+OfnXqypxIUPd5PAlHpWM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Pgehe5w5/ekv5gW/Z19+xru4hxdxW8GSyndGff4K5tsf55ucs5Ogwz12RUJ8E7yK4PNichGMoIIkluVi/8WwbFvtoA1/ZKXRVZ6irhE4sYiGfjlhfV54ZYQPG6HRG7eh/ATW4C9n5ZSqBLSZkAlSRM7O1bgeJkKCGvVPGelL0OQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fcAp3fBE; arc=none smtp.client-ip=209.85.167.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fcAp3fBE" Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3bd4e6a7cb0so3478314b6e.3 for ; Mon, 04 Mar 2024 12:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709584508; x=1710189308; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HkOL7xyau4DAmDVT2dgN1CHRnwZ+IbhHoKAd1/N7lCU=; b=fcAp3fBE/fvzveMHaN3seIQ/hltSthM5l5JH0Ob4jDj/2RGpqVPjXFxTdu52pv5Ut6 KV2tSikm22vb1S+BxlLXM6XugYmfROZFLMEQmPHc7BMhLdVqFvGmgnBqpRR+Ve3niB9l ICZ9aTt/vHWGgWCuuVZ+qRIdzrLqjvik2ej4yBeOTRiKomL1tIwEBtDG/6k1fAhBPN3B f0EVI1NNr43wKmhZNgqcvZhU6dVHSXNBVFDNCn+5Ra/NrUqavVG2WRru0PnHuWONzjX+ yJxqHXnp5qHnoshuPQ4PJfjKe83opQ15qVlquzze683olj5sV+0UHNodibVPWXxrSl2D fIJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709584508; x=1710189308; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HkOL7xyau4DAmDVT2dgN1CHRnwZ+IbhHoKAd1/N7lCU=; b=kFb93XKbU9FBw2NXv5A/vJ8/hBlEZfDq2AEggcLHxsoisowU1wMr/f3m2BmBrDRSrZ SLbzYSoR72KDnwyO8HIOXJh/VjzxDE2pwHB7II40BAO57NANYd5ox/JdU6K//NI6uhyS 55LsecVdricR7GCVJd2Cop0VeCalsRTCkLJ6fJmqKCnBLbPAcnhhapUGyB7lyK6QIey7 qW7dGYOHi4+NYIkvAEqEL0SV2fFMAljQ+W9UKLQ+r55Hr9oifS/kVqa+qsz1vchLiLcs Zj7gDembIuGO3M3YKN49TeoOJVd65arhoSl+RU62TZM6zYaPMkb6afu+sl2nviYmQxuM DwRQ== X-Gm-Message-State: AOJu0Yw1zaeO+mjid/2jkT50AqrE4veIXgvbQ87u3sHcd06rITk8dSi0 sNV96tweLoh16o63e5HjQNud+vhxuOj2kNkiwUPI6Cr80QLrl98SzcCSSNg0 X-Google-Smtp-Source: AGHT+IGGLe3dpb2oHbJynCcxM8grLxiRkrArey5pBUpCkNyzl0fqKI7bxMiER8MUl/b4f4FxWJfhww== X-Received: by 2002:a05:6808:398d:b0:3c1:cbe9:e153 with SMTP id gq13-20020a056808398d00b003c1cbe9e153mr13987630oib.17.1709584508310; Mon, 04 Mar 2024 12:35:08 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 1-20020aca2101000000b003c0408e5b06sm1642582oiz.55.2024.03.04.12.35.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 12:35:08 -0800 (PST) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 1/5] qmimodem: Use stdbool instead of gboolean Date: Mon, 4 Mar 2024 14:34:49 -0600 Message-ID: <20240304203506.1725220-1-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/sim-legacy.c | 4 ++-- drivers/qmimodem/sim.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/qmimodem/sim-legacy.c b/drivers/qmimodem/sim-legacy.c index cb4ad0646037..12e5ab079111 100644 --- a/drivers/qmimodem/sim-legacy.c +++ b/drivers/qmimodem/sim-legacy.c @@ -250,13 +250,13 @@ static void process_uim_state(struct ofono_sim *sim, uint8_t state) switch (state) { case QMI_DMS_UIM_STATE_INIT_COMPLETE: - ofono_sim_inserted_notify(sim, TRUE); + ofono_sim_inserted_notify(sim, true); ofono_sim_initialized_notify(sim); break; case QMI_DMS_UIM_STATE_INIT_FAILED: case QMI_DMS_UIM_STATE_NOT_PRESENT: case QMI_DMS_UIM_STATE_INVALID: - ofono_sim_inserted_notify(sim, FALSE); + ofono_sim_inserted_notify(sim, false); break; } } diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c index 625846c5efd9..0b73b3c7598b 100644 --- a/drivers/qmimodem/sim.c +++ b/drivers/qmimodem/sim.c @@ -121,7 +121,7 @@ static void get_file_attributes_cb(struct qmi_result *result, void *user_data) int flen, rlen, str; unsigned char access[3]; unsigned char file_status; - gboolean ok; + bool ok; DBG(""); @@ -146,7 +146,7 @@ static void get_file_attributes_cb(struct qmi_result *result, void *user_data) file_status = EF_STATUS_VALID; break; default: - ok = FALSE; + ok = false; break; } @@ -608,7 +608,7 @@ static void query_passwd_state_cb(struct qmi_result *result, data->retry_count = 0; if (sim_stat.passwd_state == OFONO_SIM_PASSWORD_INVALID) { CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - ofono_sim_inserted_notify(sim, FALSE); + ofono_sim_inserted_notify(sim, false); } else CALLBACK_WITH_SUCCESS(cb, sim_stat.passwd_state, cbd->data); @@ -621,7 +621,7 @@ static void query_passwd_state_cb(struct qmi_result *result, sim_stat.card_state); data->retry_count = 0; CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - ofono_sim_inserted_notify(sim, FALSE); + ofono_sim_inserted_notify(sim, false); } else { DBG("Retry command"); retry_cbd = cb_data_new(cb, cbd->data); @@ -635,7 +635,7 @@ static void query_passwd_state_cb(struct qmi_result *result, DBG("Command failed"); data->retry_count = 0; CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - ofono_sim_inserted_notify(sim, FALSE); + ofono_sim_inserted_notify(sim, false); break; } } @@ -781,7 +781,7 @@ static void get_card_status_cb(struct qmi_result *result, void *user_data) case 0x02: /* Error */ break; case 0x01: /* Present */ - ofono_sim_inserted_notify(sim, TRUE); + ofono_sim_inserted_notify(sim, true); ofono_sim_initialized_notify(sim); break; } @@ -806,10 +806,10 @@ static void card_status_notify(struct qmi_result *result, void *user_data) switch (sim_stat.card_state) { case 0x00: /* Absent */ case 0x02: /* Error */ - ofono_sim_inserted_notify(sim, FALSE); + ofono_sim_inserted_notify(sim, false); break; case 0x01: /* Present */ - ofono_sim_inserted_notify(sim, TRUE); + ofono_sim_inserted_notify(sim, true); break; } } From patchwork Mon Mar 4 20:34:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13581202 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21A67F9C1 for ; Mon, 4 Mar 2024 20:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584511; cv=none; b=TFuiTiP/2VA8k9OXxJOcpkNVtBwLVwe1ONC2WDdqs0Cb+PIv6LxNjQpAUVzTALk0OiHKkO5tqoNMfxW6tC31lnZ01xTxN5ppSJjpmVAEoir8Dlhst9Ko+sRw2fdl0vLW8pemDXDJqW+A+xlfbTXSzrGUPO5xicCPT7KiRG8k2bg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584511; c=relaxed/simple; bh=aLOIAAUov0HjTzyPxMv/J90iAnqkwQU7iKnK7Mu575E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I9jCLh9Uyvo0RiXQ6Tvs/vZUD9E7QqoQL7XxFg/H+tp+Z39A8DA48/V3rWxdLhi/UYoOfhoz4FsrNWOmJYlTP6HFju8AJmLnjTjX6++7gJpHClfNWDmIlLRn3HlIidLdJvlZSaAU8xEr/pdK62V2UJz4tMDuF5Z/wjvvraZ15Qw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WNAPVA79; arc=none smtp.client-ip=209.85.167.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WNAPVA79" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3c1e950e312so516320b6e.0 for ; Mon, 04 Mar 2024 12:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709584509; x=1710189309; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q0EnnSvQF8wg1lENuyQpwpAk4W0kICz7JDKKhwBMsOQ=; b=WNAPVA79Vj2iEJBeNU+jEfYtkdY29/oUJGrFSOkW+DVDJnlKr+rlbSVWiJ9kSlR0Gm pJNhuNcGXb3KBECD9lzCgmkZpPiv8I3geUTlKc3Gi64X8BjnLbBsAbifP/tl65QrUdUw dwnyNgT2hw9FTYlwrBejzAPjX8AD8Xk06vHO92mPXRJ4iklLOabkcnZwC789w6EVyIMn 9gUzuTKasNYfbfAw7MPtSPcTyf+a0YAehYvdCEOE2hHYm9GEUWfRKsOdEdPCy4PjumbL /19CwRVpSxmAYeXt2ecTkWoKec3iy/rGxEVP4kCNNwxHGZFBieqVEmH1x706l5iUlwms i2pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709584509; x=1710189309; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q0EnnSvQF8wg1lENuyQpwpAk4W0kICz7JDKKhwBMsOQ=; b=Ovte4puMXF4d13SsBy087Vb4SzuRelvjpTRG1Es7XD5/a2GuQ9EBoPnC3GQiTu3PzJ mEeCeTYcOIjOiYYi57gJJKgFfQ1ofNN6zT3cO0CkPst6EeMMpMtQuT9Dcmp29AZMB5E7 CcA10TXhLz6KX5w4ExGZnCo4AzO/SOR/WDoykb93j+YlvYZFGTvOg5QgM3jOMy0nnCQc 7kvcD+bvldj+KK+gHRWfVf+ySsgRRwdNQmMd1WFqR0ThARA7PRfyFU/Q5kA5y0ns4vIR dSyGjc1jkd3Lo62WdORMxArQ0bM/nZ/0GQzdHNk/oAGVFw7LBLEq42CtIsPNk141aMc8 wwhQ== X-Gm-Message-State: AOJu0Yxdta10zvKhpE6KQeJLoUdcFUlYheJDPHkMg8nm+cLlMYDoUXM+ DUykxbPjtvHSPB2eVftLsYHCVnAUA6k2v/yPvdUhkUEXZY23TIDHAM01Ru7n X-Google-Smtp-Source: AGHT+IF4YoOwBwDGot73ZwyajqcrokQ0ds5SJgnPDR0E+M+VEN4hc2Vy7Ym/PSrInrp+B71V1Y+KeQ== X-Received: by 2002:a05:6808:7ce:b0:3c1:33fe:5411 with SMTP id f14-20020a05680807ce00b003c133fe5411mr215745oij.21.1709584508954; Mon, 04 Mar 2024 12:35:08 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 1-20020aca2101000000b003c0408e5b06sm1642582oiz.55.2024.03.04.12.35.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 12:35:08 -0800 (PST) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 2/5] qmimodem: Use ell endianness converter helpers Date: Mon, 4 Mar 2024 14:34:50 -0600 Message-ID: <20240304203506.1725220-2-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240304203506.1725220-1-denkenz@gmail.com> References: <20240304203506.1725220-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- 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 --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; From patchwork Mon Mar 4 20:34:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13581205 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3D7CDF5A for ; Mon, 4 Mar 2024 20:35:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584514; cv=none; b=kgnV5Tkxxu/gC8xYBfSF2hfZZTt54VEr9iwfpWGWo+OOMFw2cm0929eOHBs9u8no3WZP2WQPN8Uw9G+gLdvmFuh6aumz9cr7faurNCDldF3qmQ8uULFesSzjoXVXncicyjFvu99ZszYCbYlwi3L75dXVZeVzI2sIFb31rHp6pZg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584514; c=relaxed/simple; bh=cm/TnaIVQzXSZVSzZ7Y2Fg7HTpWUkYy9RwpeSBvQAHg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mtRITKasWQqpvfBBxD6jWH8vWb+vbp1RGwvrpq1MlvFjdLleMaCb4pT9aa8mgQvODSTPL8M/vJzIEr+sJaUXb1Gt7HX+Q9bzalD9UdOtdjWqhJCgiaUNRI/p+k5O3SExSMw1ifv+JkJhDWBxHv7A/0BR3MRv0bRdYgRyZAEmiO0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=S0Qi25MJ; arc=none smtp.client-ip=209.85.167.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S0Qi25MJ" Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3c1a3384741so3565354b6e.0 for ; Mon, 04 Mar 2024 12:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709584510; x=1710189310; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UahHhUaWvUGUKPgOD/0XKCM7ZE40FT2q1XKj7QIsDac=; b=S0Qi25MJigJ/BO3vSp32S48FKz7M0r9sqKWesjP8XUPPXk6wWHosSEUmUTHDP08lb2 a2RtPg0VZtbv/8HPr2PUkery/fj61otv3TIqLBHuk6YVyU9G2juc04GOX7ONwJZ6IPk0 qQGOhU+BjGtxGpJQzyW2xpqwddDj+JsYLHkRqJRWRkANsW0rN6O79FDV9m+doImPgCdG xJvCJcpSyfDaDZHlKLM9SuAn5vmTsUCbyM5YI4gh3HFen8eNtUAzzBsidj1f5YAZbInd upeGV5DBQf0rW+3PjY1gnd8czPMmJ6C2yCii/btqK//CN/FqYGbL8cnw2ATOlPzqtUAg rBMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709584510; x=1710189310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UahHhUaWvUGUKPgOD/0XKCM7ZE40FT2q1XKj7QIsDac=; b=hj+yJmFMucb2Zxo3Lm2s9YI+5wKbwAoQl1fJ92c4QRAeQdH7mXu0bgslyk3p4XyApX LXjlxUdWE74/HQAW3gVg4dPXT0lzC2XnLSBKX+2a/F1DLqO7TeB5oLYNfKRXCBjzAqbC 7TFLx7ixPF4eZTSs0bZ+KbQHtea7qLIoekxLP4IuMQ+TiwzqPsMNBOwyL6lUPbnbp/66 GQ7xY3BR6Tl8Gke+mb2vear2c1RoA8Ha+EyFRvAIz+krVzrwmK8YG+WkG7BhDmzA8FNZ Jkky0zgcltH2eYHNrty8aar66l3U4Ezmpnvh/MHC0smBSviqdBSUNE0C5L6fjUvu+Vct AvZw== X-Gm-Message-State: AOJu0YwpObJr9Ehza6xyudjdu9s8/SZry+p4pkElX7cutBVRRHwn47MP ooqbKrdhuM5BCX+0yAOmTeN374x3v4s+lgTC7jlS9F6UR/ZGqIiTQpv4+co1 X-Google-Smtp-Source: AGHT+IEHEDM0EQPvB9wHoqwAhJKPljcALq/K8b39c9AQE1dIsTvVlr4EeM3d41YuZTh1POEW7R91PA== X-Received: by 2002:a05:6808:88:b0:3c1:f3ce:5e54 with SMTP id s8-20020a056808008800b003c1f3ce5e54mr2284492oic.23.1709584509728; Mon, 04 Mar 2024 12:35:09 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 1-20020aca2101000000b003c0408e5b06sm1642582oiz.55.2024.03.04.12.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 12:35:09 -0800 (PST) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 3/5] qmimodem: Use l_new / l_free Date: Mon, 4 Mar 2024 14:34:51 -0600 Message-ID: <20240304203506.1725220-3-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240304203506.1725220-1-denkenz@gmail.com> References: <20240304203506.1725220-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Convert from using GLib g_new0 / g_free to use ell --- drivers/qmimodem/call-barring.c | 16 +++++------ drivers/qmimodem/call-forwarding.c | 22 +++++++------- drivers/qmimodem/call-settings.c | 16 +++++------ drivers/qmimodem/devinfo.c | 20 ++++++------- drivers/qmimodem/gprs-context.c | 22 +++++++------- drivers/qmimodem/gprs.c | 14 ++++----- drivers/qmimodem/location-reporting.c | 12 ++++---- drivers/qmimodem/lte.c | 10 +++---- drivers/qmimodem/netmon.c | 10 +++---- drivers/qmimodem/network-registration.c | 38 ++++++++++--------------- drivers/qmimodem/radio-settings.c | 14 ++++----- drivers/qmimodem/sim-legacy.c | 16 +++++------ drivers/qmimodem/sim.c | 36 +++++++++++------------ drivers/qmimodem/sms.c | 33 ++++++++++----------- drivers/qmimodem/ussd.c | 10 +++---- drivers/qmimodem/util.h | 5 ++-- drivers/qmimodem/voicecall.c | 4 +-- 17 files changed, 141 insertions(+), 157 deletions(-) diff --git a/drivers/qmimodem/call-barring.c b/drivers/qmimodem/call-barring.c index dc84026a638b..6224893871a0 100644 --- a/drivers/qmimodem/call-barring.c +++ b/drivers/qmimodem/call-barring.c @@ -110,12 +110,12 @@ static void qmi_set(struct ofono_call_barring *barr, const char *lock, qmi_param_append(param, 0x11, 4, passwd); if (qmi_service_send(bd->voice, QMI_VOICE_SET_SUPS_SERVICE, param, - set_cb, cbd, g_free) > 0) + set_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, data); } @@ -156,12 +156,12 @@ static void qmi_query(struct ofono_call_barring *barr, const char *lock, qmi_param_append_uint8(param, 0x10, cls); if (qmi_service_send(bd->voice, QMI_VOICE_GET_CALL_BARRING, param, - query_cb, cbd, g_free) > 0) + query_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, -1, data); } @@ -194,12 +194,12 @@ static void qmi_set_passwd(struct ofono_call_barring *barr, const char *lock, qmi_param_append(param, 0x01, sizeof(ssd), &ssd); if (qmi_service_send(bd->voice, QMI_VOICE_SET_CALL_BARRING_PWD, param, - set_cb, cbd, g_free) > 0) + set_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, data); } @@ -229,7 +229,7 @@ static int qmi_call_barring_probe(struct ofono_call_barring *barr, DBG(""); - bd = g_new0(struct call_barring_data, 1); + bd = l_new(struct call_barring_data, 1); ofono_call_barring_set_data(barr, bd); @@ -250,7 +250,7 @@ static void qmi_call_barring_remove(struct ofono_call_barring *barr) if (bd->voice) qmi_service_unref(bd->voice); - g_free(bd); + l_free(bd); } static const struct ofono_call_barring_driver driver = { diff --git a/drivers/qmimodem/call-forwarding.c b/drivers/qmimodem/call-forwarding.c index 5972055feb74..2a415b2a9c11 100644 --- a/drivers/qmimodem/call-forwarding.c +++ b/drivers/qmimodem/call-forwarding.c @@ -110,7 +110,7 @@ static void query_cb(struct qmi_result *result, void *user_data) num = *p++; - list = g_new0(struct ofono_call_forwarding_condition, num); + list = l_new(struct ofono_call_forwarding_condition, num); for (i = 0; i < num; i++) { struct call_forwarding_info_ext *info = (void *)p; @@ -119,7 +119,7 @@ static void query_cb(struct qmi_result *result, void *user_data) /* do not try to access beyond buffer end */ if (p + sizeof(*info) > end || p + sizeof(*info) + info->len > end) { - g_free(list); + l_free(list); goto error; } @@ -135,7 +135,7 @@ static void query_cb(struct qmi_result *result, void *user_data) } CALLBACK_WITH_SUCCESS(cb, num, list, cbd->data); - g_free(list); + l_free(list); return; } @@ -163,12 +163,12 @@ static void qmi_query(struct ofono_call_forwarding *cf, int type, int cls, qmi_param_append_uint8(param, 0x10, cls); if (qmi_service_send(cfd->voice, QMI_VOICE_GET_CALL_FWDING, param, - query_cb, cbd, g_free) > 0) + query_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, 0, NULL, data); } @@ -224,12 +224,12 @@ static void qmi_register(struct ofono_call_forwarding *cf, int type, int cls, qmi_param_append(param, 0x14, sizeof(tpd), &tpd); if (qmi_service_send(cfd->voice, QMI_VOICE_SET_SUPS_SERVICE, param, - set_cb, cbd, g_free) > 0) + set_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, data); } @@ -261,13 +261,13 @@ static void qmi_set(struct ofono_call_forwarding *cf, int type, int cls, qmi_param_append_uint8(param, 0x10, cls); if (qmi_service_send(cfd->voice, QMI_VOICE_SET_SUPS_SERVICE, param, - set_cb, cbd, g_free) > 0) + set_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, data); } @@ -315,7 +315,7 @@ static int qmi_call_forwarding_probe(struct ofono_call_forwarding *cf, DBG(""); - cfd = g_new0(struct call_forwarding_data, 1); + cfd = l_new(struct call_forwarding_data, 1); ofono_call_forwarding_set_data(cf, cfd); @@ -336,7 +336,7 @@ static void qmi_call_forwarding_remove(struct ofono_call_forwarding *cf) if (cfd->voice) qmi_service_unref(cfd->voice); - g_free(cfd); + l_free(cfd); } static const struct ofono_call_forwarding_driver driver = { diff --git a/drivers/qmimodem/call-settings.c b/drivers/qmimodem/call-settings.c index 07b9d543be37..53b2f1f21fc9 100644 --- a/drivers/qmimodem/call-settings.c +++ b/drivers/qmimodem/call-settings.c @@ -49,10 +49,10 @@ static void query_status(struct ofono_call_settings *cs, uint16_t message, if (!csd) goto error; - if (qmi_service_send(csd->voice, message, NULL, fn, cbd, g_free) > 0) + if (qmi_service_send(csd->voice, message, NULL, fn, cbd, l_free) > 0) return; error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, -1, data); } @@ -171,10 +171,10 @@ static void qmi_clir_query(struct ofono_call_settings *cs, goto error; if (qmi_service_send(csd->voice, QMI_VOICE_GET_CLIR, NULL, - clir_cb, cbd, g_free) > 0) + clir_cb, cbd, l_free) > 0) return; error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, -1, -1, data); } @@ -221,12 +221,12 @@ static void qmi_cw_set(struct ofono_call_settings *cs, int mode, int cls, qmi_param_append_uint8(param, 0x10, cls); if (qmi_service_send(csd->voice, QMI_VOICE_SET_SUPS_SERVICE, param, - cw_set_cb, cbd, g_free) > 0) + cw_set_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, data); } @@ -304,7 +304,7 @@ static int qmi_call_settings_probe(struct ofono_call_settings *cs, DBG(""); - csd = g_new0(struct call_settings_data, 1); + csd = l_new(struct call_settings_data, 1); ofono_call_settings_set_data(cs, csd); @@ -327,7 +327,7 @@ static void qmi_call_settings_remove(struct ofono_call_settings *cs) qmi_service_unref(csd->voice); } - g_free(csd); + l_free(csd); } static const struct ofono_call_settings_driver driver = { diff --git a/drivers/qmimodem/devinfo.c b/drivers/qmimodem/devinfo.c index 96224d3db361..0172614b8aae 100644 --- a/drivers/qmimodem/devinfo.c +++ b/drivers/qmimodem/devinfo.c @@ -71,12 +71,12 @@ static void qmi_query_manufacturer(struct ofono_devinfo *devinfo, DBG(""); if (qmi_service_send(data->dms, QMI_DMS_GET_MANUFACTURER, NULL, - string_cb, cbd, g_free) > 0) + string_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } static void qmi_query_model(struct ofono_devinfo *devinfo, @@ -88,12 +88,12 @@ static void qmi_query_model(struct ofono_devinfo *devinfo, DBG(""); if (qmi_service_send(data->dms, QMI_DMS_GET_MODEL_ID, NULL, - string_cb, cbd, g_free) > 0) + string_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } static void qmi_query_revision(struct ofono_devinfo *devinfo, @@ -105,12 +105,12 @@ static void qmi_query_revision(struct ofono_devinfo *devinfo, DBG(""); if (qmi_service_send(data->dms, QMI_DMS_GET_REV_ID, NULL, - string_cb, cbd, g_free) > 0) + string_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } static void get_ids_cb(struct qmi_result *result, void *user_data) @@ -166,12 +166,12 @@ static void qmi_query_serial(struct ofono_devinfo *devinfo, cbd->user = devinfo; if (qmi_service_send(data->dms, QMI_DMS_GET_IDS, NULL, - get_ids_cb, cbd, g_free) > 0) + get_ids_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } static void get_caps_cb(struct qmi_result *result, void *user_data) @@ -246,7 +246,7 @@ static int qmi_devinfo_probe(struct ofono_devinfo *devinfo, DBG(""); - data = g_new0(struct devinfo_data, 1); + data = l_new(struct devinfo_data, 1); ofono_devinfo_set_data(devinfo, data); @@ -266,7 +266,7 @@ static void qmi_devinfo_remove(struct ofono_devinfo *devinfo) qmi_service_unref(data->dms); - g_free(data); + l_free(data); } static const struct ofono_devinfo_driver driver = { diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index f575c5e2e1be..fb2069020833 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -30,8 +30,6 @@ #include #include -#include - #include "qmi.h" #include "wds.h" #include "util.h" @@ -96,7 +94,7 @@ static void get_settings_cb(struct qmi_result *result, void *user_data) apn = qmi_result_get_string(result, QMI_WDS_RESULT_APN); if (apn) { DBG("APN: %s", apn); - g_free(apn); + l_free(apn); } if (qmi_result_get_uint8(result, QMI_WDS_RESULT_PDP_TYPE, &pdp_type)) @@ -173,7 +171,7 @@ static void start_net_cb(struct qmi_result *result, void *user_data) cbd->user = gc; if (qmi_service_send(data->wds, QMI_WDS_GET_CURRENT_SETTINGS, NULL, - get_settings_cb, cbd, g_free) > 0) + get_settings_cb, cbd, l_free) > 0) return; CALLBACK_WITH_SUCCESS(cb, cbd->data); @@ -207,14 +205,14 @@ static void qmi_gprs_read_settings(struct ofono_gprs_context* gc, cbd->user = gc; if (qmi_service_send(data->wds, QMI_WDS_START_NETWORK, NULL, - start_net_cb, cbd, g_free) > 0) + start_net_cb, cbd, l_free) > 0) return; data->active_context = 0; CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static uint8_t auth_method_to_qmi_auth(enum ofono_gprs_auth_method method) @@ -279,7 +277,7 @@ static void qmi_activate_primary(struct ofono_gprs_context *gc, strlen(ctx->password), ctx->password); if (qmi_service_send(data->wds, QMI_WDS_START_NETWORK, param, - start_net_cb, cbd, g_free) > 0) + start_net_cb, cbd, l_free) > 0) return; qmi_param_free(param); @@ -289,7 +287,7 @@ error: CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void stop_net_cb(struct qmi_result *result, void *user_data) @@ -333,7 +331,7 @@ static void qmi_deactivate_primary(struct ofono_gprs_context *gc, data->pkt_handle); if (qmi_service_send(data->wds, QMI_WDS_STOP_NETWORK, param, - stop_net_cb, cbd, g_free) > 0) + stop_net_cb, cbd, l_free) > 0) return; qmi_param_free(param); @@ -341,7 +339,7 @@ static void qmi_deactivate_primary(struct ofono_gprs_context *gc, if (cb) CALLBACK_WITH_FAILURE(cb, user_data); - g_free(cbd); + l_free(cbd); } static void qmi_gprs_context_detach_shutdown(struct ofono_gprs_context *gc, @@ -459,7 +457,7 @@ static int qmi_gprs_context_probe(struct ofono_gprs_context *gc, DBG(""); - data = g_new0(struct gprs_context_data, 1); + data = l_new(struct gprs_context_data, 1); ofono_gprs_context_set_data(gc, data); data->dev = device; @@ -483,7 +481,7 @@ static void qmi_gprs_context_remove(struct ofono_gprs_context *gc) qmi_service_unref(data->wds); } - g_free(data); + l_free(data); } static const struct ofono_gprs_context_driver driver = { diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index 5dd23329eca2..a66863834a5f 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -117,7 +117,7 @@ static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data) ofono_info("LTE attach IP type: %hhd", iptype); ofono_gprs_cid_activated(gprs, data->last_auto_context_id, apn); - g_free(apn); + l_free(apn); return; @@ -286,12 +286,12 @@ static void qmi_set_attached(struct ofono_gprs *gprs, int attached, param = qmi_param_new_uint8(QMI_NAS_PARAM_ATTACH_ACTION, action); if (qmi_service_send(data->nas, QMI_NAS_ATTACH_DETACH, param, - attach_detach_cb, cbd, g_free) > 0) + attach_detach_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void get_ss_info_cb(struct qmi_result *result, void *user_data) @@ -329,12 +329,12 @@ static void qmi_attached_status(struct ofono_gprs *gprs, cbd->user = gprs; if (qmi_service_send(data->nas, QMI_NAS_GET_SERVING_SYSTEM, NULL, - get_ss_info_cb, cbd, g_free) > 0) + get_ss_info_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - g_free(cbd); + l_free(cbd); } static void create_wds_cb(struct qmi_service *service, void *user_data) @@ -396,7 +396,7 @@ static int qmi_gprs_probe(struct ofono_gprs *gprs, DBG(""); - data = g_new0(struct gprs_data, 1); + data = l_new(struct gprs_data, 1); ofono_gprs_set_data(gprs, data); @@ -426,7 +426,7 @@ static void qmi_gprs_remove(struct ofono_gprs *gprs) qmi_service_unref(data->nas); - g_free(data); + l_free(data); } static const struct ofono_gprs_driver driver = { diff --git a/drivers/qmimodem/location-reporting.c b/drivers/qmimodem/location-reporting.c index cafc4c059ae1..a32d18245c4f 100644 --- a/drivers/qmimodem/location-reporting.c +++ b/drivers/qmimodem/location-reporting.c @@ -137,12 +137,12 @@ static void qmi_location_reporting_enable(struct ofono_location_reporting *lr, param = qmi_param_new_uint8(QMI_PDS_PARAM_AUTO_TRACKING, 0x01); if (qmi_service_send(data->pds, QMI_PDS_SET_AUTOTRACK, param, - autotrack_enable_cb, cbd, g_free) > 0) + autotrack_enable_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - g_free(cbd); + l_free(cbd); } static void autotrack_disable_cb(struct qmi_result *result, void *user_data) @@ -177,12 +177,12 @@ static void qmi_location_reporting_disable(struct ofono_location_reporting *lr, param = qmi_param_new_uint8(QMI_PDS_PARAM_AUTO_TRACKING, 0x00); if (qmi_service_send(data->pds, QMI_PDS_SET_AUTOTRACK, param, - autotrack_disable_cb, cbd, g_free) > 0) + autotrack_disable_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void set_event_cb(struct qmi_result *result, void *user_data) @@ -238,7 +238,7 @@ static int qmi_location_reporting_probe(struct ofono_location_reporting *lr, DBG(""); - data = g_new0(struct location_data, 1); + data = l_new(struct location_data, 1); data->fd = -1; @@ -261,7 +261,7 @@ static void qmi_location_reporting_remove(struct ofono_location_reporting *lr) qmi_service_unref(data->pds); - g_free(data); + l_free(data); } static const struct ofono_location_reporting_driver driver = { diff --git a/drivers/qmimodem/lte.c b/drivers/qmimodem/lte.c index fcc1d2bd935c..921d6e81933e 100644 --- a/drivers/qmimodem/lte.c +++ b/drivers/qmimodem/lte.c @@ -91,12 +91,12 @@ static void qmimodem_lte_set_default_attach_info(const struct ofono_lte *lte, /* Modify profile */ if (qmi_service_send(ldd->wds, 0x28, param, - modify_profile_cb, cbd, g_free) > 0) + modify_profile_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void reset_profile_cb(struct qmi_result *result, void *user_data) @@ -210,9 +210,7 @@ static int qmimodem_lte_probe(struct ofono_lte *lte, DBG("qmimodem lte probe"); - ldd = g_try_new0(struct lte_data, 1); - if (!ldd) - return -ENOMEM; + ldd = l_new(struct lte_data, 1); ofono_lte_set_data(lte, ldd); @@ -232,7 +230,7 @@ static void qmimodem_lte_remove(struct ofono_lte *lte) qmi_service_unref(ldd->wds); - g_free(ldd); + l_free(ldd); } static const struct ofono_lte_driver driver = { diff --git a/drivers/qmimodem/netmon.c b/drivers/qmimodem/netmon.c index 1190a37d66a7..e8a020d734e8 100644 --- a/drivers/qmimodem/netmon.c +++ b/drivers/qmimodem/netmon.c @@ -29,8 +29,6 @@ #include #include -#include - #include #include #include @@ -203,12 +201,12 @@ static void qmi_netmon_request_update(struct ofono_netmon *netmon, qmi_param_append_uint16(param, 0x10, 255); if (qmi_service_send(data->nas, QMI_NAS_GET_SIGNAL_STRENGTH, param, - get_rssi_cb, cbd, g_free) > 0) + get_rssi_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void create_nas_cb(struct qmi_service *service, void *user_data) @@ -237,7 +235,7 @@ static int qmi_netmon_probe(struct ofono_netmon *netmon, DBG(""); - nmd = g_new0(struct netmon_data, 1); + nmd = l_new(struct netmon_data, 1); ofono_netmon_set_data(netmon, nmd); @@ -257,7 +255,7 @@ static void qmi_netmon_remove(struct ofono_netmon *netmon) qmi_service_unref(nmd->nas); - g_free(nmd); + l_free(nmd); } static const struct ofono_netmon_driver driver = { diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c index a1c507eb371f..c37e4f4f4938 100644 --- a/drivers/qmimodem/network-registration.c +++ b/drivers/qmimodem/network-registration.c @@ -32,8 +32,6 @@ #include #include -#include - #include "qmi.h" #include "nas.h" #include "util.h" @@ -268,12 +266,12 @@ static void qmi_registration_status(struct ofono_netreg *netreg, cbd->user = data; if (qmi_service_send(data->nas, QMI_NAS_GET_SERVING_SYSTEM, NULL, - get_ss_info_cb, cbd, g_free) > 0) + get_ss_info_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, cbd->data); - g_free(cbd); + l_free(cbd); } static void qmi_current_operator(struct ofono_netreg *netreg, @@ -312,17 +310,11 @@ static void scan_nets_cb(struct qmi_result *result, void *user_data) netlist = ptr; num = L_LE16_TO_CPU(netlist->count); - DBG("found %d operators", num); - - list = g_try_new0(struct ofono_network_operator, num); - if (!list) { - CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data); - return; - } - offset = 2; + list = l_new(struct ofono_network_operator, num); + for (i = 0; i < num; i++) { const struct qmi_nas_network_info *netinfo = ptr + offset; uint16_t mcc = L_LE16_TO_CPU(netinfo->mcc); @@ -374,7 +366,7 @@ static void scan_nets_cb(struct qmi_result *result, void *user_data) done: CALLBACK_WITH_SUCCESS(cb, num, list, cbd->data); - g_free(list); + l_free(list); } static void qmi_list_operators(struct ofono_netreg *netreg, @@ -386,12 +378,12 @@ static void qmi_list_operators(struct ofono_netreg *netreg, DBG(""); if (qmi_service_send(data->nas, QMI_NAS_NETWORK_SCAN, NULL, - scan_nets_cb, cbd, g_free) > 0) + scan_nets_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } static void register_net_cb(struct qmi_result *result, void *user_data) @@ -431,12 +423,12 @@ static void qmi_register_auto(struct ofono_netreg *netreg, QMI_NAS_REGISTER_ACTION_AUTO); if (qmi_service_send(data->nas, QMI_NAS_NETWORK_REGISTER, param, - register_net_cb, cbd, g_free) > 0) + register_net_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void qmi_register_manual(struct ofono_netreg *netreg, @@ -461,12 +453,12 @@ static void qmi_register_manual(struct ofono_netreg *netreg, sizeof(info), &info); if (qmi_service_send(data->nas, QMI_NAS_NETWORK_REGISTER, param, - register_net_cb, cbd, g_free) > 0) + register_net_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static int dbm_to_strength(int8_t dbm) @@ -524,12 +516,12 @@ static void qmi_signal_strength(struct ofono_netreg *netreg, DBG(""); if (qmi_service_send(data->nas, QMI_NAS_GET_SIGNAL_STRENGTH, NULL, - get_rssi_cb, cbd, g_free) > 0) + get_rssi_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - g_free(cbd); + l_free(cbd); } static void system_info_notify(struct qmi_result *result, void *user_data) @@ -689,7 +681,7 @@ static int qmi_netreg_probe(struct ofono_netreg *netreg, DBG(""); - data = g_new0(struct netreg_data, 1); + data = l_new(struct netreg_data, 1); data->operator.name[0] = '\0'; data->operator.mcc[0] = '\0'; @@ -743,7 +735,7 @@ static void qmi_netreg_remove(struct ofono_netreg *netreg) qmi_service_unref(data->nas); - g_free(data); + l_free(data); } static const struct ofono_netreg_driver driver = { diff --git a/drivers/qmimodem/radio-settings.c b/drivers/qmimodem/radio-settings.c index ffd8a05923c6..08e08f50b113 100644 --- a/drivers/qmimodem/radio-settings.c +++ b/drivers/qmimodem/radio-settings.c @@ -86,7 +86,7 @@ static void qmi_query_rat_mode(struct ofono_radio_settings *rs, if (qmi_service_send(data->nas, QMI_NAS_GET_SYSTEM_SELECTION_PREFERENCE, NULL, - get_system_selection_pref_cb, cbd, g_free) > 0) + get_system_selection_pref_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, -1, data); @@ -144,12 +144,12 @@ static void qmi_set_rat_mode(struct ofono_radio_settings *rs, unsigned int mode, if (qmi_service_send(data->nas, QMI_NAS_SET_SYSTEM_SELECTION_PREFERENCE, param, - set_system_selection_pref_cb, cbd, g_free) > 0) + set_system_selection_pref_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, user_data); - g_free(cbd); + l_free(cbd); } static void get_caps_cb(struct qmi_result *result, void *user_data) @@ -204,11 +204,11 @@ static void qmi_query_available_rats(struct ofono_radio_settings *rs, goto error; if (qmi_service_send(rsd->dms, QMI_DMS_GET_CAPS, NULL, - get_caps_cb, cbd, g_free) > 0) + get_caps_cb, cbd, l_free) > 0) return; error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, -1, data); } @@ -257,7 +257,7 @@ static int qmi_radio_settings_probe(struct ofono_radio_settings *rs, DBG(""); - data = g_new0(struct settings_data, 1); + data = l_new(struct settings_data, 1); ofono_radio_settings_set_data(rs, data); @@ -280,7 +280,7 @@ static void qmi_radio_settings_remove(struct ofono_radio_settings *rs) qmi_service_unref(data->dms); qmi_service_unref(data->nas); - g_free(data); + l_free(data); } static const struct ofono_radio_settings_driver driver = { diff --git a/drivers/qmimodem/sim-legacy.c b/drivers/qmimodem/sim-legacy.c index 12e5ab079111..e9ed0a9ec4c1 100644 --- a/drivers/qmimodem/sim-legacy.c +++ b/drivers/qmimodem/sim-legacy.c @@ -110,14 +110,14 @@ static void qmi_read_file_transparent(struct ofono_sim *sim, switch (fileid) { case SIM_EF_ICCID_FILEID: if (qmi_service_send(data->dms, QMI_DMS_GET_ICCID, NULL, - get_iccid_cb, cbd, g_free) > 0) + get_iccid_cb, cbd, l_free) > 0) return; break; } CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data); - g_free(cbd); + l_free(cbd); } static void get_imsi_cb(struct qmi_result *result, void *user_data) @@ -153,12 +153,12 @@ static void qmi_read_imsi(struct ofono_sim *sim, DBG(""); if (qmi_service_send(data->dms, QMI_DMS_GET_IMSI, NULL, - get_imsi_cb, cbd, g_free) > 0) + get_imsi_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } static void get_pin_status_cb(struct qmi_result *result, void *user_data) @@ -226,12 +226,12 @@ static void qmi_query_passwd_state(struct ofono_sim *sim, cbd->user = data; if (qmi_service_send(data->dms, QMI_DMS_GET_PIN_STATUS, NULL, - get_pin_status_cb, cbd, g_free) > 0) + get_pin_status_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - g_free(cbd); + l_free(cbd); } static void qmi_query_pin_retries(struct ofono_sim *sim, @@ -351,7 +351,7 @@ static int qmi_sim_probe(struct ofono_sim *sim, DBG(""); - data = g_new0(struct sim_data, 1); + data = l_new(struct sim_data, 1); for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++) data->retries[i] = -1; @@ -379,7 +379,7 @@ static void qmi_sim_remove(struct ofono_sim *sim) qmi_service_unref(data->dms); - g_free(data); + l_free(data); } static const struct ofono_sim_driver driver = { diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c index 07cbbaa47992..110af6686627 100644 --- a/drivers/qmimodem/sim.c +++ b/drivers/qmimodem/sim.c @@ -188,7 +188,7 @@ static void qmi_read_attributes(struct ofono_sim *sim, int fileid, qmi_param_append(param, 0x02, fileid_len, fileid_data); if (qmi_service_send(data->uim, QMI_UIM_GET_FILE_ATTRIBUTES, param, - get_file_attributes_cb, cbd, g_free) > 0) + get_file_attributes_cb, cbd, l_free) > 0) return; qmi_param_free(param); @@ -196,7 +196,7 @@ static void qmi_read_attributes(struct ofono_sim *sim, int fileid, error: CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, EF_STATUS_INVALIDATED, cbd->data); - g_free(cbd); + l_free(cbd); } static void read_generic_cb(struct qmi_result *result, void *user_data) @@ -255,14 +255,14 @@ static void qmi_read_transparent(struct ofono_sim *sim, qmi_param_append(param, 0x03, sizeof(read_data), read_data); if (qmi_service_send(data->uim, QMI_UIM_READ_TRANSPARENT, param, - read_generic_cb, cbd, g_free) > 0) + read_generic_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: CALLBACK_WITH_FAILURE(cb, NULL, 0, user_data); - g_free(cbd); + l_free(cbd); } static void qmi_read_record(struct ofono_sim *sim, @@ -298,14 +298,14 @@ static void qmi_read_record(struct ofono_sim *sim, qmi_param_append(param, 0x03, sizeof(read_data), read_data); if (qmi_service_send(data->uim, QMI_UIM_READ_RECORD, param, - read_generic_cb, cbd, g_free) > 0) + read_generic_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: CALLBACK_WITH_FAILURE(cb, NULL, 0, user_data); - g_free(cbd); + l_free(cbd); } static void write_generic_cb(struct qmi_result *result, void *user_data) @@ -380,14 +380,14 @@ static void write_generic(struct ofono_sim *sim, qmi_param_append(param, 0x03, 4 + length, write_data); if (qmi_service_send(data->uim, qmi_message, param, - write_generic_cb, cbd, g_free) > 0) + write_generic_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: CALLBACK_WITH_FAILURE(cb, user_data); - g_free(cbd); + l_free(cbd); } static void qmi_write_transparent(struct ofono_sim *sim, @@ -456,12 +456,12 @@ static void qmi_read_imsi(struct ofono_sim *sim, DBG(""); if (qmi_service_send(data->dms, QMI_DMS_GET_IMSI, NULL, - get_imsi_cb, cbd, g_free) > 0) + get_imsi_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } /* Return true if a retry could give another (better) result */ @@ -651,12 +651,12 @@ static void qmi_query_passwd_state(struct ofono_sim *sim, cbd->user = sim; if (qmi_service_send(data->uim, QMI_UIM_GET_CARD_STATUS, NULL, - query_passwd_state_cb, cbd, g_free) > 0) + query_passwd_state_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - g_free(cbd); + l_free(cbd); } static void query_pin_retries_cb(struct qmi_result *result, void *user_data) @@ -689,12 +689,12 @@ static void qmi_query_pin_retries(struct ofono_sim *sim, DBG(""); if (qmi_service_send(data->uim, QMI_UIM_GET_CARD_STATUS, NULL, - query_pin_retries_cb, cbd, g_free) > 0) + query_pin_retries_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } static void pin_send_cb(struct qmi_result *result, void *user_data) @@ -748,14 +748,14 @@ static void qmi_pin_send(struct ofono_sim *sim, const char *passwd, session_info_data); if (qmi_service_send(data->uim, QMI_UIM_VERIFY_PIN, param, - pin_send_cb, cbd, g_free) > 0) + pin_send_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void get_card_status_cb(struct qmi_result *result, void *user_data) @@ -898,7 +898,7 @@ static int qmi_sim_probe(struct ofono_sim *sim, DBG(""); - data = g_new0(struct sim_data, 1); + data = l_new(struct sim_data, 1); data->qmi_dev = device; @@ -937,7 +937,7 @@ static void qmi_sim_remove(struct ofono_sim *sim) data->dms = NULL; } - g_free(data); + l_free(data); } static const struct ofono_sim_driver driver = { diff --git a/drivers/qmimodem/sms.c b/drivers/qmimodem/sms.c index f8ed96c435e0..498a6d778303 100644 --- a/drivers/qmimodem/sms.c +++ b/drivers/qmimodem/sms.c @@ -97,12 +97,12 @@ static void qmi_sca_query(struct ofono_sms *sms, DBG(""); if (qmi_service_send(data->wms, QMI_WMS_GET_SMSC_ADDR, NULL, - get_smsc_addr_cb, cbd, g_free) > 0) + get_smsc_addr_cb, cbd, l_free) > 0) return; CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); - g_free(cbd); + l_free(cbd); } static void set_smsc_addr_cb(struct qmi_result *result, void *user_data) @@ -152,14 +152,14 @@ static void qmi_sca_set(struct ofono_sms *sms, strlen(type), type); if (qmi_service_send(data->wms, QMI_WMS_SET_SMSC_ADDR, param, - set_smsc_addr_cb, cbd, g_free) > 0) + set_smsc_addr_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void raw_send_cb(struct qmi_result *result, void *user_data) @@ -205,12 +205,12 @@ static void qmi_submit(struct ofono_sms *sms, qmi_param_append(param, QMI_WMS_PARAM_MESSAGE, 3 + pdu_len, message); if (qmi_service_send(data->wms, QMI_WMS_RAW_SEND, param, - raw_send_cb, cbd, g_free) > 0) + raw_send_cb, cbd, l_free) > 0) return; qmi_param_free(param); CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - g_free(cbd); + l_free(cbd); } static int domain_to_bearer(uint8_t domain) @@ -281,13 +281,13 @@ static void qmi_bearer_query(struct ofono_sms *sms, goto error; if (qmi_service_send(data->wms, QMI_WMS_GET_DOMAIN_PREF, NULL, - get_domain_pref_cb, cbd, g_free) > 0) + get_domain_pref_cb, cbd, l_free) > 0) return; error: CALLBACK_WITH_FAILURE(cb, -1, cbd->data); - g_free(cbd); + l_free(cbd); } static void set_domain_pref_cb(struct qmi_result *result, void *user_data) @@ -323,14 +323,14 @@ static void qmi_bearer_set(struct ofono_sms *sms, int bearer, param = qmi_param_new_uint8(QMI_WMS_PARAM_DOMAIN, domain); if (qmi_service_send(data->wms, QMI_WMS_SET_DOMAIN_PREF, param, - set_domain_pref_cb, cbd, g_free) > 0) + set_domain_pref_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: CALLBACK_WITH_FAILURE(cb, cbd->data); - g_free(cbd); + l_free(cbd); } static void delete_msg_cb(struct qmi_result *result, void *user_data) @@ -492,7 +492,7 @@ static void get_msg_list_cb(struct qmi_result *result, void *user_data) /* free list from last time */ if (data->msg_list) { - g_free(data->msg_list); + l_free(data->msg_list); data->msg_list = NULL; } @@ -500,10 +500,7 @@ static void get_msg_list_cb(struct qmi_result *result, void *user_data) if (cnt) { int msg_size = cnt * sizeof(list->msg[0]); - data->msg_list = g_try_malloc0(sizeof(list->cnt) + msg_size); - if (data->msg_list == NULL) - goto done; - + data->msg_list = l_malloc(sizeof(list->cnt) + msg_size); data->msg_list->cnt = cnt; memcpy(data->msg_list->msg, list->msg, msg_size); @@ -785,7 +782,7 @@ static int qmi_sms_probe(struct ofono_sms *sms, DBG(""); - data = g_new0(struct sms_data, 1); + data = l_new(struct sms_data, 1); ofono_sms_set_data(sms, data); @@ -807,9 +804,9 @@ static void qmi_sms_remove(struct ofono_sms *sms) qmi_service_unref(data->wms); if (data->msg_list) - g_free(data->msg_list); + l_free(data->msg_list); - g_free(data); + l_free(data); } static const struct ofono_sms_driver driver = { diff --git a/drivers/qmimodem/ussd.c b/drivers/qmimodem/ussd.c index cfdf3ed97ce5..67dd649f360b 100644 --- a/drivers/qmimodem/ussd.c +++ b/drivers/qmimodem/ussd.c @@ -197,7 +197,7 @@ static int qmi_ussd_probe(struct ofono_ussd *ussd, DBG(""); - data = g_new0(struct ussd_data, 1); + data = l_new(struct ussd_data, 1); ofono_ussd_set_data(ussd, data); @@ -217,7 +217,7 @@ static void qmi_ussd_remove(struct ofono_ussd *ussd) qmi_service_unref(data->voice); - g_free(data); + l_free(data); } static void qmi_ussd_cancel(struct ofono_ussd *ussd, @@ -292,7 +292,7 @@ static void qmi_ussd_request(struct ofono_ussd *ussd, int dcs, qmi_ussd->dcs = QMI_USSD_DCS_ASCII; qmi_ussd->length = len; memcpy(qmi_ussd->data, utf8, utf8_len); - g_free(utf8); + l_free(utf8); param = qmi_param_new(); if (param == NULL) @@ -302,12 +302,12 @@ static void qmi_ussd_request(struct ofono_ussd *ussd, int dcs, sizeof(struct qmi_ussd_data) + utf8_len, qmi_ussd); if (qmi_service_send(ud->voice, QMI_VOICE_ASYNC_ORIG_USSD, param, - qmi_ussd_request_cb, cbd, g_free) > 0) + qmi_ussd_request_cb, cbd, l_free) > 0) return; qmi_param_free(param); error: - g_free(cbd); + l_free(cbd); CALLBACK_WITH_FAILURE(cb, data); } diff --git a/drivers/qmimodem/util.h b/drivers/qmimodem/util.h index 7e049322636a..68bc93837c71 100644 --- a/drivers/qmimodem/util.h +++ b/drivers/qmimodem/util.h @@ -20,6 +20,7 @@ */ #include +#include struct cb_data { void *cb; @@ -32,7 +33,7 @@ static inline struct cb_data *cb_data_new(void *cb, void *data) { struct cb_data *ret; - ret = g_new0(struct cb_data, 1); + ret = l_new(struct cb_data, 1); ret->cb = cb; ret->data = data; ret->user = NULL; @@ -54,7 +55,7 @@ static inline void cb_data_unref(gpointer user_data) if (--cbd->ref) return; - g_free(cbd); + l_free(cbd); } #define CALLBACK_WITH_CME_ERROR(cb, err, args...) \ diff --git a/drivers/qmimodem/voicecall.c b/drivers/qmimodem/voicecall.c index 059edbae9ac5..aa34fc25a860 100644 --- a/drivers/qmimodem/voicecall.c +++ b/drivers/qmimodem/voicecall.c @@ -69,7 +69,7 @@ static int qmi_voicecall_probe(struct ofono_voicecall *vc, DBG(""); - data = g_new0(struct voicecall_data, 1); + data = l_new(struct voicecall_data, 1); ofono_voicecall_set_data(vc, data); @@ -92,7 +92,7 @@ static void qmi_voicecall_remove(struct ofono_voicecall *vc) qmi_service_unref(data->voice); - g_free(data); + l_free(data); } static const struct ofono_voicecall_driver driver = { From patchwork Mon Mar 4 20:34:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13581204 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47706DF67 for ; Mon, 4 Mar 2024 20:35:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584513; cv=none; b=pnmMdj4gqeR0PUd//CP3t99Ae4wzib7Rx3DzqzEgDcC29jFOQLVAlxOUIFguCLwdJuaonehKhvEPbJF65FBQ9ZNwKwROYmrrBUq6tGo7cZO+8p9xyYWhIkr250xglg7spX4/+2QHjILy14HJRQbtluOqDfIYvud8JezQntIeDXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584513; c=relaxed/simple; bh=2CUfWYq3y27tOaRpFJ/cbfcDnKbyFcS47qA/7tKm8z8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C2X8IAUVOjl47jIxAJoGoBN3q6ReXoomfuy/HxEJBtQ4Zh5pAUSlB2KHqxk0WPCCSdD6SMfujLen4UgNsOknmFvgdxRjjtOXLJ3oMuPC6bRdA7dh3gWIW0wacR+f/UVXPB6HhZvLeXfRiYkw+Ng2M732RxpnoJzUruc+qN0M4Mo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fnkzrVnK; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fnkzrVnK" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3c1ea5f29a6so978287b6e.0 for ; Mon, 04 Mar 2024 12:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709584510; x=1710189310; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CSoC2qhrdyWQr14EwBaZrLgwGrmKcZu62+6s24z+/GQ=; b=fnkzrVnKMQEHwnmzkGzzhyWnhaXKy4tIOG3lnNPUGLSo162fVJy8kiQszUO0D4n934 wngTuU4aCPFq7eZJAd39U9+AAM4xjwYvxXjLrta3IhHXvh28OwALa10I5W7EgZns9uJ1 O8inw5p914cluVq4vwXbAG655JXLGy4DAj1ulGbjcpjiI29mRTd3jPWr7kYuYBomflX4 WyNKLGSbUFPymxmqCZ1EQNvAb8NLzJlaW0uNh41/BRpiia6rsXLaMf5h4oDS0ya1jGVh cevxnMzJvO49tzOOqvBCM+BUnVALmZKEG+/xG5Z8FVE3RSbOPYn3hmNjabnr75bSKlIg 4NaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709584510; x=1710189310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CSoC2qhrdyWQr14EwBaZrLgwGrmKcZu62+6s24z+/GQ=; b=uOAhgvXWf5pkZCvHjku8WNJlAvaooVS92iPMSS1ixIETbEiINFFmD/mbqYUWcTuFcA H+vWajHG9jjF05HFHVAi8wkWhSaVvjTXRQ8vWbB0emcMWAo8Bhf4DUn6ihp04ucM8ndd McffNn9wJS/P59MS9bJBMIX/JXjwim/JR6M0bG/1HbjEmyY3PVaH/GXrnQXW1sl3VnK0 cm4qzYWIYlyzxGgsjMtbS+3GEyqZfcebcDXMmr+Cil7vFi4TLRI4TGF92mg8F6+ITi6S Y15qjc3kTHjsyfF+6PgN1iFmqweZwfX1n+0Xr/1JSyz8KPL9bCINlpaqKKcdmdDBqMFa KEhA== X-Gm-Message-State: AOJu0Ywz0LV6O+uLoMFye8hO3PClbO7O7rtCrqO5WmLki/CsUqwzkyEV Fs6w7o2iAVXVHle7HpO1S3fkInCaDgbGVKn0/zLUcM0qR2qnRIXCqASpcORw X-Google-Smtp-Source: AGHT+IFqX1wysD4sTXJ9oWoT/WhzehLyd9mpSv6jY4SlU67Ci5Kax2cAF/g8fjdvXiGJ63ffx/ANyA== X-Received: by 2002:a05:6808:eca:b0:3c1:c7cb:13f6 with SMTP id q10-20020a0568080eca00b003c1c7cb13f6mr13139597oiv.22.1709584510462; Mon, 04 Mar 2024 12:35:10 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 1-20020aca2101000000b003c0408e5b06sm1642582oiz.55.2024.03.04.12.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 12:35:10 -0800 (PST) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 4/5] gobi: Replace g_try_new0 / g_free with ell equivalents Date: Mon, 4 Mar 2024 14:34:52 -0600 Message-ID: <20240304203506.1725220-4-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240304203506.1725220-1-denkenz@gmail.com> References: <20240304203506.1725220-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- plugins/gobi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/gobi.c b/plugins/gobi.c index 99a7d5564ed8..8d3b7ef4cdfc 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -101,9 +101,7 @@ static int gobi_probe(struct ofono_modem *modem) DBG("%p", modem); - data = g_try_new0(struct gobi_data, 1); - if (!data) - return -ENOMEM; + data = l_new(struct gobi_data, 1); kernel_driver = ofono_modem_get_string(modem, "KernelDriver"); DBG("kernel_driver: %s", kernel_driver); @@ -149,7 +147,7 @@ static void gobi_remove(struct ofono_modem *modem) qmi_device_free(data->device); - g_free(data); + l_free(data); } static void shutdown_cb(void *user_data) From patchwork Mon Mar 4 20:34:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13581203 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC332749A for ; Mon, 4 Mar 2024 20:35:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584513; cv=none; b=sQBhmDqvmK+lEYouc/OTAVXPzry4LQ3qfXQI1uNgWSuZ5KjsQHFH3BuDF5DH0OwwtRUCPkr12n+Td0lat1UiDL2iWLNMssbsHmOll+QWsqrRV3f6ESIDiouLJuEJ9agRwlwGWHybkexywVUYQ5WReLGBLKYylI7NyQnLp61REC0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709584513; c=relaxed/simple; bh=7+f3H9ivSlZI/TYfx1m1FU6si7EsWtNg1cX7y3jZFjw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S/rKptMlJEE5DiNJjzoaVsNs3ZQvEaROeNm17ghwr01SBMwhUr7fPjnH8LZ1ybFMRh/U0bjR60p2O/JYnGbPy9Bj2uLonB748fFaWWCrj6c/l1F11q8Y3IkyTm4C8iVYa3QXxEm8WDDtSasAIzLS+884EQRkxhN++oKy7kVBFtQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DU2m8uPR; arc=none smtp.client-ip=209.85.167.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DU2m8uPR" Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3c1a1e1e539so4680720b6e.1 for ; Mon, 04 Mar 2024 12:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709584511; x=1710189311; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=df/4SI/FqCQy20jdCEwfRILnyJTVzpPKGctX5KcrXzo=; b=DU2m8uPRab5n9qWxdyEi1WGWEQvsKk6x9UirfBYO7pWwN4Zmcpgd5VzGsUFMVhqFcN /yU7xXwyGU+stDoShc4uNyzwgID3a2Gy8kNBX6r3/sPBFco8PO9SYOd6pNJHDMKoLo6n aducWiTPD3pQ9fQ4Ui5tL6FEiDAM3pOtoYQMOegcDo5p7QrcZudzCRqwgNS1X4scZ2Xi z2tOV9WoSKUO5j8fKGc8n3P754EYYtzOqmboxtAznSBhzso/YSHQdWKRrfBYDfZ1ZEY3 a1WIG3nuyOpDGeQYrtSyk5DXfeybe8RZPH27cZY4ZsCyPsqqYOVHsJSm5+oEjp87LGSq mhFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709584511; x=1710189311; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=df/4SI/FqCQy20jdCEwfRILnyJTVzpPKGctX5KcrXzo=; b=c6ot6/3vAhtaxJDfqz3/3YXNTlthVjLRSfTP1H7iAnvdNys+EuZfSobf3Mjni4aTPQ NbtBHqon1vXAFcs2EvGXNusbeVseIqjAOTTb43NDafkxfKaaPRfb1uwBEvMf0hDJ/cE6 76k6aq6PB1jQmPOpt8UEfAnvyeAt8dDoFfc0LTMv0eoperJOkfhUeiZwFBdLh1xFAzO2 fNXhJEg6hzJN8mPT3VU0RMzfl+hFG+b4+XW0p3f564/lUUBrjD9bj1IBDZYE+Hxl9sZz ZwnXQKlI4ACLXNpr9fniEglWfF5U6girx/aOaP4Stopm5/OM1TgmvDHdBuUXA6y9APT1 t9MA== X-Gm-Message-State: AOJu0YxnQKPRP8ZNT0HOsOuXP/qUOnLB4oz4yE0NnZaoL4AWP83olacr BSp/u6Y0rfQGpaY5dCpbZ0SHi87ESixrE26gxgTXcxJkOg6laveKMQqOMfqZ X-Google-Smtp-Source: AGHT+IGASKZAY3UBC74dtuXfGGQovnvjbuMBYZkXYjnrVoBDB3veglCI+FAGbl48v0cLj5/W4bavIA== X-Received: by 2002:a05:6808:23ca:b0:3c1:ae6f:e2dc with SMTP id bq10-20020a05680823ca00b003c1ae6fe2dcmr12294647oib.12.1709584510951; Mon, 04 Mar 2024 12:35:10 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 1-20020aca2101000000b003c0408e5b06sm1642582oiz.55.2024.03.04.12.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 12:35:10 -0800 (PST) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 5/5] qmimodem: Remove glib use from util.[ch] Date: Mon, 4 Mar 2024 14:34:53 -0600 Message-ID: <20240304203506.1725220-5-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240304203506.1725220-1-denkenz@gmail.com> References: <20240304203506.1725220-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 glib use is retained by sim and sim-legacy drivers since these drivers utilize sim related utilities that have not yet been ported to ell. Also, sim driver uses a single glib timeout source --- drivers/qmimodem/sim-legacy.c | 2 ++ drivers/qmimodem/sim.c | 2 ++ drivers/qmimodem/util.h | 3 +-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/qmimodem/sim-legacy.c b/drivers/qmimodem/sim-legacy.c index e9ed0a9ec4c1..fd05f219ea52 100644 --- a/drivers/qmimodem/sim-legacy.c +++ b/drivers/qmimodem/sim-legacy.c @@ -30,6 +30,8 @@ #include #include +#include + #include "qmi.h" #include "dms.h" #include "util.h" diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c index 110af6686627..8605e03c6f4f 100644 --- a/drivers/qmimodem/sim.c +++ b/drivers/qmimodem/sim.c @@ -29,6 +29,8 @@ #include #include +#include + #include "qmi.h" #include "dms.h" #include "uim.h" diff --git a/drivers/qmimodem/util.h b/drivers/qmimodem/util.h index 68bc93837c71..8c0c3c3c76ce 100644 --- a/drivers/qmimodem/util.h +++ b/drivers/qmimodem/util.h @@ -19,7 +19,6 @@ * */ -#include #include struct cb_data { @@ -48,7 +47,7 @@ static inline struct cb_data *cb_data_ref(struct cb_data *cbd) return cbd; } -static inline void cb_data_unref(gpointer user_data) +static inline void cb_data_unref(void *user_data) { struct cb_data *cbd = user_data;