From 92f42583267d109129b531e689a119984cd66384 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 20 Jan 2015 21:20:32 +0100 Subject: [PATCH] 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. (cherry picked from commit e524be2c345431c53bc34af6e114c73def1d5891) --- src/devices/wifi/nm-device-wifi.c | 12 +++--------- src/devices/wimax/nm-device-wimax.c | 17 ++++------------- src/devices/wwan/nm-device-modem.c | 11 +++-------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index caebdf53e5..e4877ea354 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -1141,22 +1141,16 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags) NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); guint32 state; - if (!priv->enabled) { - _LOGD (LOGD_WIFI, "not available because not enabled"); + if (!priv->enabled) return FALSE; - } - if (!priv->sup_iface) { - _LOGD (LOGD_WIFI, "not available because supplicant not running"); + if (!priv->sup_iface) return FALSE; - } state = nm_supplicant_interface_get_state (priv->sup_iface); if ( state < NM_SUPPLICANT_INTERFACE_STATE_READY - || state > NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) { - _LOGD (LOGD_WIFI, "not available because supplicant interface not ready"); + || state > NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) return FALSE; - } return TRUE; } diff --git a/src/devices/wimax/nm-device-wimax.c b/src/devices/wimax/nm-device-wimax.c index 0394617589..0c8f1cbbe3 100644 --- a/src/devices/wimax/nm-device-wimax.c +++ b/src/devices/wimax/nm-device-wimax.c @@ -491,27 +491,18 @@ static gboolean is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags) { NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device); - const char *iface = nm_device_get_iface (device); - if (!priv->enabled) { - nm_log_dbg (LOGD_WIMAX, "(%s): not available because not enabled", iface); + if (!priv->enabled) return FALSE; - } - if (!priv->wimaxd_enabled) { - nm_log_dbg (LOGD_WIMAX, "(%s): not available because not enabled in wimaxd", iface); + if (!priv->wimaxd_enabled) return FALSE; - } - if (!nm_wimax_util_sdk_is_initialized ()) { - nm_log_dbg (LOGD_WIMAX, "(%s): not available because WiMAX SDK not initialized", iface); + if (!nm_wimax_util_sdk_is_initialized ()) return FALSE; - } - if (!priv->sdk) { - nm_log_dbg (LOGD_WIMAX, "(%s): not available because not known to WiMAX SDK", iface); + if (!priv->sdk) return FALSE; - } return iwmxsdk_status_get (priv->sdk) >= WIMAX_API_DEVICE_STATUS_Ready; } diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c index f45abc5cf7..8fbbb9a455 100644 --- a/src/devices/wwan/nm-device-modem.c +++ b/src/devices/wwan/nm-device-modem.c @@ -543,21 +543,16 @@ static gboolean is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags) { 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; - if (!priv->rf_enabled) { - _LOGD (LOGD_MB, "not available because WWAN airplane mode is on"); + if (!priv->rf_enabled) return FALSE; - } g_assert (priv->modem); modem_state = nm_modem_get_state (priv->modem); - 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)); + if (modem_state <= NM_MODEM_STATE_INITIALIZING) return FALSE; - } return TRUE; }