File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -131,15 +131,25 @@ impl ThisModule {
131
131
bindings:: kernel_param_lock ( self . 0 )
132
132
}
133
133
134
- KParamGuard { this_module : self }
134
+ #[ cfg( CONFIG_SYSFS ) ]
135
+ return KParamGuard { this_module : self } ;
136
+
137
+ #[ cfg( not( CONFIG_SYSFS ) ) ]
138
+ return KParamGuard { _private : ( ) } ;
135
139
}
136
140
}
137
141
138
142
/// Scoped lock on the kernel parameters of [`ThisModule`].
139
143
///
140
144
/// Lock will be released when this struct is dropped.
145
+ #[ cfg_attr( CONFIG_SYSFS , repr( transparent) ) ]
141
146
pub struct KParamGuard < ' a > {
147
+ #[ cfg( CONFIG_SYSFS ) ]
142
148
this_module : & ' a ThisModule ,
149
+
150
+ // private field, so this struct can not be constructed from outside this crate
151
+ #[ cfg( not( CONFIG_SYSFS ) ) ]
152
+ _private : ( ) ,
143
153
}
144
154
145
155
#[ cfg( CONFIG_SYSFS ) ]
You can’t perform that action at this time.
0 commit comments