service: __connman_service_notify() prototype change
authorJukka Rissanen <jukka.rissanen@nokia.com>
Thu, 9 Dec 2010 11:11:49 +0000 (13:11 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 14 Dec 2010 14:10:59 +0000 (15:10 +0100)
In preparation for the IPv6 only support, this makes the code more
readable.

src/connman.h
src/ipconfig.c
src/service.c

index 4fa9050..9b8fcc7 100644 (file)
@@ -510,7 +510,7 @@ void __connman_service_set_proxy_autoconfig(struct connman_service *service,
 void __connman_service_set_passphrase(struct connman_service *service,
                                        const char* passphrase);
 
-void __connman_service_notify(struct connman_ipconfig *ipconfig,
+void __connman_service_notify(struct connman_service *service,
                        unsigned int rx_packets, unsigned int tx_packets,
                        unsigned int rx_bytes, unsigned int tx_bytes,
                        unsigned int rx_error, unsigned int tx_error,
index fe99b81..c6e33ec 100644 (file)
@@ -423,6 +423,8 @@ static void __connman_ipconfig_lower_down(struct connman_ipdevice *ipdevice)
 static void update_stats(struct connman_ipdevice *ipdevice,
                                                struct rtnl_link_stats *stats)
 {
+       struct connman_service *service;
+
        if (stats->rx_packets == 0 && stats->tx_packets == 0)
                return;
 
@@ -434,6 +436,10 @@ static void update_stats(struct connman_ipdevice *ipdevice,
        if (ipdevice->config == NULL)
                return;
 
+       service = connman_ipconfig_get_data(ipdevice->config);
+       if (service == NULL)
+               return;
+
        ipdevice->rx_packets = stats->rx_packets;
        ipdevice->tx_packets = stats->tx_packets;
        ipdevice->rx_bytes = stats->rx_bytes;
@@ -443,7 +449,7 @@ static void update_stats(struct connman_ipdevice *ipdevice,
        ipdevice->rx_dropped = stats->rx_dropped;
        ipdevice->tx_dropped = stats->tx_dropped;
 
-       __connman_service_notify(ipdevice->config,
+       __connman_service_notify(service,
                                ipdevice->rx_packets, ipdevice->tx_packets,
                                ipdevice->rx_bytes, ipdevice->tx_bytes,
                                ipdevice->rx_errors, ipdevice->tx_errors,
index 626cd31..ba5b288 100644 (file)
@@ -1223,13 +1223,12 @@ static void stats_update(struct connman_service *service,
        stats->data.time = stats->data_last.time + seconds;
 }
 
-void __connman_service_notify(struct connman_ipconfig *ipconfig,
+void __connman_service_notify(struct connman_service *service,
                        unsigned int rx_packets, unsigned int tx_packets,
                        unsigned int rx_bytes, unsigned int tx_bytes,
                        unsigned int rx_errors, unsigned int tx_errors,
                        unsigned int rx_dropped, unsigned int tx_dropped)
 {
-       struct connman_service *service;
        GHashTableIter iter;
        gpointer key, value;
        const char *counter;
@@ -1237,7 +1236,6 @@ void __connman_service_notify(struct connman_ipconfig *ipconfig,
        struct connman_stats_data *data;
        int err;
 
-       service = connman_ipconfig_get_data(ipconfig);
        if (service == NULL)
                return;