net: wireless: bcmdhd: Prevent HT Avail request failure to flood the log
authorDmitry Shmidt <dimitrysh@google.com>
Wed, 18 Jul 2012 18:15:10 +0000 (11:15 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Wed, 18 Jul 2012 18:19:40 +0000 (11:19 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcmdhd/dhd.h
drivers/net/wireless/bcmdhd/dhd_linux.c
drivers/net/wireless/bcmdhd/dhd_sdio.c

index b35b24a8aa144e834f376c970ed5e40f2d46df39..725a909273dc024616922261012a915fa904bee2 100644 (file)
@@ -431,6 +431,7 @@ extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t * pub);
 extern void dhd_os_sdlock_eventq(dhd_pub_t * pub);
 extern void dhd_os_sdunlock_eventq(dhd_pub_t * pub);
 extern bool dhd_os_check_hang(dhd_pub_t *dhdp, int ifidx, int ret);
+extern int dhd_os_send_hang_message(dhd_pub_t *dhdp);
 extern int net_os_send_hang_message(struct net_device *dev);
 extern void dhd_set_version_info(dhd_pub_t *pub, char *fw);
 
index cebfe98310765cb87ebd4c5ffd3bfa05a15d55af..d32ce1135f2c196c1cc31dc5d8ac0b73e493c046 100644 (file)
@@ -4510,21 +4510,33 @@ static void dhd_hang_process(struct work_struct *work)
 #endif
        }
 }
+#endif
 
-int net_os_send_hang_message(struct net_device *dev)
+int dhd_os_send_hang_message(dhd_pub_t *dhdp)
 {
-       dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
        int ret = 0;
 
-       if (dhd) {
-               if (!dhd->pub.hang_was_sent) {
-                       dhd->pub.hang_was_sent = 1;
-                       schedule_work(&dhd->work_hang);
+       if (dhdp) {
+               if (!dhdp->hang_was_sent) {
+                       dhdp->hang_was_sent = 1;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
+                       schedule_work(&dhdp->info->work_hang);
+#endif
                }
        }
        return ret;
 }
-#endif
+
+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)
+               ret = dhd_os_send_hang_message(&dhd->pub);
+
+       return ret;
+}
 
 void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec)
 {
index 5b744f4fb1b46782477b94181354d3c66851ae59..e578d702ce11f2c06d06e2af139f7f9590e2edb0 100644 (file)
@@ -539,6 +539,8 @@ dhdsdio_set_siaddr_window(dhd_bus_t *bus, uint32 address)
 static int
 dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
 {
+#define HT_AVAIL_ERROR_MAX     10
+       static int ht_avail_error = 0;
        int err;
        uint8 clkctl, clkreq, devctl;
        bcmsdh_info_t *sdh;
@@ -551,18 +553,22 @@ dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
        clkctl = 0;
        sdh = bus->sdh;
 
-
        if (on) {
                /* Request HT Avail */
                clkreq = bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ;
 
-
-
-
                bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err);
                if (err) {
-                       DHD_ERROR(("%s: HT Avail request error: %d\n", __FUNCTION__, err));
+                       ht_avail_error++;
+                       if (ht_avail_error < HT_AVAIL_ERROR_MAX) {
+                               DHD_ERROR(("%s: HT Avail request error: %d\n", __FUNCTION__, err));
+                       } else {
+                               if (ht_avail_error == HT_AVAIL_ERROR_MAX)
+                                       dhd_os_send_hang_message(bus->dhd);
+                       }
                        return BCME_ERROR;
+               } else {
+                       ht_avail_error = 0;
                }
 
                if (pendok &&