Re: [PATCH v3 4/6] pmdomain: renesas: Add R-Car X5H MDLC driver
Geert Uytterhoeven <[email protected]> Thu, 6 Aug 2026 09:49:58 +0200
| Newsgroups | org.kernel.vger.linux-renesas-soc,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-clk,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <CAMuHMdXHPjzCidCkfyF0c9fndAmAte1DuhxGZt=WY=_jxpwU+Q@mail.gmail.com> |
Hi Marek, Thanks for your comments! On Thu, 6 Aug 2026 at 00:38, Marek Vasut <[email protected]> wrote: > On 8/5/26 5:20 PM, Geert Uytterhoeven wrote: > > +DEFINE_MDLC_RESET_WRAPPER(reset) > > +DEFINE_MDLC_RESET_WRAPPER(assert) > > +DEFINE_MDLC_RESET_WRAPPER(deassert) > > +DEFINE_MDLC_RESET_WRAPPER(status) > > + > > +static const struct reset_control_ops r8a78000_mdlc_reset_ops = { > > + .reset = r8a78000_mdlc_reset, > > + .assert = r8a78000_mdlc_assert, > > + .deassert = r8a78000_mdlc_deassert, > > + .status = r8a78000_mdlc_status, > > +}; > > Please keep the list sorted alphabetically. This matches the order in which the members of struct reset_control_ops are defined. > > +static int r8a78000_mdlc_attach_dev(struct generic_pm_domain *domain, > > + struct device *dev) > > +{ > > + struct device_node *np = dev->of_node; > > + struct r8a78000_mdlc_priv *priv; > > + struct of_phandle_args pd_spec; > > + const struct mod_map *map; > > + unsigned int id; > > + int ret; > > + > > + ret = of_parse_phandle_with_args(np, "power-domains", > > + "#power-domain-cells", 0, &pd_spec); > > + if (ret < 0) > > + return ret; > > + > > + if (pd_spec.args_count != 2) { > > + of_node_put(pd_spec.np); > > Maybe some "goto error" fail path which does of_node_put() wouldn't hurt > here, since the of_node_put() is duplicated in here multiple times. I'd rather keep it like this, as of_node_put() must not be called in all error paths. Moreover, SCMI remapping will add more error paths, and multiple fail* labels. > > > + return -EINVAL; > > + } > > + > > + scoped_guard(mutex, &r8a78000_mdlc_lock) { > > + hlist_for_each_entry(priv, &r8a78000_mdlc_list, link) { > > + if (priv->np == pd_spec.np) > > + break; > > + } > > + } > > + > > + if (!priv) { > > + dev_err(dev, "%s: MDLC %pOF not found\n", __func__, pd_spec.np); > > + of_node_put(pd_spec.np); > > + return -ENODEV; > > + } > > + > > + id = pd_spec.args[1]; > > + of_node_put(pd_spec.np); > > + > > + map = mod_map_find(priv->mod_map, id); > > + if (!map) { > > + dev_err(dev, "Unknown module 0x%x\n", id); > > + return -ENOENT; > > + } > > + > > + dev_dbg(dev, "Ignoring HW module 0x%x\n", id); > > + return 0; > > +} > > [...] > > > +static int r8a78000_mdlc_probe(struct platform_device *pdev) > > +{ > > + if (!info->base) { > > + dev_dbg(dev, "Unsupported MDLC instance 0x%pa\n", &res->start); > > return dev_err_probe() might be more appropriate here, even if that > would be more chatty until the support for various MDLC nodes lands. Indeed, it would be very chatty, and may confuse users, that's why I used dev_dbg(). We can revisit that later. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds