.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. |
---|
3 | 4 | * Copyright (C) 2011 Google, Inc. |
---|
.. | .. |
---|
8 | 9 | * Benoit Goby <benoit@android.com> |
---|
9 | 10 | * Colin Cross <ccross@android.com> |
---|
10 | 11 | * 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 | | - * |
---|
21 | 12 | */ |
---|
22 | 13 | |
---|
23 | 14 | #include <linux/err.h> |
---|
.. | .. |
---|
129 | 120 | struct tegra_ahb { |
---|
130 | 121 | void __iomem *regs; |
---|
131 | 122 | struct device *dev; |
---|
132 | | - u32 ctx[0]; |
---|
| 123 | + u32 ctx[]; |
---|
133 | 124 | }; |
---|
134 | 125 | |
---|
135 | 126 | static inline u32 gizmo_readl(struct tegra_ahb *ahb, u32 offset) |
---|
.. | .. |
---|
143 | 134 | } |
---|
144 | 135 | |
---|
145 | 136 | #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 | | - |
---|
154 | 137 | int tegra_ahb_enable_smmu(struct device_node *dn) |
---|
155 | 138 | { |
---|
156 | 139 | struct device *dev; |
---|
157 | 140 | u32 val; |
---|
158 | 141 | struct tegra_ahb *ahb; |
---|
159 | 142 | |
---|
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); |
---|
162 | 144 | if (!dev) |
---|
163 | 145 | return -EPROBE_DEFER; |
---|
164 | 146 | ahb = dev_get_drvdata(dev); |
---|
.. | .. |
---|
170 | 152 | EXPORT_SYMBOL(tegra_ahb_enable_smmu); |
---|
171 | 153 | #endif |
---|
172 | 154 | |
---|
173 | | -#ifdef CONFIG_PM |
---|
174 | | -static int tegra_ahb_suspend(struct device *dev) |
---|
| 155 | +static int __maybe_unused tegra_ahb_suspend(struct device *dev) |
---|
175 | 156 | { |
---|
176 | 157 | int i; |
---|
177 | 158 | struct tegra_ahb *ahb = dev_get_drvdata(dev); |
---|
.. | .. |
---|
181 | 162 | return 0; |
---|
182 | 163 | } |
---|
183 | 164 | |
---|
184 | | -static int tegra_ahb_resume(struct device *dev) |
---|
| 165 | +static int __maybe_unused tegra_ahb_resume(struct device *dev) |
---|
185 | 166 | { |
---|
186 | 167 | int i; |
---|
187 | 168 | struct tegra_ahb *ahb = dev_get_drvdata(dev); |
---|
.. | .. |
---|
190 | 171 | gizmo_writel(ahb, ahb->ctx[i], tegra_ahb_gizmo[i]); |
---|
191 | 172 | return 0; |
---|
192 | 173 | } |
---|
193 | | -#endif |
---|
194 | 174 | |
---|
195 | 175 | static UNIVERSAL_DEV_PM_OPS(tegra_ahb_pm, |
---|
196 | 176 | tegra_ahb_suspend, |
---|