lkml.org 
[lkml]   [2017]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 4/4] crypto: s5p-sss - Use mutex instead of spinlock
Date

Hi,

On Friday, March 17, 2017 04:49:22 PM Krzysztof Kozlowski wrote:
> Driver uses threaded interrupt handler so there is no real need for
> using spinlocks for synchronization. Mutexes would do fine and are
> friendlier for overall system preemptivness and real-time behavior.

Are you sure that this conversion is safe? This driver also uses
a tasklet and tasklets run in the interrupt context.

> @@ -667,18 +666,17 @@ static void s5p_tasklet_cb(unsigned long data)
> struct s5p_aes_dev *dev = (struct s5p_aes_dev *)data;
> struct crypto_async_request *async_req, *backlog;
> struct s5p_aes_reqctx *reqctx;
> - unsigned long flags;
>
> - spin_lock_irqsave(&dev->lock, flags);
> + mutex_lock(&dev->lock);
> backlog = crypto_get_backlog(&dev->queue);
> async_req = crypto_dequeue_request(&dev->queue);
>
> if (!async_req) {
> dev->busy = false;
> - spin_unlock_irqrestore(&dev->lock, flags);
> + mutex_unlock(&dev->lock);
> return;
> }
> - spin_unlock_irqrestore(&dev->lock, flags);
> + mutex_unlock(&dev->lock);

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

\
 
 \ /
  Last update: 2017-03-17 18:31    [W:1.100 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site