summaryrefslogtreecommitdiff
path: root/include/soc/tegra/mc.h
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2020-11-04 19:49:04 +0300
committerKrzysztof Kozlowski <krzk@kernel.org>2020-11-26 18:50:29 +0100
commit6c6bd2075f01f8c8ae4bc803ba5cd23a3d3db533 (patch)
tree0d84c1b81d5a71b5a6d4847df251477be329aeec /include/soc/tegra/mc.h
parent7f3cdaf795dbc4a270d3af304e7eb8d6234b5f07 (diff)
memory: tegra: Add and use devm_tegra_memory_controller_get()
Multiple Tegra drivers need to retrieve Memory Controller and there is duplication of the retrieval code among the drivers. Add new devm_tegra_memory_controller_get() helper to remove the code's duplication and to fix put_device() which was missed in the duplicated code. Make EMC drivers to use the new helper. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20201104164923.21238-29-digetx@gmail.com Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Diffstat (limited to 'include/soc/tegra/mc.h')
-rw-r--r--include/soc/tegra/mc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
index 1238e35653d1..d9395af98143 100644
--- a/include/soc/tegra/mc.h
+++ b/include/soc/tegra/mc.h
@@ -184,4 +184,14 @@ struct tegra_mc {
int tegra_mc_write_emem_configuration(struct tegra_mc *mc, unsigned long rate);
unsigned int tegra_mc_get_emem_device_count(struct tegra_mc *mc);
+#ifdef CONFIG_TEGRA_MC
+struct tegra_mc *devm_tegra_memory_controller_get(struct device *dev);
+#else
+static inline struct tegra_mc *
+devm_tegra_memory_controller_get(struct device *dev)
+{
+ ERR_PTR(-ENODEV);
+}
+#endif
+
#endif /* __SOC_TEGRA_MC_H__ */