[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8fc06781-72a0-9f86-e9cc-6af2425f2077@collabora.com>
Date: Fri, 29 Apr 2022 11:50:49 +0300
From: Dmitry Osipenko <dmitry.osipenko@...labora.com>
To: Ashish Mhetre <amhetre@...dia.com>, krzysztof.kozlowski@...aro.org,
thierry.reding@...il.com, jonathanh@...dia.com, digetx@...il.com,
robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
devicetree@...r.kernel.org
Cc: vdumpa@...dia.com, Snikam@...dia.com
Subject: Re: [Patch v9 1/4] memory: tegra: Add memory controller channels
support
On 4/26/22 10:38, Ashish Mhetre wrote:
> +static int tegra186_mc_map_regs(struct tegra_mc *mc)
> +{
> + struct platform_device *pdev = to_platform_device(mc->dev);
> + unsigned int i;
> +
> + mc->bcast_ch_regs = devm_platform_ioremap_resource_byname(pdev, "broadcast");
> + if (IS_ERR(mc->bcast_ch_regs)) {
> + if (PTR_ERR(mc->bcast_ch_regs) == -EINVAL) {
> + dev_warn(&pdev->dev, "Broadcast channel is missing, please update your device-tree\n");
> + mc->bcast_ch_regs = NULL;
> + return 0;
> + }
> + return PTR_ERR(mc->bcast_ch_regs);
> + }
> +
> + mc->ch_regs = devm_kcalloc(mc->dev, mc->soc->num_channels,
> + sizeof(*mc->ch_regs), GFP_KERNEL);
> + if (!mc->ch_regs)
> + return -ENOMEM;
> +
> + for (i = 0; i < mc->soc->num_channels; i++) {
> + char name[5];
> +
> + snprintf(name, sizeof(name), "ch%u", i);
> + mc->ch_regs[i] = devm_platform_ioremap_resource_byname(pdev, name);
> + if (IS_ERR(mc->ch_regs[i]))
> + return PTR_ERR(mc->ch_regs[i]);
> + }
> +
> + return 0;
> +}
> +
> const struct tegra_mc_ops tegra186_mc_ops = {
> .probe = tegra186_mc_probe,
> .remove = tegra186_mc_remove,
> .resume = tegra186_mc_resume,
> .probe_device = tegra186_mc_probe_device,
> + .map_regs = tegra186_mc_map_regs,
> };
Do we really need the map_regs() callback? Could you please move it to
the tegra186_mc_probe()? .. Sorry, I haven't noticed this previously.
Powered by blists - more mailing lists