aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorDmitry Kasatkin <dmitry.kasatkin@nokia.com>2011-06-02 14:10:09 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2011-06-29 19:44:04 -0400
commit6cb3ffe100ef4c6d5be0bfe4f8ac6d4227bb91bd (patch)
tree69f69d5921be65aa20c508ac74608c2eda40b578 /drivers/crypto
parent171cb9a2807588630fed401f3e0b8ae22d91595f (diff)
crypto: omap-sham - remove dedicated queue handling tasklet
Calling omap_sham_handle_queue from "done" tasklet should be done after irq scheduled tasklet completes. Having additional tasklet does not solve that issue because it might be execute before. So queue handling tasklet has been removed and functionality integrated into single tasklet. Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@nokia.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/omap-sham.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 84e5890c57e9..24de4ace9783 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -146,7 +146,6 @@ struct omap_sham_dev {
146 int dma; 146 int dma;
147 int dma_lch; 147 int dma_lch;
148 struct tasklet_struct done_task; 148 struct tasklet_struct done_task;
149 struct tasklet_struct queue_task;
150 149
151 unsigned long flags; 150 unsigned long flags;
152 struct crypto_queue queue; 151 struct crypto_queue queue;
@@ -653,6 +652,9 @@ static void omap_sham_finish_req(struct ahash_request *req, int err)
653 652
654 if (req->base.complete) 653 if (req->base.complete)
655 req->base.complete(&req->base, err); 654 req->base.complete(&req->base, err);
655
656 /* handle new request */
657 tasklet_schedule(&dd->done_task);
656} 658}
657 659
658static int omap_sham_handle_queue(struct omap_sham_dev *dd, 660static int omap_sham_handle_queue(struct omap_sham_dev *dd,
@@ -716,11 +718,9 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd,
716 err = omap_sham_final_req(dd); 718 err = omap_sham_final_req(dd);
717 } 719 }
718err1: 720err1:
719 if (err != -EINPROGRESS) { 721 if (err != -EINPROGRESS)
720 /* done_task will not finish it, so do it here */ 722 /* done_task will not finish it, so do it here */
721 omap_sham_finish_req(req, err); 723 omap_sham_finish_req(req, err);
722 tasklet_schedule(&dd->queue_task);
723 }
724 724
725 dev_dbg(dd->dev, "exit, err: %d\n", err); 725 dev_dbg(dd->dev, "exit, err: %d\n", err);
726 726
@@ -1035,6 +1035,11 @@ static void omap_sham_done_task(unsigned long data)
1035 struct omap_sham_dev *dd = (struct omap_sham_dev *)data; 1035 struct omap_sham_dev *dd = (struct omap_sham_dev *)data;
1036 int ready = 0, err = 0; 1036 int ready = 0, err = 0;
1037 1037
1038 if (!test_bit(FLAGS_BUSY, &dd->flags)) {
1039 omap_sham_handle_queue(dd, NULL);
1040 return;
1041 }
1042
1038 if (test_and_clear_bit(FLAGS_OUTPUT_READY, &dd->flags)) 1043 if (test_and_clear_bit(FLAGS_OUTPUT_READY, &dd->flags))
1039 ready = 1; 1044 ready = 1;
1040 1045
@@ -1050,18 +1055,9 @@ static void omap_sham_done_task(unsigned long data)
1050 dev_dbg(dd->dev, "update done: err: %d\n", err); 1055 dev_dbg(dd->dev, "update done: err: %d\n", err);
1051 /* finish curent request */ 1056 /* finish curent request */
1052 omap_sham_finish_req(dd->req, err); 1057 omap_sham_finish_req(dd->req, err);
1053 /* start new request */
1054 omap_sham_handle_queue(dd, NULL);
1055 } 1058 }
1056} 1059}
1057 1060
1058static void omap_sham_queue_task(unsigned long data)
1059{
1060 struct omap_sham_dev *dd = (struct omap_sham_dev *)data;
1061
1062 omap_sham_handle_queue(dd, NULL);
1063}
1064
1065static irqreturn_t omap_sham_irq(int irq, void *dev_id) 1061static irqreturn_t omap_sham_irq(int irq, void *dev_id)
1066{ 1062{
1067 struct omap_sham_dev *dd = dev_id; 1063 struct omap_sham_dev *dd = dev_id;
@@ -1137,7 +1133,6 @@ static int __devinit omap_sham_probe(struct platform_device *pdev)
1137 INIT_LIST_HEAD(&dd->list); 1133 INIT_LIST_HEAD(&dd->list);
1138 spin_lock_init(&dd->lock); 1134 spin_lock_init(&dd->lock);
1139 tasklet_init(&dd->done_task, omap_sham_done_task, (unsigned long)dd); 1135 tasklet_init(&dd->done_task, omap_sham_done_task, (unsigned long)dd);
1140 tasklet_init(&dd->queue_task, omap_sham_queue_task, (unsigned long)dd);
1141 crypto_init_queue(&dd->queue, OMAP_SHAM_QUEUE_LENGTH); 1136 crypto_init_queue(&dd->queue, OMAP_SHAM_QUEUE_LENGTH);
1142 1137
1143 dd->irq = -1; 1138 dd->irq = -1;
@@ -1246,7 +1241,6 @@ static int __devexit omap_sham_remove(struct platform_device *pdev)
1246 for (i = 0; i < ARRAY_SIZE(algs); i++) 1241 for (i = 0; i < ARRAY_SIZE(algs); i++)
1247 crypto_unregister_ahash(&algs[i]); 1242 crypto_unregister_ahash(&algs[i]);
1248 tasklet_kill(&dd->done_task); 1243 tasklet_kill(&dd->done_task);
1249 tasklet_kill(&dd->queue_task);
1250 iounmap(dd->io_base); 1244 iounmap(dd->io_base);
1251 clk_put(dd->iclk); 1245 clk_put(dd->iclk);
1252 omap_sham_dma_cleanup(dd); 1246 omap_sham_dma_cleanup(dd);