bool threads_only;
struct semaphore sdsem;
- spinlock_t sdlock;
const char *fw_name;
const struct firmware *firmware;
brcmu_pkt_buf_free_skb(pkt);
}
-static void brcmf_sdbrcm_sdlock(struct brcmf_bus *bus)
-{
- if (bus->threads_only)
- down(&bus->sdsem);
- else
- spin_lock_bh(&bus->sdlock);
-}
-
-static void brcmf_sdbrcm_sdunlock(struct brcmf_bus *bus)
-{
- if (bus->threads_only)
- up(&bus->sdsem);
- else
- spin_unlock_bh(&bus->sdlock);
-}
-
/* Turn backplane clock on or off */
static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok)
{
#endif /* BCMDBG */
}
if (num) {
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
brcmf_rx_frame(bus->drvr, ifidx, save_pfirst, num);
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
}
bus->rxglomframes++;
}
/* Unlock during rx call */
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
brcmf_rx_frame(bus->drvr, ifidx, pkt, 1);
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
}
rxcount = maxframes - rxleft;
#ifdef BCMDBG
static void
brcmf_sdbrcm_wait_for_event(struct brcmf_bus *bus, bool *lockvar)
{
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
wait_event_interruptible_timeout(bus->ctrl_wait,
(*lockvar == false), HZ * 2);
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
return;
}
done:
/* restore pkt buffer pointer before calling tx complete routine */
skb_pull(pkt, SDPCM_HDRLEN + pad);
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
brcmf_txcomplete(bus->drvr, pkt, ret != 0);
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
if (free_pkt)
brcmu_pkt_buf_free_skb(pkt);
/* Start with leftover status bits */
intstatus = bus->intstatus;
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
/* If waiting for HTAVAIL, check status */
if (bus->clkstate == CLK_PENDING) {
brcmf_sdbrcm_clkctl(bus, CLK_NONE, false);
}
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
return resched;
}
/* precondition: IS_ALIGNED((unsigned long)frame, 2) */
/* Need to lock here to protect txseq and SDIO tx calls */
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
bus_wake(bus);
brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
}
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
if (ret)
bus->drvr->tx_ctlerrs++;
/* Wait until control frame is available */
timeleft = brcmf_sdbrcm_ioctl_resp_wait(bus, &bus->rxlen, &pending);
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
rxlen = bus->rxlen;
memcpy(msg, bus->rxctl, min(msglen, rxlen));
bus->rxlen = 0;
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
if (rxlen) {
brcmf_dbg(CTL, "resumed on rxctl frame, got %d expected %d\n",
brcmf_dbg(TRACE, "Enter\n");
if (enforce_mutex)
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
bus_wake(bus);
bus->tx_seq = bus->rx_seq = 0;
if (enforce_mutex)
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
}
int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS);
if (enforce_mutex)
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
/* Make sure backplane clock is on, needed to generate F2 interrupt */
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
exit:
if (enforce_mutex)
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
return ret;
}
if (bus->sleeping)
return false;
- brcmf_sdbrcm_sdlock(bus);
+ down(&bus->sdsem);
/* Poll period: check device if appropriate. */
if (bus->poll && (++bus->polltick >= bus->pollrate)) {
}
}
- brcmf_sdbrcm_sdunlock(bus);
+ up(&bus->sdsem);
return bus->ipend;
}
sema_init(&bus->sdsem, 1);
} else {
bus->threads_only = false;
- spin_lock_init(&bus->sdlock);
}
if (brcmf_dpc_prio >= 0) {