OSDN Git Service

Merge "msm: qti_sdio_client: Return error number in diag callback"
authorLinux Build Service Account <lnxbuild@localhost>
Fri, 13 Sep 2019 14:57:19 +0000 (07:57 -0700)
committerGerrit - the friendly Code Review server <code-review@localhost>
Fri, 13 Sep 2019 14:57:19 +0000 (07:57 -0700)
drivers/char/qti_sdio_client.c
drivers/platform/msm/qcn/qcn_sdio.c
include/linux/mmc/host.h

index 880ab21..5cc1079 100644 (file)
@@ -88,9 +88,9 @@ static DEFINE_MUTEX(work_lock);
 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)
@@ -438,8 +438,10 @@ int qti_client_read(int id, char *buf, size_t count)
 
        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;
 
@@ -484,7 +486,7 @@ out:
        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) {
@@ -593,8 +595,10 @@ int qti_client_write(int id, char *buf, size_t count)
 
                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);
@@ -627,10 +631,11 @@ int qti_client_write(int id, char *buf, size_t count)
                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;
index 46d950d..21dcd3c 100644 (file)
@@ -561,7 +561,6 @@ static void qcn_sdio_irq_handler(struct sdio_func *func)
        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);
index 49648aa..2dff3db 100644 (file)
@@ -735,8 +735,8 @@ static inline int mmc_boot_partition_access(struct mmc_host *host)
 
 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)