In jh7110_rsa_domain_transfer(), there is a path that may lead to
recursive mutex_lock when calling jh7110_pka_wait_done(). Replace it
with completion variable, which is more suitable for signaling
completion instead of using mutex, not to mention using mutex_*() in
interrupt context is bad.
Signed-off-by: Tan En De <ende.tan@starfivetech.com>
Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com>
{
int ret = -1;
+ wait_for_completion(&sdev->rsa_comp);
+ reinit_completion(&sdev->rsa_comp);
+ mutex_unlock(&sdev->doing);
mutex_lock(&sdev->doing);
if (sdev->done_flags & JH7110_PKA_DONE)
ret = 0;
if (sdev->cry_type != JH7110_PKA_TYPE)
return IRQ_HANDLED;
- mutex_unlock(&sdev->doing);
+ complete(&sdev->rsa_comp);
return IRQ_HANDLED;
}
mutex_init(&sdev->sha_lock);
mutex_init(&sdev->aes_lock);
mutex_init(&sdev->rsa_lock);
+ init_completion(&sdev->rsa_comp);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "secreg");
sdev->io_base = devm_ioremap_resource(dev, res);
struct mutex sha_lock;
struct mutex aes_lock;
struct mutex rsa_lock;
+ struct completion rsa_comp;
#define JH7110_SHA_SHA_DONE BIT(2)
#define JH7110_AES_DONE BIT(3)