static spinlock_t list_lock;
#define qlog(qsb, _msg, ...) do { \
- if (to_console) \
- pr_err("[%s] " _msg, __func__, ##__VA_ARGS__); \
- if (ipc_log) \
+ if (!qsb ? 1 : to_console) \
+ pr_err("[%s] " _msg, __func__, ##__VA_ARGS__); \
+ if (qsb && ipc_log) \
ipc_log_string(qsb->ipc_log_ctxt, "[%s] " _msg, __func__, \
##__VA_ARGS__); \
} while (0)
wait_event(qsb->wait_q, qsb->data_avail ||
atomic_read(&qsb->is_client_closing));
- if (atomic_read(&qsb->is_client_closing))
- return count;
+ if (atomic_read(&qsb->is_client_closing)) {
+ ret = -ENODEV;
+ goto out;
+ }
bytes = qsb->data_avail;
if (id == QCN_SDIO_CLI_ID_DIAG && qsb->ops &&
qsb->ops->read_complete_cb) {
qsb->ops->read_complete_cb((void *)(uintptr_t)0, buf, count,
- count);
+ ret < 0 ? ret : count);
}
if (!qsb->data_remain) {
wait_event(qsb->wait_q, qsb->tx_ready ||
atomic_read(&qsb->is_client_closing));
- if (atomic_read(&qsb->is_client_closing))
- return count;
+ if (atomic_read(&qsb->is_client_closing)) {
+ ret = -ENODEV;
+ goto out;
+ }
if (qsb->mode) {
reinit_completion(&tx_complete);
buffer = buffer + temp_count;
}
+out:
if (id == QCN_SDIO_CLI_ID_DIAG && qsb->ops &&
qsb->ops->write_complete_cb) {
qsb->ops->write_complete_cb((void *)(uintptr_t)0, buf, count,
- count);
+ ret < 0 ? ret : count);
}
return count;
sdio_claim_host(sdio_ctxt->func);
data = sdio_readb(sdio_ctxt->func, SDIO_QCN_IRQ_STATUS, &ret);
if (ret == -ETIMEDOUT) {
- sdio_release_irq(sdio_ctxt->func);
sdio_release_host(sdio_ctxt->func);
pr_err("%s: IRQ status read error ret = %d\n", __func__, ret);
static inline bool mmc_card_and_host_support_async_int(struct mmc_host *host)
{
- return ((host->caps2 & MMC_CAP2_ASYNC_SDIO_IRQ_4BIT_MODE) &&
- (host->card->cccr.async_intr_sup));
+ return (host->card && (host->caps2 & MMC_CAP2_ASYNC_SDIO_IRQ_4BIT_MODE)
+ && (host->card->cccr.async_intr_sup));
}
static inline int mmc_host_uhs(struct mmc_host *host)