diff options
author | Denis Kenzior <denkenz@gmail.com> | 2024-02-20 10:54:59 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2024-02-21 10:28:22 -0600 |
commit | 63420ccbefb430f26d0b57078c6fc257e8208a0e (patch) | |
tree | 4e4343b837cac7465014bf5dc6723ade2b081813 | |
parent | 7cf914bdd49592f60c535cd2335238d3ff88f100 (diff) | |
download | ofono-63420ccbefb430f26d0b57078c6fc257e8208a0e.tar.gz |
qmi: Remove qmi_device_set_close_on_unref
The only caller of this method always sets close_on_unref to true.
Since the underlying file descriptor is no longer exposed, it is safe to
remove this method and assume that the file descriptor should always be
closed when qmi_device is cleaned up.
-rw-r--r-- | drivers/qmimodem/qmi.c | 13 | ||||
-rw-r--r-- | drivers/qmimodem/qmi.h | 2 | ||||
-rw-r--r-- | plugins/gobi.c | 2 |
3 files changed, 1 insertions, 16 deletions
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index e938c13e1..dd328a5fd 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -63,7 +63,6 @@ struct qmi_device { int ref_count; int fd; GIOChannel *io; - bool close_on_unref; guint read_watch; guint write_watch; struct l_queue *req_queue; @@ -924,7 +923,6 @@ static int qmi_device_init(struct qmi_device *device, int fd, device->ref_count = 1; device->fd = fd; - device->close_on_unref = false; flags = fcntl(device->fd, F_GETFL, NULL); if (flags < 0) @@ -994,8 +992,7 @@ void qmi_device_unref(struct qmi_device *device) if (device->read_watch > 0) g_source_remove(device->read_watch); - if (device->close_on_unref) - close(device->fd); + close(device->fd); if (device->shutdown_source) g_source_remove(device->shutdown_source); @@ -1021,14 +1018,6 @@ void qmi_device_set_debug(struct qmi_device *device, device->debug_data = user_data; } -void qmi_device_set_close_on_unref(struct qmi_device *device, bool do_close) -{ - if (!device) - return; - - device->close_on_unref = do_close; -} - void qmi_result_print_tlvs(struct qmi_result *result) { const void *ptr = result->data; diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h index 410ada04d..ab0ee479c 100644 --- a/drivers/qmimodem/qmi.h +++ b/drivers/qmimodem/qmi.h @@ -87,8 +87,6 @@ void qmi_device_unref(struct qmi_device *device); void qmi_device_set_debug(struct qmi_device *device, qmi_debug_func_t func, void *user_data); -void qmi_device_set_close_on_unref(struct qmi_device *device, bool do_close); - bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func, void *user_data, qmi_destroy_func_t destroy); bool qmi_device_shutdown(struct qmi_device *device, qmi_shutdown_func_t func, diff --git a/plugins/gobi.c b/plugins/gobi.c index 07994666d..e22b8146c 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -435,8 +435,6 @@ static int gobi_enable(struct ofono_modem *modem) if (getenv("OFONO_QMI_DEBUG")) qmi_device_set_debug(data->device, gobi_debug, "QMI: "); - qmi_device_set_close_on_unref(data->device, true); - qmi_device_discover(data->device, discover_cb, modem, NULL); return -EINPROGRESS; |