Skip to content

Commit

Permalink
crypto: omap-sham - move some flags to device context
Browse files Browse the repository at this point in the history
Couple of context flags have been moved to device flags.
IRQ and tasklet handlers does not need to access request
context anymore.

Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Dmitry Kasatkin authored and Herbert Xu committed Jun 29, 2011
1 parent a929cbe commit ed3ea9a
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions drivers/crypto/omap-sham.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ static int omap_sham_xmit_cpu(struct omap_sham_dev *dd, const u8 *buf,
return -ETIMEDOUT;

if (final)
set_bit(FLAGS_FINAL, &ctx->flags); /* catch last interrupt */
set_bit(FLAGS_FINAL, &dd->flags); /* catch last interrupt */

len32 = DIV_ROUND_UP(length, sizeof(u32));

Expand Down Expand Up @@ -336,7 +336,7 @@ static int omap_sham_xmit_dma(struct omap_sham_dev *dd, dma_addr_t dma_addr,
ctx->digcnt += length;

if (final)
set_bit(FLAGS_FINAL, &ctx->flags); /* catch last interrupt */
set_bit(FLAGS_FINAL, &dd->flags); /* catch last interrupt */

set_bit(FLAGS_DMA_ACTIVE, &dd->flags);

Expand Down Expand Up @@ -642,7 +642,7 @@ static void omap_sham_finish_req(struct ahash_request *req, int err)

if (!err) {
omap_sham_copy_hash(req, 1);
if (test_bit(FLAGS_FINAL, &ctx->flags))
if (test_bit(FLAGS_FINAL, &dd->flags))
err = omap_sham_finish(req);
} else {
ctx->flags |= BIT(FLAGS_ERROR);
Expand Down Expand Up @@ -1034,10 +1034,9 @@ static void omap_sham_done_task(unsigned long data)
{
struct omap_sham_dev *dd = (struct omap_sham_dev *)data;
struct ahash_request *req = dd->req;
struct omap_sham_reqctx *ctx = ahash_request_ctx(req);
int ready = 0, err = 0;

if (test_and_clear_bit(FLAGS_OUTPUT_READY, &ctx->flags))
if (test_and_clear_bit(FLAGS_OUTPUT_READY, &dd->flags))
ready = 1;

if (test_and_clear_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
Expand Down Expand Up @@ -1067,22 +1066,16 @@ static void omap_sham_queue_task(unsigned long data)
static irqreturn_t omap_sham_irq(int irq, void *dev_id)
{
struct omap_sham_dev *dd = dev_id;
struct omap_sham_reqctx *ctx = ahash_request_ctx(dd->req);

if (!ctx) {
dev_err(dd->dev, "unknown interrupt.\n");
return IRQ_HANDLED;
}

if (unlikely(test_bit(FLAGS_FINAL, &ctx->flags)))
if (unlikely(test_bit(FLAGS_FINAL, &dd->flags)))
/* final -> allow device to go to power-saving mode */
omap_sham_write_mask(dd, SHA_REG_CTRL, 0, SHA_REG_CTRL_LENGTH);

omap_sham_write_mask(dd, SHA_REG_CTRL, SHA_REG_CTRL_OUTPUT_READY,
SHA_REG_CTRL_OUTPUT_READY);
omap_sham_read(dd, SHA_REG_CTRL);

set_bit(FLAGS_OUTPUT_READY, &ctx->flags);
set_bit(FLAGS_OUTPUT_READY, &dd->flags);
dd->err = 0;
tasklet_schedule(&dd->done_task);

Expand Down

0 comments on commit ed3ea9a

Please sign in to comment.