hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/crypto/ccp/sp-platform.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * AMD Secure Processor device driver
34 *
4
- * Copyright (C) 2014,2016 Advanced Micro Devices, Inc.
5
+ * Copyright (C) 2014,2018 Advanced Micro Devices, Inc.
56 *
67 * Author: Tom Lendacky <thomas.lendacky@amd.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/module.h>
....@@ -33,8 +30,31 @@
3330 unsigned int irq_count;
3431 };
3532
36
-static const struct acpi_device_id sp_acpi_match[];
37
-static const struct of_device_id sp_of_match[];
33
+static const struct sp_dev_vdata dev_vdata[] = {
34
+ {
35
+ .bar = 0,
36
+#ifdef CONFIG_CRYPTO_DEV_SP_CCP
37
+ .ccp_vdata = &ccpv3_platform,
38
+#endif
39
+ },
40
+};
41
+
42
+#ifdef CONFIG_ACPI
43
+static const struct acpi_device_id sp_acpi_match[] = {
44
+ { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] },
45
+ { },
46
+};
47
+MODULE_DEVICE_TABLE(acpi, sp_acpi_match);
48
+#endif
49
+
50
+#ifdef CONFIG_OF
51
+static const struct of_device_id sp_of_match[] = {
52
+ { .compatible = "amd,ccp-seattle-v1a",
53
+ .data = (const void *)&dev_vdata[0] },
54
+ { },
55
+};
56
+MODULE_DEVICE_TABLE(of, sp_of_match);
57
+#endif
3858
3959 static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev)
4060 {
....@@ -105,7 +125,6 @@
105125 struct sp_platform *sp_platform;
106126 struct device *dev = &pdev->dev;
107127 enum dev_dma_attr attr;
108
- struct resource *ior;
109128 int ret;
110129
111130 ret = -ENOMEM;
....@@ -126,8 +145,7 @@
126145 goto e_err;
127146 }
128147
129
- ior = platform_get_resource(pdev, IORESOURCE_MEM, 0);
130
- sp->io_map = devm_ioremap_resource(dev, ior);
148
+ sp->io_map = devm_platform_ioremap_resource(pdev, 0);
131149 if (IS_ERR(sp->io_map)) {
132150 ret = PTR_ERR(sp->io_map);
133151 goto e_err;
....@@ -189,7 +207,7 @@
189207 struct device *dev = &pdev->dev;
190208 struct sp_device *sp = dev_get_drvdata(dev);
191209
192
- return sp_suspend(sp, state);
210
+ return sp_suspend(sp);
193211 }
194212
195213 static int sp_platform_resume(struct platform_device *pdev)
....@@ -199,32 +217,6 @@
199217
200218 return sp_resume(sp);
201219 }
202
-#endif
203
-
204
-static const struct sp_dev_vdata dev_vdata[] = {
205
- {
206
- .bar = 0,
207
-#ifdef CONFIG_CRYPTO_DEV_SP_CCP
208
- .ccp_vdata = &ccpv3_platform,
209
-#endif
210
- },
211
-};
212
-
213
-#ifdef CONFIG_ACPI
214
-static const struct acpi_device_id sp_acpi_match[] = {
215
- { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] },
216
- { },
217
-};
218
-MODULE_DEVICE_TABLE(acpi, sp_acpi_match);
219
-#endif
220
-
221
-#ifdef CONFIG_OF
222
-static const struct of_device_id sp_of_match[] = {
223
- { .compatible = "amd,ccp-seattle-v1a",
224
- .data = (const void *)&dev_vdata[0] },
225
- { },
226
-};
227
-MODULE_DEVICE_TABLE(of, sp_of_match);
228220 #endif
229221
230222 static struct platform_driver sp_platform_driver = {