Commit 72bccf51 authored by Karun Eagalapati's avatar Karun Eagalapati Committed by Kalle Valo

rsi: Optimise sdio claim and release host

SDIO host is already claimed in our interrupt handler. Some lower
level APIs claims host while performing SDIO read or write operations.
Let's use sdio_irq_task variable to check if we are in interrupt
context and claim/release the host accordingly.
Signed-off-by: default avatarKarun Eagalapati <karun256@gmail.com>
Signed-off-by: default avatarAmitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: default avatarPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 5f6ae7ca
......@@ -138,12 +138,15 @@ static int rsi_issue_sdiocommand(struct sdio_func *func,
static void rsi_handle_interrupt(struct sdio_func *function)
{
struct rsi_hw *adapter = sdio_get_drvdata(function);
struct rsi_91x_sdiodev *dev =
(struct rsi_91x_sdiodev *)adapter->rsi_dev;
if (adapter->priv->fsm_state == FSM_FW_NOT_LOADED)
return;
sdio_release_host(function);
dev->sdio_irq_task = current;
rsi_interrupt_handler(adapter);
sdio_claim_host(function);
dev->sdio_irq_task = NULL;
}
/**
......@@ -407,6 +410,7 @@ int rsi_sdio_read_register(struct rsi_hw *adapter,
u8 fun_num = 0;
int status;
if (likely(dev->sdio_irq_task != current))
sdio_claim_host(dev->pfunction);
if (fun_num == 0)
......@@ -414,6 +418,7 @@ int rsi_sdio_read_register(struct rsi_hw *adapter,
else
*data = sdio_readb(dev->pfunction, addr, &status);
if (likely(dev->sdio_irq_task != current))
sdio_release_host(dev->pfunction);
return status;
......@@ -438,6 +443,7 @@ int rsi_sdio_write_register(struct rsi_hw *adapter,
(struct rsi_91x_sdiodev *)adapter->rsi_dev;
int status = 0;
if (likely(dev->sdio_irq_task != current))
sdio_claim_host(dev->pfunction);
if (function == 0)
......@@ -445,6 +451,7 @@ int rsi_sdio_write_register(struct rsi_hw *adapter,
else
sdio_writeb(dev->pfunction, *data, addr, &status);
if (likely(dev->sdio_irq_task != current))
sdio_release_host(dev->pfunction);
return status;
......@@ -490,10 +497,12 @@ static int rsi_sdio_read_register_multiple(struct rsi_hw *adapter,
(struct rsi_91x_sdiodev *)adapter->rsi_dev;
u32 status;
if (likely(dev->sdio_irq_task != current))
sdio_claim_host(dev->pfunction);
status = sdio_readsb(dev->pfunction, data, addr, count);
if (likely(dev->sdio_irq_task != current))
sdio_release_host(dev->pfunction);
if (status != 0)
......@@ -532,10 +541,12 @@ int rsi_sdio_write_register_multiple(struct rsi_hw *adapter,
dev->write_fail++;
}
if (likely(dev->sdio_irq_task != current))
sdio_claim_host(dev->pfunction);
status = sdio_writesb(dev->pfunction, addr, data, count);
if (likely(dev->sdio_irq_task != current))
sdio_release_host(dev->pfunction);
if (status) {
......
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