Re: [PATCH v5 08/13] usb: typec: tcpci_mt6370: Add MediaTek MT6370 tcpci driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andy Shevchenko <andy.shevchenko@xxxxxxxxx> 於 2022年7月18日 週一 晚上7:39寫道:
>
> On Mon, Jul 18, 2022 at 10:08 AM ChiYuan Huang <u0084500@xxxxxxxxx> wrote:
> > On Fri, Jul 15, 2022 at 03:10:42PM +0200, Andy Shevchenko wrote:
> > > On Fri, Jul 15, 2022 at 1:28 PM ChiaEn Wu <peterwu.pub@xxxxxxxxx> wrote:
>
> ...
>
> > > > This commit add support for the Type-C & Power Delivery controller in
> > >
> > > This commit add -> Add
> > >
> > Upper case? Or rewrite it as 'This commit is to add .....'?
>
> Please, read this documentation [1] for better understanding. It
> should clarify this and perhaps other possible questions.
>
> [1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
>
I'm thinking why to change it from 'add' to "Add'.
Ah, I misunderstand it.
> > > > MediaTek MT6370 IC.
>
> ...
>
> > > > +       ret = devm_request_threaded_irq(dev, priv->irq, NULL,
> > > > +                                       mt6370_irq_handler, IRQF_ONESHOT,
> > > > +                                       dev_name(dev), priv);
> > > > +       if (ret) {
> > >
> > > > +               tcpci_unregister_port(priv->tcpci);
> > >
> > > This is wrong.
> > > You mixed devm_ with non-devm. Either drop devm_ *after* the first
> > > non-devm_ call, or convert everything to be managed.
> > >
> > How about to add 'devm_add_action_or_reset' for tcpci_unregister_port?
> > This will convert all as 'devm_' version.
>
> I think it would work, that wrapper was designed to cover cases like this.
>
> > > > +               return dev_err_probe(dev, ret, "Failed to allocate irq\n");
> > > > +       }
>
> ...
>
> > > > +static int mt6370_tcpc_remove(struct platform_device *pdev)
> > > > +{
> > > > +       struct mt6370_priv *priv = platform_get_drvdata(pdev);
> > >
> > > > +       disable_irq(priv->irq);
> > >
> > > Why?
> > > An ugly workaround due to ordering issues in ->probe()?
> > >
> > Yes, due to the ordering in probe.
> > 'bus remove' will be called before device resource releases.
> >
> > Like as you said, another way is to convert all as non-devm
> > version after 'tcpci_unregister_port'.
> >
> > If to keep the original order, 'disable_irq' before
> > 'tcpci_unregister_port' can make the flow more safe.
> >
> > Or you can think one case if irq triggers after
> > 'tcpci_unregister_port'. Null pointer occurs.
> >
> > Anyway, in next revision, I'll convert all to be 'devm_' version.
> > For this remove callback, only 'dev_pm_clear_wake_irq' and
> > 'device_init_wakeup' will be kept.
> >
> > Is this better?
>
> Sounds like a plan!
>
Already did. Just to double confirm the changes.
Thanks. All are clear.
> > > > +       tcpci_unregister_port(priv->tcpci);
> > > > +       dev_pm_clear_wake_irq(&pdev->dev);
> > > > +       device_init_wakeup(&pdev->dev, false);
> > > > +
> > > > +       return 0;
> > > > +}
>
> --
> With Best Regards,
> Andy Shevchenko




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux