xref: /openbmc/linux/drivers/scsi/lpfc/lpfc_attr.h (revision d2c43ff1)
1 /*******************************************************************
2  * This file is part of the Emulex Linux Device Driver for         *
3  * Fibre Channel Host Bus Adapters.                                *
4  * Copyright (C) 2017 Broadcom. All Rights Reserved. The term      *
5  * “Broadcom” refers to Broadcom Limited and/or its subsidiaries.  *
6  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
7  * EMULEX and SLI are trademarks of Emulex.                        *
8  * www.broadcom.com                                                *
9  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
10  *                                                                 *
11  * This program is free software; you can redistribute it and/or   *
12  * modify it under the terms of version 2 of the GNU General       *
13  * Public License as published by the Free Software Foundation.    *
14  * This program is distributed in the hope that it will be useful. *
15  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
16  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
17  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
18  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
19  * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
20  * more details, a copy of which can be found in the file COPYING  *
21  * included with this package.                                     *
22  *******************************************************************/
23 
24 #define LPFC_ATTR(name, defval, minval, maxval, desc) \
25 static uint lpfc_##name = defval;\
26 module_param(lpfc_##name, uint, S_IRUGO);\
27 MODULE_PARM_DESC(lpfc_##name, desc);\
28 lpfc_param_init(name, defval, minval, maxval)
29 
30 #define LPFC_ATTR_R(name, defval, minval, maxval, desc) \
31 static uint lpfc_##name = defval;\
32 module_param(lpfc_##name, uint, S_IRUGO);\
33 MODULE_PARM_DESC(lpfc_##name, desc);\
34 lpfc_param_show(name)\
35 lpfc_param_init(name, defval, minval, maxval)\
36 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
37 
38 #define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \
39 static uint lpfc_##name = defval;\
40 module_param(lpfc_##name, uint, S_IRUGO);\
41 MODULE_PARM_DESC(lpfc_##name, desc);\
42 lpfc_param_show(name)\
43 lpfc_param_init(name, defval, minval, maxval)\
44 lpfc_param_set(name, defval, minval, maxval)\
45 lpfc_param_store(name)\
46 static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
47 		   lpfc_##name##_show, lpfc_##name##_store)
48 
49 #define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \
50 static uint lpfc_##name = defval;\
51 module_param(lpfc_##name, uint, S_IRUGO);\
52 MODULE_PARM_DESC(lpfc_##name, desc);\
53 lpfc_param_hex_show(name)\
54 lpfc_param_init(name, defval, minval, maxval)\
55 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
56 
57 #define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
58 static uint lpfc_##name = defval;\
59 module_param(lpfc_##name, uint, S_IRUGO);\
60 MODULE_PARM_DESC(lpfc_##name, desc);\
61 lpfc_param_hex_show(name)\
62 lpfc_param_init(name, defval, minval, maxval)\
63 lpfc_param_set(name, defval, minval, maxval)\
64 lpfc_param_store(name)\
65 static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
66 		   lpfc_##name##_show, lpfc_##name##_store)
67 
68 #define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \
69 static uint lpfc_##name = defval;\
70 module_param(lpfc_##name, uint, S_IRUGO);\
71 MODULE_PARM_DESC(lpfc_##name, desc);\
72 lpfc_vport_param_init(name, defval, minval, maxval)
73 
74 #define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \
75 static uint lpfc_##name = defval;\
76 module_param(lpfc_##name, uint, S_IRUGO);\
77 MODULE_PARM_DESC(lpfc_##name, desc);\
78 lpfc_vport_param_show(name)\
79 lpfc_vport_param_init(name, defval, minval, maxval)\
80 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
81 
82 #define LPFC_VPORT_ULL_ATTR_R(name, defval, minval, maxval, desc) \
83 static uint64_t lpfc_##name = defval;\
84 module_param(lpfc_##name, ullong, S_IRUGO);\
85 MODULE_PARM_DESC(lpfc_##name, desc);\
86 lpfc_vport_param_show(name)\
87 lpfc_vport_param_init(name, defval, minval, maxval)\
88 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
89 
90 #define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \
91 static uint lpfc_##name = defval;\
92 module_param(lpfc_##name, uint, S_IRUGO);\
93 MODULE_PARM_DESC(lpfc_##name, desc);\
94 lpfc_vport_param_show(name)\
95 lpfc_vport_param_init(name, defval, minval, maxval)\
96 lpfc_vport_param_set(name, defval, minval, maxval)\
97 lpfc_vport_param_store(name)\
98 static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
99 		   lpfc_##name##_show, lpfc_##name##_store)
100 
101 #define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \
102 static uint lpfc_##name = defval;\
103 module_param(lpfc_##name, uint, S_IRUGO);\
104 MODULE_PARM_DESC(lpfc_##name, desc);\
105 lpfc_vport_param_hex_show(name)\
106 lpfc_vport_param_init(name, defval, minval, maxval)\
107 static DEVICE_ATTR(lpfc_##name, S_IRUGO, lpfc_##name##_show, NULL)
108 
109 #define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
110 static uint lpfc_##name = defval;\
111 module_param(lpfc_##name, uint, S_IRUGO);\
112 MODULE_PARM_DESC(lpfc_##name, desc);\
113 lpfc_vport_param_hex_show(name)\
114 lpfc_vport_param_init(name, defval, minval, maxval)\
115 lpfc_vport_param_set(name, defval, minval, maxval)\
116 lpfc_vport_param_store(name)\
117 static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
118 		   lpfc_##name##_show, lpfc_##name##_store)
119