Re: [PATCH v5 16/17] qcom: llcc/edac: Support polling mode for ECC handling

From: Manivannan Sadhasivam
Date: Sat Jan 14 2023 - 23:08:49 EST


On Sat, Jan 14, 2023 at 02:36:16PM +0100, Borislav Petkov wrote:
> On Wed, Dec 28, 2022 at 02:10:27PM +0530, Manivannan Sadhasivam wrote:
> > static int qcom_llcc_edac_probe(struct platform_device *pdev)
> > {
> > struct llcc_drv_data *llcc_driv_data = pdev->dev.platform_data;
> > @@ -355,22 +361,31 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev)
> > edev_ctl->ctl_name = "llcc";
> > edev_ctl->panic_on_ue = LLCC_ERP_PANIC_ON_UE;
> >
> > + /* Check if LLCC driver has passed ECC IRQ */
> > + ecc_irq = llcc_driv_data->ecc_irq;
> > + if (ecc_irq > 0) {
> > + /* Use interrupt mode if IRQ is available */
> > + edac_op_state = EDAC_OPSTATE_INT;
> > + } else {
> > + /* Fall back to polling mode otherwise */
> > + edac_op_state = EDAC_OPSTATE_POLL;
> > + edev_ctl->poll_msec = ECC_POLL_MSEC;
> > + edev_ctl->edac_check = llcc_ecc_check;
> > + }
> > +
> > rc = edac_device_add_device(edev_ctl);
> > if (rc)
> > goto out_mem;
> >
> > platform_set_drvdata(pdev, edev_ctl);
> >
> > - /* Request for ecc irq */
> > - ecc_irq = llcc_driv_data->ecc_irq;
> > - if (ecc_irq < 0) {
> > - rc = -ENODEV;
> > - goto out_dev;
> > - }
> > - rc = devm_request_irq(dev, ecc_irq, llcc_ecc_irq_handler,
> > + /* Request ECC IRQ if available */
> > + if (ecc_irq > 0) {
> > + rc = devm_request_irq(dev, ecc_irq, llcc_ecc_irq_handler,
> > IRQF_TRIGGER_HIGH, "llcc_ecc", edev_ctl);
>
> You need to request the IRQ first and then set edac_op_state above. I.e., this
> devm_request_irq() needs to move in the if (ecc_irq > 0) branch above.

May I know why? I also checked other drivers, most of them are doing the same.

Thanks,
Mani

>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

--
மணிவண்ணன் சதாசிவம்