forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) 2014-2015 Hisilicon Limited.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
84 */
95
106 #include <linux/module.h>
....@@ -61,7 +57,7 @@
6157 }
6258 }
6359
64
-static void __iomem *
60
+static u8 __iomem *
6561 hns_ppe_common_get_ioaddr(struct ppe_common_cb *ppe_common)
6662 {
6763 return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET;
....@@ -70,8 +66,8 @@
7066 /**
7167 * hns_ppe_common_get_cfg - get ppe common config
7268 * @dsaf_dev: dasf device
73
- * comm_index: common index
74
- * retuen 0 - success , negative --fail
69
+ * @comm_index: common index
70
+ * return 0 - success , negative --fail
7571 */
7672 static int hns_ppe_common_get_cfg(struct dsaf_device *dsaf_dev, int comm_index)
7773 {
....@@ -83,8 +79,9 @@
8379 else
8480 ppe_num = HNS_PPE_DEBUG_NW_ENGINE_NUM;
8581
86
- ppe_common = devm_kzalloc(dsaf_dev->dev, sizeof(*ppe_common) +
87
- ppe_num * sizeof(struct hns_ppe_cb), GFP_KERNEL);
82
+ ppe_common = devm_kzalloc(dsaf_dev->dev,
83
+ struct_size(ppe_common, ppe_cb, ppe_num),
84
+ GFP_KERNEL);
8885 if (!ppe_common)
8986 return -ENOMEM;
9087
....@@ -110,8 +107,8 @@
110107 dsaf_dev->ppe_common[comm_index] = NULL;
111108 }
112109
113
-static void __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common,
114
- int ppe_idx)
110
+static u8 __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common,
111
+ int ppe_idx)
115112 {
116113 return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET;
117114 }
....@@ -146,7 +143,7 @@
146143
147144 /**
148145 * hns_ppe_checksum_hw - set ppe checksum caculate
149
- * @ppe_device: ppe device
146
+ * @ppe_cb: ppe device
150147 * @value: value
151148 */
152149 static void hns_ppe_checksum_hw(struct hns_ppe_cb *ppe_cb, u32 value)
....@@ -182,7 +179,7 @@
182179
183180 /**
184181 * hns_ppe_set_port_mode - set port mode
185
- * @ppe_device: ppe device
182
+ * @ppe_cb: ppe device
186183 * @mode: port mode
187184 */
188185 static void hns_ppe_set_port_mode(struct hns_ppe_cb *ppe_cb,
....@@ -347,7 +344,7 @@
347344
348345 /**
349346 * ppe_uninit_hw - uninit ppe
350
- * @ppe_device: ppe device
347
+ * @ppe_cb: ppe device
351348 */
352349 static void hns_ppe_uninit_hw(struct hns_ppe_cb *ppe_cb)
353350 {
....@@ -387,7 +384,8 @@
387384 /**
388385 * hns_ppe_reset - reinit ppe/rcb hw
389386 * @dsaf_dev: dasf device
390
- * retuen void
387
+ * @ppe_common_index: the index
388
+ * return void
391389 */
392390 void hns_ppe_reset_common(struct dsaf_device *dsaf_dev, u8 ppe_common_index)
393391 {
....@@ -458,7 +456,7 @@
458456
459457 /**
460458 * ppe_get_strings - get ppe srting
461
- * @ppe_device: ppe device
459
+ * @ppe_cb: ppe device
462460 * @stringset: string set type
463461 * @data: output string
464462 */
....@@ -516,7 +514,7 @@
516514 /**
517515 * hns_ppe_init - init ppe device
518516 * @dsaf_dev: dasf device
519
- * retuen 0 - success , negative --fail
517
+ * return 0 - success , negative --fail
520518 */
521519 int hns_ppe_init(struct dsaf_device *dsaf_dev)
522520 {