device: remove debug logging from is_available()
Having logging statements in a simple getter (or is_*()) means you cannot call these functions without cluttering the log. Another approach would be to add an @out_reason argument, and callers who actually care log the reason. For now, just get rid of the messages.
This commit is contained in:
@@ -1142,22 +1142,16 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
|||||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||||
guint32 state;
|
guint32 state;
|
||||||
|
|
||||||
if (!priv->enabled) {
|
if (!priv->enabled)
|
||||||
_LOGD (LOGD_WIFI, "not available because not enabled");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!priv->sup_iface) {
|
if (!priv->sup_iface)
|
||||||
_LOGD (LOGD_WIFI, "not available because supplicant not running");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
state = nm_supplicant_interface_get_state (priv->sup_iface);
|
state = nm_supplicant_interface_get_state (priv->sup_iface);
|
||||||
if ( state < NM_SUPPLICANT_INTERFACE_STATE_READY
|
if ( state < NM_SUPPLICANT_INTERFACE_STATE_READY
|
||||||
|| state > NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) {
|
|| state > NM_SUPPLICANT_INTERFACE_STATE_COMPLETED)
|
||||||
_LOGD (LOGD_WIFI, "not available because supplicant interface not ready");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -491,27 +491,18 @@ static gboolean
|
|||||||
is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
||||||
{
|
{
|
||||||
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device);
|
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device);
|
||||||
const char *iface = nm_device_get_iface (device);
|
|
||||||
|
|
||||||
if (!priv->enabled) {
|
if (!priv->enabled)
|
||||||
nm_log_dbg (LOGD_WIMAX, "(%s): not available because not enabled", iface);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!priv->wimaxd_enabled) {
|
if (!priv->wimaxd_enabled)
|
||||||
nm_log_dbg (LOGD_WIMAX, "(%s): not available because not enabled in wimaxd", iface);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!nm_wimax_util_sdk_is_initialized ()) {
|
if (!nm_wimax_util_sdk_is_initialized ())
|
||||||
nm_log_dbg (LOGD_WIMAX, "(%s): not available because WiMAX SDK not initialized", iface);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!priv->sdk) {
|
if (!priv->sdk)
|
||||||
nm_log_dbg (LOGD_WIMAX, "(%s): not available because not known to WiMAX SDK", iface);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
return iwmxsdk_status_get (priv->sdk) >= WIMAX_API_DEVICE_STATUS_Ready;
|
return iwmxsdk_status_get (priv->sdk) >= WIMAX_API_DEVICE_STATUS_Ready;
|
||||||
}
|
}
|
||||||
|
@@ -587,21 +587,16 @@ static gboolean
|
|||||||
is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
||||||
{
|
{
|
||||||
NMDeviceModem *self = NM_DEVICE_MODEM (device);
|
NMDeviceModem *self = NM_DEVICE_MODEM (device);
|
||||||
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device);
|
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (self);
|
||||||
NMModemState modem_state;
|
NMModemState modem_state;
|
||||||
|
|
||||||
if (!priv->rf_enabled) {
|
if (!priv->rf_enabled)
|
||||||
_LOGD (LOGD_MB, "not available because WWAN airplane mode is on");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
g_assert (priv->modem);
|
g_assert (priv->modem);
|
||||||
modem_state = nm_modem_get_state (priv->modem);
|
modem_state = nm_modem_get_state (priv->modem);
|
||||||
if (modem_state <= NM_MODEM_STATE_INITIALIZING) {
|
if (modem_state <= NM_MODEM_STATE_INITIALIZING)
|
||||||
_LOGD (LOGD_MB, "not available because modem is not ready (%s)",
|
|
||||||
nm_modem_state_to_string (modem_state));
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user