[PATCH v1] Moving init_completion before request_irq

Martin Kaiser martin at kaiser.cx
Sat Jul 30 08:00:01 PDT 2022


Hello Kshitiz & Ahmad,

Thus wrote Ahmad Fatoum (a.fatoum at pengutronix.de):

> > +	init_completion(&rngc->rng_op_done);
> > +
> >  	ret = devm_request_irq(&pdev->dev,
> >  			irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);

> This should probably be moved below imx_rngc_irq_mask_clear(rngc).
> init_completion can stay where it is. That way:

I agree with Ahmad that this is the better approach.

We should clear pending irqs and disable interrupt sources on the
hardware level before we install our irq handler.

Best regards,
Martin

>  - You initialize rngc fully before registering the IRQ handler
>  - You don't handle pending IRQs that you want to dismiss anyway
>  - If the IRQ happens to be because of a SEED_DONE due to a previous
>    boot stage, you don't end up completing the completion prematurely.



More information about the linux-arm-kernel mailing list