summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2011-09-02 13:34:53 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-09-12 11:40:49 +0200
commitbf7f9ce0e205019f7b22108340bdc910f7534ca6 (patch)
tree02ffcfb4fdef0ec435ba236916dc565985750fb0
parent548c773ce685ef6c13108e024b3e1769d3ee8116 (diff)
downloadconnman-bf7f9ce0e205019f7b22108340bdc910f7534ca6.tar.gz
connman-bf7f9ce0e205019f7b22108340bdc910f7534ca6.tar.bz2
connman-bf7f9ce0e205019f7b22108340bdc910f7534ca6.zip
technology: Move bridege checking to set_tethering()
Move bridge checking into set_tethering(), as the bridge information is not used elsewhere.
-rw-r--r--src/technology.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/technology.c b/src/technology.c
index 7ae88c69..3b24917e 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -170,9 +170,9 @@ void connman_technology_tethering_notify(struct connman_technology *technology,
}
static int set_tethering(struct connman_technology *technology,
- const char *bridge, connman_bool_t enabled)
+ connman_bool_t enabled)
{
- const char *ident, *passphrase;
+ const char *ident, *passphrase, *bridge;
ident = technology->tethering_ident;
passphrase = technology->tethering_passphrase;
@@ -181,6 +181,10 @@ static int set_tethering(struct connman_technology *technology,
technology->driver->set_tethering == NULL)
return -EOPNOTSUPP;
+ bridge = __connman_tethering_get_bridge();
+ if (bridge == NULL)
+ return -EOPNOTSUPP;
+
if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
(ident == NULL || passphrase == NULL))
return -EINVAL;
@@ -485,7 +489,6 @@ static DBusMessage *set_property(DBusConnection *conn,
if (g_str_equal(name, "Tethering") == TRUE) {
int err;
connman_bool_t tethering;
- const char *bridge;
if (type != DBUS_TYPE_BOOLEAN)
return __connman_error_invalid_arguments(msg);
@@ -495,11 +498,7 @@ static DBusMessage *set_property(DBusConnection *conn,
if (technology->tethering == tethering)
return __connman_error_in_progress(msg);
- bridge = __connman_tethering_get_bridge();
- if (bridge == NULL)
- return __connman_error_not_supported(msg);
-
- err = set_tethering(technology, bridge, tethering);
+ err = set_tethering(technology, tethering);
if (err < 0)
return __connman_error_failed(msg, -err);