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