[RFC 1/3] wifi: Don't fetch interface name from device structure

2014-05-06 Thread Patrik Flykt
Update the code to use connman_inet_ifname() when fetching the
interface name. This allows the interface name to be removed from
the device structure, as the interface name is not requested
from the device structure elsewhere.
---
 plugins/wifi.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 7c412ef..ea1c4ae 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -902,18 +902,23 @@ static void interface_create_callback(int result,
 static int wifi_enable(struct connman_device *device)
 {
struct wifi_data *wifi = connman_device_get_data(device);
-   const char *interface = connman_device_get_string(device, "Interface");
+   int index;
+   char *interface;
const char *driver = connman_option_get_string("wifi");
int ret;
 
DBG("device %p %p", device, wifi);
 
-   if (!wifi)
+   index = connman_device_get_index(device);
+   if (!wifi || index < 0)
return -ENODEV;
 
+   interface = connman_inet_ifname(index);
ret = g_supplicant_interface_create(interface, driver, NULL,
interface_create_callback,
wifi);
+   g_free(interface);
+
if (ret < 0)
return ret;
 
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [RFC 1/3] wifi: Don't fetch interface name from device structure

2014-05-14 Thread Patrik Flykt
On Tue, 2014-05-06 at 12:41 +0300, Patrik Flykt wrote:
> Update the code to use connman_inet_ifname() when fetching the
> interface name. This allows the interface name to be removed from
> the device structure, as the interface name is not requested
> from the device structure elsewhere.

Commit messge updated and patch applied. I'll leave out patch 2/3 to
wait for a possible device->interface cleanup that will properly track
interface name changes.

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman