Commit 1fda276e authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

staging: brcm80211: removed global variable from sdio fullmac

Code cleanup. bus->card is assigned in brcmf_sdbrcm_probe (before
brcmf_sdbrcm_probe_attach()). Since w_sdreg32() and r_sdreg32() are called
only after that assignment, they can safely use bus->card. Thus there
is no instance left where brcmf_sdcard_reg_read() or brcmf_sdcard_reg_write()
is called with a NULL parameter, so the mechanism in bcmsdh.c that deals with
a NULL pointer could be deleted.
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 459f059a
...@@ -89,9 +89,6 @@ struct sdio_hc { ...@@ -89,9 +89,6 @@ struct sdio_hc {
bool oob_irq_registered; bool oob_irq_registered;
}; };
/* local copy of bcm sd handler */
static struct brcmf_sdio_card *l_card;
const uint brcmf_sdio_msglevel = BRCMF_SD_ERROR_VAL; const uint brcmf_sdio_msglevel = BRCMF_SD_ERROR_VAL;
static struct sdio_hc *sdhcinfo; static struct sdio_hc *sdhcinfo;
...@@ -116,9 +113,6 @@ brcmf_sdcard_attach(void *cfghdl, u32 *regsva, uint irq) ...@@ -116,9 +113,6 @@ brcmf_sdcard_attach(void *cfghdl, u32 *regsva, uint irq)
return NULL; return NULL;
} }
/* save the handler locally */
l_card = card;
card->sdioh = brcmf_sdioh_attach(cfghdl, irq); card->sdioh = brcmf_sdioh_attach(cfghdl, irq);
if (!card->sdioh) { if (!card->sdioh) {
brcmf_sdcard_detach(card); brcmf_sdcard_detach(card);
...@@ -144,7 +138,6 @@ int brcmf_sdcard_detach(struct brcmf_sdio_card *card) ...@@ -144,7 +138,6 @@ int brcmf_sdcard_detach(struct brcmf_sdio_card *card)
kfree(card); kfree(card);
} }
l_card = NULL;
return 0; return 0;
} }
...@@ -184,9 +177,6 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, ...@@ -184,9 +177,6 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
s32 retry = 0; s32 retry = 0;
u8 data = 0; u8 data = 0;
if (!card)
card = l_card;
do { do {
if (retry) /* wait for 1 ms till bus get settled down */ if (retry) /* wait for 1 ms till bus get settled down */
udelay(1000); udelay(1000);
...@@ -211,9 +201,6 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, ...@@ -211,9 +201,6 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr,
int status; int status;
s32 retry = 0; s32 retry = 0;
if (!card)
card = l_card;
do { do {
if (retry) /* wait for 1 ms till bus get settled down */ if (retry) /* wait for 1 ms till bus get settled down */
udelay(1000); udelay(1000);
...@@ -235,9 +222,6 @@ u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num, ...@@ -235,9 +222,6 @@ u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num,
int status; int status;
u32 data = 0; u32 data = 0;
if (!card)
card = l_card;
status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL, status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
SDIOH_READ, fnc_num, addr, &data, 4); SDIOH_READ, fnc_num, addr, &data, 4);
...@@ -256,9 +240,6 @@ brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num, ...@@ -256,9 +240,6 @@ brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num,
{ {
int status; int status;
if (!card)
card = l_card;
status = status =
brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL, brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL,
SDIOH_WRITE, fnc_num, addr, &data, 4); SDIOH_WRITE, fnc_num, addr, &data, 4);
...@@ -280,9 +261,6 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis, ...@@ -280,9 +261,6 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis,
bool ascii = func & ~0xf; bool ascii = func & ~0xf;
func &= 0x7; func &= 0x7;
if (!card)
card = l_card;
status = brcmf_sdioh_cis_read(card->sdioh, func, cis, length); status = brcmf_sdioh_cis_read(card->sdioh, func, cis, length);
if (ascii) { if (ascii) {
...@@ -334,9 +312,6 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size) ...@@ -334,9 +312,6 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size)
BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr)); BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr));
if (!card)
card = l_card;
if (bar0 != card->sbwad) { if (bar0 != card->sbwad) {
if (brcmf_sdcard_set_sbaddr_window(card, bar0)) if (brcmf_sdcard_set_sbaddr_window(card, bar0))
return 0xFFFFFFFF; return 0xFFFFFFFF;
...@@ -386,9 +361,6 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size, ...@@ -386,9 +361,6 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size,
BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n", BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n",
__func__, addr, size * 8, data)); __func__, addr, size * 8, data));
if (!card)
card = l_card;
if (bar0 != card->sbwad) { if (bar0 != card->sbwad) {
err = brcmf_sdcard_set_sbaddr_window(card, bar0); err = brcmf_sdcard_set_sbaddr_window(card, bar0);
if (err) if (err)
...@@ -522,9 +494,6 @@ int brcmf_sdcard_query_device(struct brcmf_sdio_card *card) ...@@ -522,9 +494,6 @@ int brcmf_sdcard_query_device(struct brcmf_sdio_card *card)
u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card) u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card)
{ {
if (!card)
card = l_card;
return card->sbwad; return card->sbwad;
} }
......
...@@ -889,7 +889,7 @@ r_sdreg32(struct brcmf_bus *bus, u32 *regvar, u32 reg_offset, u32 *retryvar) ...@@ -889,7 +889,7 @@ r_sdreg32(struct brcmf_bus *bus, u32 *regvar, u32 reg_offset, u32 *retryvar)
{ {
*retryvar = 0; *retryvar = 0;
do { do {
*regvar = brcmf_sdcard_reg_read(NULL, *regvar = brcmf_sdcard_reg_read(bus->card,
bus->ci->buscorebase + reg_offset, sizeof(u32)); bus->ci->buscorebase + reg_offset, sizeof(u32));
} while (brcmf_sdcard_regfail(bus->card) && } while (brcmf_sdcard_regfail(bus->card) &&
(++(*retryvar) <= retry_limit)); (++(*retryvar) <= retry_limit));
...@@ -907,7 +907,8 @@ w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar) ...@@ -907,7 +907,8 @@ w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar)
{ {
*retryvar = 0; *retryvar = 0;
do { do {
brcmf_sdcard_reg_write(NULL, bus->ci->buscorebase + reg_offset, brcmf_sdcard_reg_write(bus->card,
bus->ci->buscorebase + reg_offset,
sizeof(u32), regval); sizeof(u32), regval);
} while (brcmf_sdcard_regfail(bus->card) && } while (brcmf_sdcard_regfail(bus->card) &&
(++(*retryvar) <= retry_limit)); (++(*retryvar) <= retry_limit));
...@@ -5682,8 +5683,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva, ...@@ -5682,8 +5683,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, u32 regsva,
/* Set core control so an SDIO reset does a backplane reset */ /* Set core control so an SDIO reset does a backplane reset */
reg_addr = bus->ci->buscorebase + reg_addr = bus->ci->buscorebase +
offsetof(struct sdpcmd_regs, corecontrol); offsetof(struct sdpcmd_regs, corecontrol);
reg_val = brcmf_sdcard_reg_read(NULL, reg_addr, sizeof(u32)); reg_val = brcmf_sdcard_reg_read(bus->card, reg_addr, sizeof(u32));
brcmf_sdcard_reg_write(NULL, reg_addr, sizeof(u32), brcmf_sdcard_reg_write(bus->card, reg_addr, sizeof(u32),
reg_val | CC_BPRESEN); reg_val | CC_BPRESEN);
brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN); brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment