Hi Claudiu, On Fri, 8 Aug 2025 at 12:32, Claudiu Beznea <claudiu.beznea@xxxxxxxxx> wrote: > On 08.08.2025 12:29, Geert Uytterhoeven wrote: > > On Fri, 8 Aug 2025 at 08:18, Claudiu <claudiu.beznea@xxxxxxxxx> wrote: > >> From: John Madieu <john.madieu.xa@xxxxxxxxxxxxxx> > >> > >> The RZ/G3E system controller has various registers that control or report > >> some properties specific to individual IPs. The regmap is registered as a > >> syscon device to allow these IP drivers to access the registers through the > >> regmap API. > >> > >> As other RZ SoCs might have custom read/write callbacks or max-offsets, > >> register a custom regmap configuration. > >> > >> Signed-off-by: John Madieu <john.madieu.xa@xxxxxxxxxxxxxx> > >> [claudiu.beznea: > >> - do not check the match->data validity in rz_sysc_probe() as it is > >> always valid > >> - dinamically allocate regmap_cfg] > >> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx> > >> --- > >> > >> Changes in v4: > >> - adjusted the patch description by dropping "add" from > >> "add register a custom regmap configuration" > >> - updated the list of changes from Claudiu Beznea > >> - dynamically allocate the regmap_config as proposed at [2] > >> - this patch is needed for proper function of USB (as proposed in this > >> series) that being the reason it is introduced here, as well > >> > >> [2] https://lore.kernel.org/all/CAMuHMdVyf3Xtpw=LWHrnD2CVQX4xYm=FBHvY_dx9OesHDz5zNg@xxxxxxxxxxxxxx/ > > > >> --- a/drivers/soc/renesas/rz-sysc.c > >> +++ b/drivers/soc/renesas/rz-sysc.c > > = > >> @@ -117,7 +125,26 @@ static int rz_sysc_probe(struct platform_device *pdev) > >> return PTR_ERR(sysc->base); > >> > >> sysc->dev = dev; > >> - return rz_sysc_soc_init(sysc, match); > >> + ret = rz_sysc_soc_init(sysc, match); > >> + if (ret) > >> + return ret; > >> + > >> + regmap_cfg = devm_kzalloc(dev, sizeof(*regmap_cfg), GFP_KERNEL); > >> + if (!regmap_cfg) > >> + return -ENOMEM; > > > > Is there any specific reason you decided to allocate regmap_cfg > > separately, instead of embedding it into struct rz_sysc? > > Sorry, I missed to mention. > > I chose to have it like this as the regmap_cfg is not used anywhere else > (through rz_sysc) except in probe. OK. Upon closer look, devm_regmap_init_mmio() does not save the regmap_cfg pointer for later use, so it can be allocated using kzalloc() instead, and freed immediately after calling devm_regmap_init_mmio(). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx 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