hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mailbox/arm_mhu.c
....@@ -1,28 +1,17 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2013-2015 Fujitsu Semiconductor Ltd.
34 * Copyright (C) 2015 Linaro Ltd.
45 * Author: Jassi Brar <jaswinder.singh@linaro.org>
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, version 2 of the License.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
146 */
157
16
-#include <linux/interrupt.h>
17
-#include <linux/spinlock.h>
18
-#include <linux/mutex.h>
19
-#include <linux/delay.h>
20
-#include <linux/slab.h>
21
-#include <linux/err.h>
22
-#include <linux/io.h>
23
-#include <linux/module.h>
248 #include <linux/amba/bus.h>
9
+#include <linux/device.h>
10
+#include <linux/err.h>
11
+#include <linux/interrupt.h>
12
+#include <linux/io.h>
2513 #include <linux/mailbox_controller.h>
14
+#include <linux/module.h>
2615
2716 #define INTR_STAT_OFS 0x0
2817 #define INTR_SET_OFS 0x8
....@@ -124,6 +113,9 @@
124113 struct device *dev = &adev->dev;
125114 int mhu_reg[MHU_CHANS] = {MHU_LP_OFFSET, MHU_HP_OFFSET, MHU_SEC_OFFSET};
126115
116
+ if (!of_device_is_compatible(dev->of_node, "arm,mhu"))
117
+ return -ENODEV;
118
+
127119 /* Allocate memory for device */
128120 mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL);
129121 if (!mhu)
....@@ -152,22 +144,13 @@
152144
153145 amba_set_drvdata(adev, mhu);
154146
155
- err = mbox_controller_register(&mhu->mbox);
147
+ err = devm_mbox_controller_register(dev, &mhu->mbox);
156148 if (err) {
157149 dev_err(dev, "Failed to register mailboxes %d\n", err);
158150 return err;
159151 }
160152
161153 dev_info(dev, "ARM MHU Mailbox registered\n");
162
- return 0;
163
-}
164
-
165
-static int mhu_remove(struct amba_device *adev)
166
-{
167
- struct arm_mhu *mhu = amba_get_drvdata(adev);
168
-
169
- mbox_controller_unregister(&mhu->mbox);
170
-
171154 return 0;
172155 }
173156
....@@ -186,7 +169,6 @@
186169 },
187170 .id_table = mhu_ids,
188171 .probe = mhu_probe,
189
- .remove = mhu_remove,
190172 };
191173 module_amba_driver(arm_mhu_driver);
192174