| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This software is available to you under a choice of one of two |
|---|
| 5 | | - * licenses. You may choose to be licensed under the terms of the GNU |
|---|
| 6 | | - * General Public License (GPL) Version 2, available from the file |
|---|
| 7 | | - * COPYING in the main directory of this source tree, or the |
|---|
| 8 | | - * OpenIB.org BSD license below: |
|---|
| 9 | | - * |
|---|
| 10 | | - * Redistribution and use in source and binary forms, with or |
|---|
| 11 | | - * without modification, are permitted provided that the following |
|---|
| 12 | | - * conditions are met: |
|---|
| 13 | | - * |
|---|
| 14 | | - * - Redistributions of source code must retain the above |
|---|
| 15 | | - * copyright notice, this list of conditions and the following |
|---|
| 16 | | - * disclaimer. |
|---|
| 17 | | - * |
|---|
| 18 | | - * - Redistributions in binary form must reproduce the above |
|---|
| 19 | | - * copyright notice, this list of conditions and the following |
|---|
| 20 | | - * disclaimer in the documentation and/or other materials |
|---|
| 21 | | - * provided with the distribution. |
|---|
| 22 | | - * |
|---|
| 23 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|---|
| 24 | | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|---|
| 25 | | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|---|
| 26 | | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
|---|
| 27 | | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|---|
| 28 | | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|---|
| 29 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|---|
| 30 | | - * SOFTWARE. |
|---|
| 31 | 4 | */ |
|---|
| 32 | 5 | |
|---|
| 33 | 6 | #ifndef _UVERBS_NAMED_IOCTL_ |
|---|
| .. | .. |
|---|
| 43 | 16 | #define _UVERBS_NAME(x, y) _UVERBS_PASTE(x, y) |
|---|
| 44 | 17 | #define UVERBS_METHOD(id) _UVERBS_NAME(UVERBS_MODULE_NAME, _method_##id) |
|---|
| 45 | 18 | #define UVERBS_HANDLER(id) _UVERBS_NAME(UVERBS_MODULE_NAME, _handler_##id) |
|---|
| 46 | | -#define UVERBS_OBJECT(id) _UVERBS_NAME(UVERBS_MOUDLE_NAME, _object_##id) |
|---|
| 19 | +#define UVERBS_OBJECT(id) _UVERBS_NAME(UVERBS_MODULE_NAME, _object_##id) |
|---|
| 47 | 20 | |
|---|
| 48 | 21 | /* These are static so they do not need to be qualified */ |
|---|
| 49 | 22 | #define UVERBS_METHOD_ATTRS(method_id) _method_attrs_##method_id |
|---|
| .. | .. |
|---|
| 76 | 49 | #define DECLARE_UVERBS_NAMED_OBJECT(_object_id, _type_attrs, ...) \ |
|---|
| 77 | 50 | static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \ |
|---|
| 78 | 51 | _object_id)[] = { __VA_ARGS__ }; \ |
|---|
| 79 | | - const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \ |
|---|
| 52 | + static const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \ |
|---|
| 80 | 53 | .id = _object_id, \ |
|---|
| 81 | 54 | .type_attrs = &_type_attrs, \ |
|---|
| 82 | 55 | .num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \ |
|---|
| .. | .. |
|---|
| 88 | 61 | * identify all uapi methods with a (object,method) tuple. However, they have |
|---|
| 89 | 62 | * no type pointer. |
|---|
| 90 | 63 | */ |
|---|
| 91 | | -#define DECLARE_UVERBS_GLOBAL_METHODS(_object_id, ...) \ |
|---|
| 64 | +#define DECLARE_UVERBS_GLOBAL_METHODS(_object_id, ...) \ |
|---|
| 92 | 65 | static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \ |
|---|
| 93 | 66 | _object_id)[] = { __VA_ARGS__ }; \ |
|---|
| 94 | | - const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \ |
|---|
| 67 | + static const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \ |
|---|
| 95 | 68 | .id = _object_id, \ |
|---|
| 96 | 69 | .num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \ |
|---|
| 97 | 70 | .methods = &UVERBS_OBJECT_METHODS(_object_id) \ |
|---|
| .. | .. |
|---|
| 102 | 75 | #define ADD_UVERBS_METHODS(_name, _object_id, ...) \ |
|---|
| 103 | 76 | static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \ |
|---|
| 104 | 77 | _object_id)[] = { __VA_ARGS__ }; \ |
|---|
| 105 | | - static const struct uverbs_object_def _name##_struct = { \ |
|---|
| 78 | + static const struct uverbs_object_def _name = { \ |
|---|
| 106 | 79 | .id = _object_id, \ |
|---|
| 107 | 80 | .num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \ |
|---|
| 108 | 81 | .methods = &UVERBS_OBJECT_METHODS(_object_id) \ |
|---|
| 109 | | - }; \ |
|---|
| 110 | | - static const struct uverbs_object_def *const _name##_ptrs[] = { \ |
|---|
| 111 | | - &_name##_struct, \ |
|---|
| 112 | | - }; \ |
|---|
| 113 | | - static const struct uverbs_object_tree_def _name = { \ |
|---|
| 114 | | - .num_objects = 1, \ |
|---|
| 115 | | - .objects = &_name##_ptrs, \ |
|---|
| 116 | | - } |
|---|
| 82 | + }; |
|---|
| 117 | 83 | |
|---|
| 118 | 84 | /* Used by drivers to declare a complete parsing tree for a single method that |
|---|
| 119 | 85 | * differs only in having additional driver specific attributes. |
|---|