udevng: Track udev devices through devpath and not syspath

syspath is not really needed in there, and catching devpath instead
allows us to easily match against DEVPATH_OLD in follow-up patches.
Furthermore, previous code was misleading retrieving syspath in
remove_device() and then passing it as devpath param of check_remove().
This commit is contained in:
Pau Espin 2019-04-01 20:12:59 +02:00
parent e77b82a1bd
commit 25705288e4
1 changed files with 6 additions and 6 deletions

View File

@ -1432,16 +1432,16 @@ static gboolean check_remove(gpointer key, gpointer value, gpointer user_data)
static void remove_device(struct udev_device *device)
{
const char *syspath;
const char *devpath;
syspath = udev_device_get_syspath(device);
if (syspath == NULL)
devpath = udev_device_get_devpath(device);
if (devpath == NULL)
return;
DBG("%s", syspath);
DBG("%s", devpath);
g_hash_table_foreach_remove(modem_list, check_remove,
(char *) syspath);
(char *) devpath);
}
static gint compare_device(gconstpointer a, gconstpointer b)
@ -1555,7 +1555,7 @@ static void add_device(const char *syspath, const char *devname,
struct device_info *info;
struct udev_device *parent;
devpath = udev_device_get_syspath(device);
devpath = udev_device_get_devpath(device);
if (devpath == NULL)
return;