diff --git a/src/core/device.c b/src/core/device.c index 50d55289fa..5b8134159a 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -915,20 +915,19 @@ static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void * return 0; } - if (action == DEVICE_ACTION_CHANGE) + if (!IN_SET(action, DEVICE_ACTION_ADD, DEVICE_ACTION_REMOVE, DEVICE_ACTION_MOVE)) device_propagate_reload_by_sysfs(m, sysfs); - /* A change event can signal that a device is becoming ready, in particular if - * the device is using the SYSTEMD_READY logic in udev - * so we need to reach the else block of the following if, even for change events */ + /* A change event can signal that a device is becoming ready, in particular if the device is using + * the SYSTEMD_READY logic in udev so we need to reach the else block of the following if, even for + * change events */ if (action == DEVICE_ACTION_REMOVE) { r = swap_process_device_remove(m, dev); if (r < 0) log_device_warning_errno(dev, r, "Failed to process swap device remove event, ignoring: %m"); - /* If we get notified that a device was removed by - * udev, then it's completely gone, hence unset all - * found bits */ + /* If we get notified that a device was removed by udev, then it's completely gone, hence + * unset all found bits */ device_update_found_by_sysfs(m, sysfs, 0, DEVICE_FOUND_UDEV|DEVICE_FOUND_MOUNT|DEVICE_FOUND_SWAP); } else if (device_is_ready(dev)) { @@ -944,13 +943,10 @@ static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void * /* The device is found now, set the udev found bit */ device_update_found_by_sysfs(m, sysfs, DEVICE_FOUND_UDEV, DEVICE_FOUND_UDEV); - } else { - /* The device is nominally around, but not ready for - * us. Hence unset the udev bit, but leave the rest - * around. */ - + } else + /* The device is nominally around, but not ready for us. Hence unset the udev bit, but leave + * the rest around. */ device_update_found_by_sysfs(m, sysfs, 0, DEVICE_FOUND_UDEV); - } return 0; }