diff options
author | Gilad Ben-Yossef <gilad@benyossef.com> | 2017-10-03 13:42:16 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-03 19:28:17 +0300 |
commit | bdd0873dc28d57651ae2ed4e42bb79526ed684ac (patch) | |
tree | 18a023ad9aadf47e4e414e0ac8edbbf4cf6af4e6 /drivers/staging/ccree/ssi_request_mgr.c | |
parent | a55ef6f52fdd5a4538dc140903416361d156c548 (diff) | |
download | linux-bdd0873dc28d57651ae2ed4e42bb79526ed684ac.tar.xz |
staging: ccree: move to generic device log infra
Move over from using macro wrappers around to printk to
dev_err, dev_dbg and friends and clean up resulting fallout.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ccree/ssi_request_mgr.c')
-rw-r--r-- | drivers/staging/ccree/ssi_request_mgr.c | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index ec69d9c830ae..066b6a6a1146 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -78,9 +78,9 @@ void request_mgr_fini(struct ssi_drvdata *drvdata) req_mgr_h->dummy_comp_buff_dma); } - SSI_LOG_DEBUG("max_used_hw_slots=%d\n", (req_mgr_h->hw_queue_size - + dev_dbg(dev, "max_used_hw_slots=%d\n", (req_mgr_h->hw_queue_size - req_mgr_h->min_free_hw_slots)); - SSI_LOG_DEBUG("max_used_sw_slots=%d\n", req_mgr_h->max_used_sw_slots); + dev_dbg(dev, "max_used_sw_slots=%d\n", req_mgr_h->max_used_sw_slots); #ifdef COMP_IN_WQ flush_workqueue(req_mgr_h->workq); @@ -110,24 +110,24 @@ int request_mgr_init(struct ssi_drvdata *drvdata) spin_lock_init(&req_mgr_h->hw_lock); #ifdef COMP_IN_WQ - SSI_LOG_DEBUG("Initializing completion workqueue\n"); + dev_dbg(dev, "Initializing completion workqueue\n"); req_mgr_h->workq = create_singlethread_workqueue("arm_cc7x_wq"); if (unlikely(!req_mgr_h->workq)) { - SSI_LOG_ERR("Failed creating work queue\n"); + dev_err(dev, "Failed creating work queue\n"); rc = -ENOMEM; goto req_mgr_init_err; } INIT_DELAYED_WORK(&req_mgr_h->compwork, comp_work_handler); #else - SSI_LOG_DEBUG("Initializing completion tasklet\n"); + dev_dbg(dev, "Initializing completion tasklet\n"); tasklet_init(&req_mgr_h->comptask, comp_handler, (unsigned long)drvdata); #endif req_mgr_h->hw_queue_size = READ_REGISTER(drvdata->cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_SRAM_SIZE)); - SSI_LOG_DEBUG("hw_queue_size=0x%08X\n", req_mgr_h->hw_queue_size); + dev_dbg(dev, "hw_queue_size=0x%08X\n", req_mgr_h->hw_queue_size); if (req_mgr_h->hw_queue_size < MIN_HW_QUEUE_SIZE) { - SSI_LOG_ERR("Invalid HW queue size = %u (Min. required is %u)\n", - req_mgr_h->hw_queue_size, MIN_HW_QUEUE_SIZE); + dev_err(dev, "Invalid HW queue size = %u (Min. required is %u)\n", + req_mgr_h->hw_queue_size, MIN_HW_QUEUE_SIZE); rc = -ENOMEM; goto req_mgr_init_err; } @@ -139,8 +139,8 @@ int request_mgr_init(struct ssi_drvdata *drvdata) &req_mgr_h->dummy_comp_buff_dma, GFP_KERNEL); if (!req_mgr_h->dummy_comp_buff) { - SSI_LOG_ERR("Not enough memory to allocate DMA (%zu) dropped " - "buffer\n", sizeof(u32)); + dev_err(dev, "Not enough memory to allocate DMA (%zu) dropped buffer\n", + sizeof(u32)); rc = -ENOMEM; goto req_mgr_init_err; } @@ -175,9 +175,9 @@ static inline void enqueue_seq( wmb(); writel_relaxed(seq[i].word[5], (volatile void __iomem *)(cc_base + CC_REG_OFFSET(CRY_KERNEL, DSCRPTR_QUEUE_WORD0))); #ifdef DX_DUMP_DESCS - SSI_LOG_DEBUG("desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n", i, - seq[i].word[0], seq[i].word[1], seq[i].word[2], - seq[i].word[3], seq[i].word[4], seq[i].word[5]); + dev_dbg(dev, "desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n", + i, seq[i].word[0], seq[i].word[1], seq[i].word[2], + seq[i].word[3], seq[i].word[4], seq[i].word[5]); #endif } } @@ -197,6 +197,7 @@ static void request_mgr_complete(struct device *dev, void *dx_compl_h, void __io } static inline int request_mgr_queues_status_check( + struct device *dev, struct ssi_request_mgr_handle *req_mgr_h, void __iomem *cc_base, unsigned int total_seq_len) @@ -210,8 +211,8 @@ static inline int request_mgr_queues_status_check( if (unlikely(((req_mgr_h->req_queue_head + 1) & (MAX_REQUEST_QUEUE_SIZE - 1)) == req_mgr_h->req_queue_tail)) { - SSI_LOG_ERR("SW FIFO is full. req_queue_head=%d sw_fifo_len=%d\n", - req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE); + dev_err(dev, "SW FIFO is full. req_queue_head=%d sw_fifo_len=%d\n", + req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE); return -EBUSY; } @@ -233,16 +234,13 @@ static inline int request_mgr_queues_status_check( return 0; } - SSI_LOG_DEBUG("HW FIFO is full. q_free_slots=%d total_seq_len=%d\n", - req_mgr_h->q_free_slots, total_seq_len); + dev_dbg(dev, "HW FIFO is full. q_free_slots=%d total_seq_len=%d\n", + req_mgr_h->q_free_slots, total_seq_len); } /* No room in the HW queue try again later */ - SSI_LOG_DEBUG("HW FIFO full, timeout. req_queue_head=%d " - "sw_fifo_len=%d q_free_slots=%d total_seq_len=%d\n", - req_mgr_h->req_queue_head, - MAX_REQUEST_QUEUE_SIZE, - req_mgr_h->q_free_slots, - total_seq_len); + dev_dbg(dev, "HW FIFO full, timeout. req_queue_head=%d sw_fifo_len=%d q_free_slots=%d total_seq_len=%d\n", + req_mgr_h->req_queue_head, MAX_REQUEST_QUEUE_SIZE, + req_mgr_h->q_free_slots, total_seq_len); return -EAGAIN; } @@ -269,9 +267,7 @@ int send_request( unsigned int iv_seq_len = 0; unsigned int total_seq_len = len; /*initial sequence length*/ struct cc_hw_desc iv_seq[SSI_IVPOOL_SEQ_LEN]; -#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) struct device *dev = drvdata_to_dev(drvdata); -#endif int rc; unsigned int max_required_seq_len = (total_seq_len + ((ssi_req->ivgen_dma_addr_len == 0) ? 0 : @@ -281,7 +277,7 @@ int send_request( #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) rc = ssi_power_mgr_runtime_get(dev); if (rc != 0) { - SSI_LOG_ERR("ssi_power_mgr_runtime_get returned %x\n", rc); + dev_err(dev, "ssi_power_mgr_runtime_get returned %x\n", rc); return rc; } #endif @@ -293,7 +289,7 @@ int send_request( * in case iv gen add the max size and in case of no dout add 1 * for the internal completion descriptor */ - rc = request_mgr_queues_status_check(req_mgr_h, cc_base, + rc = request_mgr_queues_status_check(dev, req_mgr_h, cc_base, max_required_seq_len); if (likely(rc == 0)) /* There is enough place in the queue */ @@ -326,12 +322,12 @@ int send_request( } if (ssi_req->ivgen_dma_addr_len > 0) { - SSI_LOG_DEBUG("Acquire IV from pool into %d DMA addresses %pad, %pad, %pad, IV-size=%u\n", - ssi_req->ivgen_dma_addr_len, - ssi_req->ivgen_dma_addr[0], - ssi_req->ivgen_dma_addr[1], - ssi_req->ivgen_dma_addr[2], - ssi_req->ivgen_size); + dev_dbg(dev, "Acquire IV from pool into %d DMA addresses %pad, %pad, %pad, IV-size=%u\n", + ssi_req->ivgen_dma_addr_len, + &ssi_req->ivgen_dma_addr[0], + &ssi_req->ivgen_dma_addr[1], + &ssi_req->ivgen_dma_addr[2], + ssi_req->ivgen_size); /* Acquire IV from pool */ rc = ssi_ivgen_getiv(drvdata, ssi_req->ivgen_dma_addr, @@ -339,7 +335,7 @@ int send_request( ssi_req->ivgen_size, iv_seq, &iv_seq_len); if (unlikely(rc != 0)) { - SSI_LOG_ERR("Failed to generate IV (rc=%d)\n", rc); + dev_err(dev, "Failed to generate IV (rc=%d)\n", rc); spin_unlock_bh(&req_mgr_h->hw_lock); #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) ssi_power_mgr_runtime_put_suspend(dev); @@ -359,7 +355,7 @@ int send_request( req_mgr_h->req_queue_head = (req_mgr_h->req_queue_head + 1) & (MAX_REQUEST_QUEUE_SIZE - 1); /* TODO: Use circ_buf.h ? */ - SSI_LOG_DEBUG("Enqueue request head=%u\n", req_mgr_h->req_queue_head); + dev_dbg(dev, "Enqueue request head=%u\n", req_mgr_h->req_queue_head); #ifdef FLUSH_CACHE_ALL flush_cache_all(); @@ -375,7 +371,7 @@ int send_request( * with resuming power. Set the free slot count to 0 and hope * for the best. */ - SSI_LOG_ERR("HW free slot count mismatch."); + dev_err(dev, "HW free slot count mismatch."); req_mgr_h->q_free_slots = 0; } else { /* Update the free slots in HW queue */ @@ -410,13 +406,15 @@ int send_request( int send_request_init( struct ssi_drvdata *drvdata, struct cc_hw_desc *desc, unsigned int len) { + struct device *dev = drvdata_to_dev(drvdata); void __iomem *cc_base = drvdata->cc_base; struct ssi_request_mgr_handle *req_mgr_h = drvdata->request_mgr_handle; unsigned int total_seq_len = len; /*initial sequence length*/ int rc = 0; /* Wait for space in HW and SW FIFO. Poll for as much as FIFO_TIMEOUT. */ - rc = request_mgr_queues_status_check(req_mgr_h, cc_base, total_seq_len); + rc = request_mgr_queues_status_check(dev, req_mgr_h, cc_base, + total_seq_len); if (unlikely(rc != 0)) return rc; @@ -471,8 +469,8 @@ static void proc_completions(struct ssi_drvdata *drvdata) * queue is empty. This is not normal. Return and * hope for the best. */ - SSI_LOG_ERR("Request queue is empty head == tail %u\n", - request_mgr_handle->req_queue_head); + dev_err(dev, "Request queue is empty head == tail %u\n", + request_mgr_handle->req_queue_head); break; } @@ -488,7 +486,7 @@ static void proc_completions(struct ssi_drvdata *drvdata) u32 axi_err; int i; - SSI_LOG_INFO("Delay\n"); + dev_info(dev, "Delay\n"); for (i = 0; i < 1000000; i++) axi_err = READ_REGISTER(drvdata->cc_base + CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR)); } @@ -498,12 +496,15 @@ static void proc_completions(struct ssi_drvdata *drvdata) ssi_req->user_cb(dev, ssi_req->user_arg, drvdata->cc_base); request_mgr_handle->req_queue_tail = (request_mgr_handle->req_queue_tail + 1) & (MAX_REQUEST_QUEUE_SIZE - 1); - SSI_LOG_DEBUG("Dequeue request tail=%u\n", request_mgr_handle->req_queue_tail); - SSI_LOG_DEBUG("Request completed. axi_completed=%d\n", request_mgr_handle->axi_completed); + dev_dbg(dev, "Dequeue request tail=%u\n", + request_mgr_handle->req_queue_tail); + dev_dbg(dev, "Request completed. axi_completed=%d\n", + request_mgr_handle->axi_completed); #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) rc = ssi_power_mgr_runtime_put_suspend(dev); if (rc != 0) - SSI_LOG_ERR("Failed to set runtime suspension %d\n", rc); + dev_err(dev, "Failed to set runtime suspension %d\n", + rc); #endif } } |