| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * 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. |
|---|
| 8 | 4 | */ |
|---|
| 9 | 5 | |
|---|
| 10 | 6 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 61 | 57 | } |
|---|
| 62 | 58 | } |
|---|
| 63 | 59 | |
|---|
| 64 | | -static void __iomem * |
|---|
| 60 | +static u8 __iomem * |
|---|
| 65 | 61 | hns_ppe_common_get_ioaddr(struct ppe_common_cb *ppe_common) |
|---|
| 66 | 62 | { |
|---|
| 67 | 63 | return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET; |
|---|
| .. | .. |
|---|
| 70 | 66 | /** |
|---|
| 71 | 67 | * hns_ppe_common_get_cfg - get ppe common config |
|---|
| 72 | 68 | * @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 |
|---|
| 75 | 71 | */ |
|---|
| 76 | 72 | static int hns_ppe_common_get_cfg(struct dsaf_device *dsaf_dev, int comm_index) |
|---|
| 77 | 73 | { |
|---|
| .. | .. |
|---|
| 83 | 79 | else |
|---|
| 84 | 80 | ppe_num = HNS_PPE_DEBUG_NW_ENGINE_NUM; |
|---|
| 85 | 81 | |
|---|
| 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); |
|---|
| 88 | 85 | if (!ppe_common) |
|---|
| 89 | 86 | return -ENOMEM; |
|---|
| 90 | 87 | |
|---|
| .. | .. |
|---|
| 110 | 107 | dsaf_dev->ppe_common[comm_index] = NULL; |
|---|
| 111 | 108 | } |
|---|
| 112 | 109 | |
|---|
| 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) |
|---|
| 115 | 112 | { |
|---|
| 116 | 113 | return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET; |
|---|
| 117 | 114 | } |
|---|
| .. | .. |
|---|
| 146 | 143 | |
|---|
| 147 | 144 | /** |
|---|
| 148 | 145 | * hns_ppe_checksum_hw - set ppe checksum caculate |
|---|
| 149 | | - * @ppe_device: ppe device |
|---|
| 146 | + * @ppe_cb: ppe device |
|---|
| 150 | 147 | * @value: value |
|---|
| 151 | 148 | */ |
|---|
| 152 | 149 | static void hns_ppe_checksum_hw(struct hns_ppe_cb *ppe_cb, u32 value) |
|---|
| .. | .. |
|---|
| 182 | 179 | |
|---|
| 183 | 180 | /** |
|---|
| 184 | 181 | * hns_ppe_set_port_mode - set port mode |
|---|
| 185 | | - * @ppe_device: ppe device |
|---|
| 182 | + * @ppe_cb: ppe device |
|---|
| 186 | 183 | * @mode: port mode |
|---|
| 187 | 184 | */ |
|---|
| 188 | 185 | static void hns_ppe_set_port_mode(struct hns_ppe_cb *ppe_cb, |
|---|
| .. | .. |
|---|
| 347 | 344 | |
|---|
| 348 | 345 | /** |
|---|
| 349 | 346 | * ppe_uninit_hw - uninit ppe |
|---|
| 350 | | - * @ppe_device: ppe device |
|---|
| 347 | + * @ppe_cb: ppe device |
|---|
| 351 | 348 | */ |
|---|
| 352 | 349 | static void hns_ppe_uninit_hw(struct hns_ppe_cb *ppe_cb) |
|---|
| 353 | 350 | { |
|---|
| .. | .. |
|---|
| 387 | 384 | /** |
|---|
| 388 | 385 | * hns_ppe_reset - reinit ppe/rcb hw |
|---|
| 389 | 386 | * @dsaf_dev: dasf device |
|---|
| 390 | | - * retuen void |
|---|
| 387 | + * @ppe_common_index: the index |
|---|
| 388 | + * return void |
|---|
| 391 | 389 | */ |
|---|
| 392 | 390 | void hns_ppe_reset_common(struct dsaf_device *dsaf_dev, u8 ppe_common_index) |
|---|
| 393 | 391 | { |
|---|
| .. | .. |
|---|
| 458 | 456 | |
|---|
| 459 | 457 | /** |
|---|
| 460 | 458 | * ppe_get_strings - get ppe srting |
|---|
| 461 | | - * @ppe_device: ppe device |
|---|
| 459 | + * @ppe_cb: ppe device |
|---|
| 462 | 460 | * @stringset: string set type |
|---|
| 463 | 461 | * @data: output string |
|---|
| 464 | 462 | */ |
|---|
| .. | .. |
|---|
| 516 | 514 | /** |
|---|
| 517 | 515 | * hns_ppe_init - init ppe device |
|---|
| 518 | 516 | * @dsaf_dev: dasf device |
|---|
| 519 | | - * retuen 0 - success , negative --fail |
|---|
| 517 | + * return 0 - success , negative --fail |
|---|
| 520 | 518 | */ |
|---|
| 521 | 519 | int hns_ppe_init(struct dsaf_device *dsaf_dev) |
|---|
| 522 | 520 | { |
|---|