mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-09 09:12:54 +00:00
Allow plugins to set remove delay only on the child
Force the FuDevice parent to have the largest of the child removal delays. This avoids each plugin enumerating the children (which may not even be added yet) to increase the length of the allowed parent delay.
This commit is contained in:
parent
6d9ae625ed
commit
1ec96e31f5
@ -770,6 +770,17 @@ fu_device_add_child (FuDevice *self, FuDevice *child)
|
||||
}
|
||||
g_ptr_array_add (priv->children, g_object_ref (child));
|
||||
|
||||
/* ensure the parent has the MAX() of the childrens removal delay */
|
||||
for (guint i = 0; i < priv->children->len; i++) {
|
||||
FuDevice *child_tmp = g_ptr_array_index (priv->children, i);
|
||||
guint remove_delay = fu_device_get_remove_delay (child_tmp);
|
||||
if (remove_delay > priv->remove_delay) {
|
||||
g_debug ("setting remove delay to %u as child is greater than %u",
|
||||
remove_delay, priv->remove_delay);
|
||||
priv->remove_delay = remove_delay;
|
||||
}
|
||||
}
|
||||
|
||||
/* copy from main device if unset */
|
||||
if (fu_device_get_physical_id (child) == NULL &&
|
||||
fu_device_get_physical_id (self) != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user