return -EOPNOTSUPP;
if (!link->dev)
- return -EOPNOTSUPP;
+ return -ENODEV;
r = sd_device_get_devtype(link->dev, &s);
if (r < 0)
assert(link);
r = link_get_wiphy(link, &w);
- if (IN_SET(r, -EOPNOTSUPP, -ENODEV))
- return false; /* Typically, non-wifi interface or running in container */
- if (r < 0)
+ if (r < 0) {
+ if (ERRNO_IS_NOT_SUPPORTED(r) || ERRNO_IS_DEVICE_ABSENT(r))
+ return false; /* Typically, non-wifi interface or running in container */
return log_link_debug_errno(link, r, "Could not get phy: %m");
+ }
return wiphy_rfkilled(w);
}
w->dev = sd_device_unref(w->dev);
r = sd_device_new_from_subsystem_sysname(&dev, "ieee80211", w->name);
- if (r < 0) {
- /* The corresponding syspath may not exist yet, and may appear later. */
- log_wiphy_debug_errno(w, r, "Failed to get wiphy device, ignoring: %m");
- return 0;
- }
+ if (r < 0)
+ return r;
if (DEBUG_LOGGING) {
const char *s = NULL;
return r;
rfkill = sd_device_enumerator_get_device_first(e);
- if (!rfkill) {
+ if (!rfkill)
/* rfkill device may not detected by the kernel yet, and may appear later. */
- log_wiphy_debug_errno(w, SYNTHETIC_ERRNO(ENODEV), "No rfkill device found, ignoring.");
- return 0;
- }
+ return -ENODEV;
if (sd_device_enumerator_get_device_next(e))
- return log_wiphy_debug_errno(w, SYNTHETIC_ERRNO(EEXIST), "Multiple rfkill devices found.");
+ return -ENXIO; /* multiple devices found */
w->rfkill = sd_device_ref(rfkill);
assert(w);
r = wiphy_update_device(w);
- if (r < 0)
- return log_wiphy_debug_errno(w, r, "Failed to update wiphy device: %m");
+ if (r < 0) {
+ if (ERRNO_IS_DEVICE_ABSENT(r))
+ log_wiphy_debug_errno(w, r, "Failed to update wiphy device, ignoring: %m");
+ else
+ return log_wiphy_warning_errno(w, r, "Failed to update wiphy device: %m");
+ }
r = wiphy_update_rfkill(w);
- if (r < 0)
- return log_wiphy_debug_errno(w, r, "Failed to update rfkill device: %m");
+ if (r < 0) {
+ if (ERRNO_IS_DEVICE_ABSENT(r))
+ log_wiphy_debug_errno(w, r, "Failed to update rfkill device, ignoring: %m");
+ else
+ return log_wiphy_warning_errno(w, r, "Failed to update rfkill device: %m");
+ }
return 0;
}