Re: [PATCH net-next v5 2/3] ptp: Add driver for R-Car Gen4

From: Niklas Söderlund

Date: Tue Jul 28 2026 - 09:53:24 EST


Hi Paolo,

Thanks for your feedback.

On 2026-07-28 13:18:59 +0200, Paolo Abeni wrote:
> On 7/21/26 3:29 PM, Niklas Söderlund wrote:
> > +static int ptp_rcar_gen4_probe(struct platform_device *pdev)
> > +{
> > + struct ptp_rcar_gen4_priv *priv;
> > + struct device *dev = &pdev->dev;
> > + unsigned long rate;
> > +
> > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
> > +
> > + platform_set_drvdata(pdev, priv);
> > +
> > + priv->base = devm_platform_ioremap_resource(pdev, 0);
> > + if (IS_ERR(priv->base))
> > + return PTR_ERR(priv->base);
> > +
> > + priv->clk = devm_clk_get(dev, NULL);
> > + if (IS_ERR(priv->clk))
> > + return PTR_ERR(priv->clk);
> > +
> > + rate = clk_get_rate(priv->clk);
> > + if (!rate)
> > + return -ENODEV;
> > +
> > + spin_lock_init(&priv->lock);
> > +
> > + priv->info = ptp_rcar_gen4_info;
> > +
> > + /* Default timer increment in ns.
> > + * bit[31:27] - integer
> > + * bit[26:0] - decimal
> > + * increment[ns] = perid[ns] * 2^27 => (1ns * 2^27) / rate[hz]
> > + */
> > +
> > + priv->default_addend = div_s64(1000000000LL << 27, rate);
> > +
> > + pm_runtime_enable(dev);
> > + pm_runtime_get_sync(dev);
>
> Both sashikos agrees pm_runtime_resume_and_get() should be used instead.
> This was already raised in v4, with no reply.

Ahh now I get it. The sashikos reply says that the return value of
pm_runtime_get_sync() is not checked, not to use
pm_runtime_resume_and_get().

I only greped for other users of pm_runtime_get_sync() and saw none of
them checked the return value and ignored the sashikos reply. Will fix
in a new version.

>
> /P
>

--
Kind Regards,
Niklas Söderlund