net: wireless: bcm4329: Send "HANG" message only once
authorDmitry Shmidt <dimitrysh@google.com>
Fri, 20 Aug 2010 18:12:22 +0000 (11:12 -0700)
committerColin Cross <ccross@android.com>
Thu, 30 Sep 2010 00:49:45 +0000 (17:49 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcm4329/dhd_linux.c
drivers/net/wireless/bcm4329/wl_iw.h

index b08ecd15d7d749efa51574a07cc77246276c657b..d8621ae0680ac761d6824560af136ba1449c9da9 100644 (file)
@@ -279,6 +279,8 @@ typedef struct dhd_info {
        int wl_count;
        int wl_packet;
 
+       int hang_was_sent;
+
        /* Thread to issue ioctl for multicast */
        long sysioc_pid;
        struct semaphore sysioc_sem;
@@ -1113,7 +1115,7 @@ dhd_start_xmit(struct sk_buff *skb, struct net_device *net)
                /* Send Event when bus down detected during data session */
                if (dhd->pub.busstate == DHD_BUS_DOWN)  {
                        DHD_ERROR(("%s: Event HANG send up\n", __FUNCTION__));
-                       wl_iw_send_priv_event(net, "HANG");
+                       net_os_send_hang_message(net);
                }
                dhd_os_wake_unlock(&dhd->pub);
                return -ENODEV;
@@ -1806,7 +1808,7 @@ done:
        if ((bcmerror == -ETIMEDOUT) || ((dhd->pub.busstate == DHD_BUS_DOWN) &&
                        (!dhd->pub.dongle_reset))) {
                DHD_ERROR(("%s: Event HANG send up\n", __FUNCTION__));
-               wl_iw_send_priv_event(net, "HANG");
+               net_os_send_hang_message(net);
        }
 
        if (!bcmerror && buf && ioc.buf) {
@@ -3114,3 +3116,17 @@ int net_os_set_packet_filter(struct net_device *dev, int val)
        }
        return ret;
 }
+
+int net_os_send_hang_message(struct net_device *dev)
+{
+       dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+       int ret = 0;
+
+       if (dhd) {
+               if (!dhd->hang_was_sent) {
+                       dhd->hang_was_sent = 1;
+                       ret = wl_iw_send_priv_event(dev, "HANG");
+               }
+       }
+       return ret;
+}
index c7ddc726d7fe6c6e495c74cdb1cbc8afac480a31..82af0c716b12d4b691fde578b293b42e52035b8a 100644 (file)
@@ -180,6 +180,7 @@ extern int net_os_wake_lock_timeout_enable(struct net_device *dev);
 extern int net_os_set_suspend_disable(struct net_device *dev, int val);
 extern int net_os_set_suspend(struct net_device *dev, int val);
 extern int net_os_set_packet_filter(struct net_device *dev, int val);
+extern int net_os_send_hang_message(struct net_device *dev);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \