net: wireless: bcmdhd: Prevent HT Avail request failure to flood the log

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
Dmitry Shmidt 2012-07-18 11:15:10 -07:00
parent 3421d0b815
commit 62618c1b04
3 changed files with 31 additions and 12 deletions

View 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);

View File

@ -4510,21 +4510,33 @@ static void dhd_hang_process(struct work_struct *work)
#endif
}
}
#endif
int dhd_os_send_hang_message(dhd_pub_t *dhdp)
{
int ret = 0;
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;
}
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->pub.hang_was_sent) {
dhd->pub.hang_was_sent = 1;
schedule_work(&dhd->work_hang);
}
}
if (dhd)
ret = dhd_os_send_hang_message(&dhd->pub);
return ret;
}
#endif
void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec)
{

View 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 &&