hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/drivers/amba/tegra-ahb.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
34 * Copyright (C) 2011 Google, Inc.
....@@ -8,16 +9,6 @@
89 * Benoit Goby <benoit@android.com>
910 * Colin Cross <ccross@android.com>
1011 * Hiroshi DOYU <hdoyu@nvidia.com>
11
- *
12
- * This software is licensed under the terms of the GNU General Public
13
- * License version 2, as published by the Free Software Foundation, and
14
- * may be copied, distributed, and modified under those terms.
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU General Public License for more details.
20
- *
2112 */
2213
2314 #include <linux/err.h>
....@@ -129,7 +120,7 @@
129120 struct tegra_ahb {
130121 void __iomem *regs;
131122 struct device *dev;
132
- u32 ctx[0];
123
+ u32 ctx[];
133124 };
134125
135126 static inline u32 gizmo_readl(struct tegra_ahb *ahb, u32 offset)
....@@ -143,22 +134,13 @@
143134 }
144135
145136 #ifdef CONFIG_TEGRA_IOMMU_SMMU
146
-static int tegra_ahb_match_by_smmu(struct device *dev, void *data)
147
-{
148
- struct tegra_ahb *ahb = dev_get_drvdata(dev);
149
- struct device_node *dn = data;
150
-
151
- return (ahb->dev->of_node == dn) ? 1 : 0;
152
-}
153
-
154137 int tegra_ahb_enable_smmu(struct device_node *dn)
155138 {
156139 struct device *dev;
157140 u32 val;
158141 struct tegra_ahb *ahb;
159142
160
- dev = driver_find_device(&tegra_ahb_driver.driver, NULL, dn,
161
- tegra_ahb_match_by_smmu);
143
+ dev = driver_find_device_by_of_node(&tegra_ahb_driver.driver, dn);
162144 if (!dev)
163145 return -EPROBE_DEFER;
164146 ahb = dev_get_drvdata(dev);
....@@ -170,8 +152,7 @@
170152 EXPORT_SYMBOL(tegra_ahb_enable_smmu);
171153 #endif
172154
173
-#ifdef CONFIG_PM
174
-static int tegra_ahb_suspend(struct device *dev)
155
+static int __maybe_unused tegra_ahb_suspend(struct device *dev)
175156 {
176157 int i;
177158 struct tegra_ahb *ahb = dev_get_drvdata(dev);
....@@ -181,7 +162,7 @@
181162 return 0;
182163 }
183164
184
-static int tegra_ahb_resume(struct device *dev)
165
+static int __maybe_unused tegra_ahb_resume(struct device *dev)
185166 {
186167 int i;
187168 struct tegra_ahb *ahb = dev_get_drvdata(dev);
....@@ -190,7 +171,6 @@
190171 gizmo_writel(ahb, ahb->ctx[i], tegra_ahb_gizmo[i]);
191172 return 0;
192173 }
193
-#endif
194174
195175 static UNIVERSAL_DEV_PM_OPS(tegra_ahb_pm,
196176 tegra_ahb_suspend,