summaryrefslogtreecommitdiffstats
path: root/drivers/memory
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2021-06-02 18:32:53 +0200
committerKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>2021-06-03 21:49:40 +0200
commit6cc884c1c7fe5ae9362180d4f7d4091774921a0c (patch)
tree33636266779e77ab83a80337f2b98f60d01efe44 /drivers/memory
parentmemory: tegra: Unify struct tegra_mc across SoC generations (diff)
downloadlinux-6cc884c1c7fe5ae9362180d4f7d4091774921a0c.tar.xz
linux-6cc884c1c7fe5ae9362180d4f7d4091774921a0c.zip
memory: tegra: Introduce struct tegra_mc_ops
Subsequent patches will introduce further callbacks, so create a new struct tegra_mc_ops to collect all of them in a single place. Move the existing ->init() callback into the new structure. Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20210602163302.120041-4-thierry.reding@gmail.com Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Diffstat (limited to 'drivers/memory')
-rw-r--r--drivers/memory/tegra/mc.c4
-rw-r--r--drivers/memory/tegra/tegra20.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index b7e104bf6614..559ae1ef5633 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -829,8 +829,8 @@ static int tegra_mc_probe(struct platform_device *pdev)
mc->debugfs.root = debugfs_create_dir("mc", NULL);
- if (mc->soc->init) {
- err = mc->soc->init(mc);
+ if (mc->soc->ops && mc->soc->ops->init) {
+ err = mc->soc->ops->init(mc);
if (err < 0)
dev_err(&pdev->dev, "failed to initialize SoC driver: %d\n",
err);
diff --git a/drivers/memory/tegra/tegra20.c b/drivers/memory/tegra/tegra20.c
index 2db68a913b7a..3b7b93b96480 100644
--- a/drivers/memory/tegra/tegra20.c
+++ b/drivers/memory/tegra/tegra20.c
@@ -687,6 +687,10 @@ static int tegra20_mc_init(struct tegra_mc *mc)
return 0;
}
+static const struct tegra_mc_ops tegra20_mc_ops = {
+ .init = tegra20_mc_init,
+};
+
const struct tegra_mc_soc tegra20_mc_soc = {
.clients = tegra20_mc_clients,
.num_clients = ARRAY_SIZE(tegra20_mc_clients),
@@ -698,5 +702,5 @@ const struct tegra_mc_soc tegra20_mc_soc = {
.resets = tegra20_mc_resets,
.num_resets = ARRAY_SIZE(tegra20_mc_resets),
.icc_ops = &tegra20_mc_icc_ops,
- .init = tegra20_mc_init,
+ .ops = &tegra20_mc_ops,
};