RE: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support

From: Kevin Chen
Date: Sun Mar 09 2025 - 22:15:49 EST


> Le 04/03/2025 à 11:44, Kevin Chen a écrit :
> > Add LPC PCC controller driver to support POST code capture.
> >
> > Signed-off-by: Kevin Chen <kevin_chen@xxxxxxxxxxxxxx>
>
> Hi,
>
> > + init_waitqueue_head(&pcc->wq);
> > +
> > + pcc->mdev_id = ida_alloc(&aspeed_pcc_ida, GFP_KERNEL);
>
> Missing ida_free() in therror handling path and in the rmove function?
OK. I will add the ida_free function in remove function. Thanks a lot.

>
> > + if (pcc->mdev_id < 0) {
> > + dev_err(dev, "Couldn't allocate ID\n");
> > + return pcc->mdev_id;
> > + }
> > +
> > + pcc->mdev.parent = dev;
> > + pcc->mdev.minor = MISC_DYNAMIC_MINOR;
> > + pcc->mdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s%d",
> DEVICE_NAME,
> > + pcc->mdev_id);
> > + pcc->mdev.fops = &pcc_fops;
> > + rc = misc_register(&pcc->mdev);
> > + if (rc) {
> > + dev_err(dev, "Couldn't register misc device\n");
> > + goto err_free_kfifo;
> > + }
> > +
> > + rc = aspeed_pcc_enable(pcc, dev);
> > + if (rc) {
> > + dev_err(dev, "Couldn't enable PCC\n");
> > + goto err_dereg_mdev;
> > + }
> > +
> > + dev_set_drvdata(&pdev->dev, pcc);
> > +
> > + return 0;
> > +
> > +err_dereg_mdev:
> > + misc_deregister(&pcc->mdev);
> > +
> > +err_free_kfifo:
> > + kfifo_free(&pcc->fifo);
> > +
> > + return rc;
> > +}
> > +
> > +static void aspeed_pcc_remove(struct platform_device *pdev) {
> > + struct device *dev = &pdev->dev;
> > + struct aspeed_pcc_ctrl *pcc = dev_get_drvdata(dev);
> > +
> > + kfifo_free(&pcc->fifo);
> > + misc_deregister(&pcc->mdev);
> > +}
> > +
> > +static const struct of_device_id aspeed_pcc_table[] = {
> > + { .compatible = "aspeed,ast2600-lpc-pcc" },
> > + { },
>
> Unneeded trailing comma after a terminator.
OK, I will remove it.

>
> > +};
> > +
> > +static struct platform_driver aspeed_pcc_driver = {
> > + .driver = {
> > + .name = "aspeed-pcc",
> > + .of_match_table = aspeed_pcc_table,
> > + },
> > + .probe = aspeed_pcc_probe,
> > + .remove = aspeed_pcc_remove,
> > +};
>
> ...
>
> CJ