.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Intel I/OAT DMA Linux driver |
---|
3 | 4 | * Copyright(c) 2007 - 2009 Intel Corporation. |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify it |
---|
6 | | - * under the terms and conditions of the GNU General Public License, |
---|
7 | | - * version 2, as published by the Free Software Foundation. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
---|
10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
12 | | - * more details. |
---|
13 | | - * |
---|
14 | | - * The full GNU General Public License is included in this distribution in |
---|
15 | | - * the file called "COPYING". |
---|
16 | | - * |
---|
17 | 5 | */ |
---|
18 | 6 | |
---|
19 | 7 | #include <linux/kernel.h> |
---|
.. | .. |
---|
51 | 39 | #define DCA2_TAG_MAP_BYTE2 0x81 |
---|
52 | 40 | #define DCA2_TAG_MAP_BYTE3 0x82 |
---|
53 | 41 | #define DCA2_TAG_MAP_BYTE4 0x82 |
---|
54 | | - |
---|
55 | | -/* verify if tag map matches expected values */ |
---|
56 | | -static inline int dca2_tag_map_valid(u8 *tag_map) |
---|
57 | | -{ |
---|
58 | | - return ((tag_map[0] == DCA2_TAG_MAP_BYTE0) && |
---|
59 | | - (tag_map[1] == DCA2_TAG_MAP_BYTE1) && |
---|
60 | | - (tag_map[2] == DCA2_TAG_MAP_BYTE2) && |
---|
61 | | - (tag_map[3] == DCA2_TAG_MAP_BYTE3) && |
---|
62 | | - (tag_map[4] == DCA2_TAG_MAP_BYTE4)); |
---|
63 | | -} |
---|
64 | 42 | |
---|
65 | 43 | /* |
---|
66 | 44 | * "Legacy" DCA systems do not implement the DCA register set in the |
---|
.. | .. |
---|
114 | 92 | int max_requesters; |
---|
115 | 93 | int requester_count; |
---|
116 | 94 | u8 tag_map[IOAT_TAG_MAP_LEN]; |
---|
117 | | - struct ioat_dca_slot req_slots[0]; |
---|
| 95 | + struct ioat_dca_slot req_slots[]; |
---|
118 | 96 | }; |
---|
119 | 97 | |
---|
120 | 98 | static int ioat_dca_dev_managed(struct dca_provider *dca, |
---|
.. | .. |
---|
298 | 276 | return NULL; |
---|
299 | 277 | |
---|
300 | 278 | dca = alloc_dca_provider(&ioat_dca_ops, |
---|
301 | | - sizeof(*ioatdca) |
---|
302 | | - + (sizeof(struct ioat_dca_slot) * slots)); |
---|
| 279 | + struct_size(ioatdca, req_slots, slots)); |
---|
303 | 280 | if (!dca) |
---|
304 | 281 | return NULL; |
---|
305 | 282 | |
---|