From 3bb86bc2e49a00bbec2e95298cfe21cfc9bf2299 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 9 Mar 2022 13:20:23 +0100 Subject: qmi-firmware-update: make qfu_helpers_find_by_file_path() generic It doesn't really depend on the udev backend, as it just calls qfu_helpers_find_by_file(). --- src/qmi-firmware-update/qfu-helpers-sysfs.c | 8 -------- src/qmi-firmware-update/qfu-helpers-udev.c | 13 ------------- src/qmi-firmware-update/qfu-helpers.c | 13 +++++++++++++ src/qmi-firmware-update/qfu-helpers.h | 8 ++++---- 4 files changed, 17 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/qmi-firmware-update/qfu-helpers-sysfs.c b/src/qmi-firmware-update/qfu-helpers-sysfs.c index a8426e9c..ecfd12ca 100644 --- a/src/qmi-firmware-update/qfu-helpers-sysfs.c +++ b/src/qmi-firmware-update/qfu-helpers-sysfs.c @@ -38,14 +38,6 @@ qfu_helpers_sysfs_find_by_file (GFile *file, return NULL; } -gchar * -qfu_helpers_sysfs_find_by_file_path (const gchar *path, - GError **error) -{ - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "not implemented"); - return NULL; -} - gchar * qfu_helpers_sysfs_find_by_device_info (guint16 vid, guint16 pid, diff --git a/src/qmi-firmware-update/qfu-helpers-udev.c b/src/qmi-firmware-update/qfu-helpers-udev.c index c8a030c2..667ce038 100644 --- a/src/qmi-firmware-update/qfu-helpers-udev.c +++ b/src/qmi-firmware-update/qfu-helpers-udev.c @@ -200,19 +200,6 @@ out: return sysfs_path; } -gchar * -qfu_helpers_udev_find_by_file_path (const gchar *path, - GError **error) -{ - GFile *file; - gchar *sysfs_path; - - file = g_file_new_for_path (path); - sysfs_path = qfu_helpers_udev_find_by_file (file, error); - g_object_unref (file); - return sysfs_path; -} - /******************************************************************************/ static gboolean diff --git a/src/qmi-firmware-update/qfu-helpers.c b/src/qmi-firmware-update/qfu-helpers.c index 36c86811..2ed15dca 100644 --- a/src/qmi-firmware-update/qfu-helpers.c +++ b/src/qmi-firmware-update/qfu-helpers.c @@ -40,6 +40,19 @@ qfu_helpers_device_type_to_string (QfuHelpersDeviceType type) /******************************************************************************/ +gchar * +qfu_helpers_find_by_file_path (const gchar *path, + GError **error) +{ + GFile *file; + gchar *sysfs_path; + + file = g_file_new_for_path (path); + sysfs_path = qfu_helpers_find_by_file (file, error); + g_object_unref (file); + return sysfs_path; +} + gchar * qfu_helpers_find_peer_port (const gchar *sysfs_path, GError **error) diff --git a/src/qmi-firmware-update/qfu-helpers.h b/src/qmi-firmware-update/qfu-helpers.h index f2202fe9..5a25a37c 100644 --- a/src/qmi-firmware-update/qfu-helpers.h +++ b/src/qmi-firmware-update/qfu-helpers.h @@ -38,15 +38,16 @@ const gchar *qfu_helpers_device_type_to_string (QfuHelpersDeviceType type); /******************************************************************************/ -gchar *qfu_helpers_find_peer_port (const gchar *sysfs_path, - GError **error); +gchar *qfu_helpers_find_by_file_path (const gchar *path, + GError **error); +gchar *qfu_helpers_find_peer_port (const gchar *sysfs_path, + GError **error); /******************************************************************************/ #if defined WITH_UDEV # include "qfu-helpers-udev.h" # define qfu_helpers_find_by_file qfu_helpers_udev_find_by_file -# define qfu_helpers_find_by_file_path qfu_helpers_udev_find_by_file_path # define qfu_helpers_find_by_device_info qfu_helpers_udev_find_by_device_info # define qfu_helpers_list_devices qfu_helpers_udev_list_devices # define qfu_helpers_wait_for_device qfu_helpers_udev_wait_for_device @@ -54,7 +55,6 @@ gchar *qfu_helpers_find_peer_port (const gchar *sysfs_path, #else # include "qfu-helpers-sysfs.h" # define qfu_helpers_find_by_file qfu_helpers_sysfs_find_by_file -# define qfu_helpers_find_by_file_path qfu_helpers_sysfs_find_by_file_path # define qfu_helpers_find_by_device_info qfu_helpers_sysfs_find_by_device_info # define qfu_helpers_list_devices qfu_helpers_sysfs_list_devices # define qfu_helpers_wait_for_device qfu_helpers_sysfs_wait_for_device -- cgit v1.2.1