ofono: Remove unused set_cm_powered
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Tue, 20 Dec 2011 16:55:10 +0000 (17:55 +0100)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 22 Dec 2011 10:10:15 +0000 (11:10 +0100)
Also follow the patternt that we have only a set function
with an argument for the value tos set.

plugins/ofono.c

index 037524a..87b83c2 100644 (file)
@@ -134,8 +134,6 @@ struct modem_data {
        connman_bool_t attached;
        connman_bool_t cm_powered;
 
-       connman_bool_t set_cm_powered;
-
        /* ConnectionContext Interface */
        connman_bool_t active;
        connman_bool_t set_active;
@@ -574,33 +572,22 @@ static int modem_set_online(struct modem_data *modem, connman_bool_t online)
                                NULL);
 }
 
-static void cm_set_powered_reply(struct modem_data *modem,
-                                       connman_bool_t success)
-{
-       DBG("%s", modem->path);
-
-       if (success == TRUE) {
-               /*
-                * Don't handle do anything on success here. oFono will send
-                * the change via PropertyChanged singal.
-                */
-               return;
-       }
-
-       modem->set_cm_powered = FALSE;
-}
-
-static int cm_set_powered(struct modem_data *modem)
+static int cm_set_powered(struct modem_data *modem, connman_bool_t powered)
 {
-       DBG("%s", modem->path);
+       int err;
 
-       modem->set_cm_powered = TRUE;
+       DBG("%s powered %d", modem->path, powered);
 
-       return set_property(modem, modem->path,
+       err = set_property(modem, modem->path,
                                OFONO_CM_INTERFACE,
                                "Powered", DBUS_TYPE_BOOLEAN,
-                               &modem->set_cm_powered,
-                               cm_set_powered_reply);
+                               &powered,
+                               NULL);
+
+       if (powered == FALSE && err == -EINPROGRESS)
+               return 0;
+
+       return err;
 }
 
 static int modem_set_powered(struct modem_data *modem)
@@ -1596,7 +1583,7 @@ static void cm_update_powered(struct modem_data *modem,
        if (modem->cm_powered == TRUE)
                return;
 
-       cm_set_powered(modem);
+       cm_set_powered(modem, TRUE);
 }
 
 static gboolean cm_changed(DBusConnection *connection, DBusMessage *message,