@@ -901,12 +901,16 @@ pub trait Driver {
901
901
#[ repr( transparent) ]
902
902
pub struct Registration < T : Driver > ( KBox < UnsafeCell < bindings:: cpufreq_driver > > , PhantomData < T > ) ;
903
903
904
- /// SAFETY: `Registration` doesn't offer any methods or access to fields when shared between threads
904
+ /// # Safety
905
+ ///
906
+ /// `Registration` doesn't offer any methods or access to fields when shared between threads
905
907
/// or CPUs, so it is safe to share it.
906
908
unsafe impl < T : Driver > Sync for Registration < T > { }
907
909
908
910
#[ allow( clippy:: non_send_fields_in_send_ty) ]
909
- /// SAFETY: Registration with and unregistration from the cpufreq subsystem can happen from any
911
+ /// # Safety
912
+ ///
913
+ /// Registration with and unregistration from the cpufreq subsystem can happen from any
910
914
/// thread.
911
915
unsafe impl < T : Driver > Send for Registration < T > { }
912
916
@@ -1055,7 +1059,9 @@ impl<T: Driver> Registration<T> {
1055
1059
impl < T : Driver > Registration < T > {
1056
1060
/// Driver's `init` callback.
1057
1061
///
1058
- /// SAFETY: Called from C. Inputs must be valid pointers.
1062
+ /// # Safety
1063
+ ///
1064
+ /// Called from C. Inputs must be valid pointers.
1059
1065
extern "C" fn init_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
1060
1066
from_result ( || {
1061
1067
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
@@ -1070,7 +1076,9 @@ impl<T: Driver> Registration<T> {
1070
1076
1071
1077
/// Driver's `exit` callback.
1072
1078
///
1073
- /// SAFETY: Called from C. Inputs must be valid pointers.
1079
+ /// # Safety
1080
+ ///
1081
+ /// Called from C. Inputs must be valid pointers.
1074
1082
extern "C" fn exit_callback ( ptr : * mut bindings:: cpufreq_policy ) {
1075
1083
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
1076
1084
// lifetime of `policy`.
@@ -1082,7 +1090,9 @@ impl<T: Driver> Registration<T> {
1082
1090
1083
1091
/// Driver's `online` callback.
1084
1092
///
1085
- /// SAFETY: Called from C. Inputs must be valid pointers.
1093
+ /// # Safety
1094
+ ///
1095
+ /// Called from C. Inputs must be valid pointers.
1086
1096
extern "C" fn online_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
1087
1097
from_result ( || {
1088
1098
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
@@ -1094,7 +1104,9 @@ impl<T: Driver> Registration<T> {
1094
1104
1095
1105
/// Driver's `offline` callback.
1096
1106
///
1097
- /// SAFETY: Called from C. Inputs must be valid pointers.
1107
+ /// # Safety
1108
+ ///
1109
+ /// Called from C. Inputs must be valid pointers.
1098
1110
extern "C" fn offline_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
1099
1111
from_result ( || {
1100
1112
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
@@ -1106,7 +1118,9 @@ impl<T: Driver> Registration<T> {
1106
1118
1107
1119
/// Driver's `suspend` callback.
1108
1120
///
1109
- /// SAFETY: Called from C. Inputs must be valid pointers.
1121
+ /// # Safety
1122
+ ///
1123
+ /// Called from C. Inputs must be valid pointers.
1110
1124
extern "C" fn suspend_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
1111
1125
from_result ( || {
1112
1126
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
@@ -1118,7 +1132,9 @@ impl<T: Driver> Registration<T> {
1118
1132
1119
1133
/// Driver's `resume` callback.
1120
1134
///
1121
- /// SAFETY: Called from C. Inputs must be valid pointers.
1135
+ /// # Safety
1136
+ ///
1137
+ /// Called from C. Inputs must be valid pointers.
1122
1138
extern "C" fn resume_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
1123
1139
from_result ( || {
1124
1140
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
@@ -1130,7 +1146,9 @@ impl<T: Driver> Registration<T> {
1130
1146
1131
1147
/// Driver's `ready` callback.
1132
1148
///
1133
- /// SAFETY: Called from C. Inputs must be valid pointers.
1149
+ /// # Safety
1150
+ ///
1151
+ /// Called from C. Inputs must be valid pointers.
1134
1152
extern "C" fn ready_callback ( ptr : * mut bindings:: cpufreq_policy ) {
1135
1153
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
1136
1154
// lifetime of `policy`.
@@ -1140,7 +1158,9 @@ impl<T: Driver> Registration<T> {
1140
1158
1141
1159
/// Driver's `verify` callback.
1142
1160
///
1143
- /// SAFETY: Called from C. Inputs must be valid pointers.
1161
+ /// # Safety
1162
+ ///
1163
+ /// Called from C. Inputs must be valid pointers.
1144
1164
extern "C" fn verify_callback ( ptr : * mut bindings:: cpufreq_policy_data ) -> kernel:: ffi:: c_int {
1145
1165
from_result ( || {
1146
1166
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
@@ -1152,7 +1172,9 @@ impl<T: Driver> Registration<T> {
1152
1172
1153
1173
/// Driver's `setpolicy` callback.
1154
1174
///
1155
- /// SAFETY: Called from C. Inputs must be valid pointers.
1175
+ /// # Safety
1176
+ ///
1177
+ /// Called from C. Inputs must be valid pointers.
1156
1178
extern "C" fn setpolicy_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
1157
1179
from_result ( || {
1158
1180
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
@@ -1164,7 +1186,9 @@ impl<T: Driver> Registration<T> {
1164
1186
1165
1187
/// Driver's `target` callback.
1166
1188
///
1167
- /// SAFETY: Called from C. Inputs must be valid pointers.
1189
+ /// # Safety
1190
+ ///
1191
+ /// Called from C. Inputs must be valid pointers.
1168
1192
extern "C" fn target_callback (
1169
1193
ptr : * mut bindings:: cpufreq_policy ,
1170
1194
target_freq : u32 ,
@@ -1180,7 +1204,9 @@ impl<T: Driver> Registration<T> {
1180
1204
1181
1205
/// Driver's `target_index` callback.
1182
1206
///
1183
- /// SAFETY: Called from C. Inputs must be valid pointers.
1207
+ /// # Safety
1208
+ ///
1209
+ /// Called from C. Inputs must be valid pointers.
1184
1210
extern "C" fn target_index_callback (
1185
1211
ptr : * mut bindings:: cpufreq_policy ,
1186
1212
index : u32 ,
@@ -1200,7 +1226,9 @@ impl<T: Driver> Registration<T> {
1200
1226
1201
1227
/// Driver's `fast_switch` callback.
1202
1228
///
1203
- /// SAFETY: Called from C. Inputs must be valid pointers.
1229
+ /// # Safety
1230
+ ///
1231
+ /// Called from C. Inputs must be valid pointers.
1204
1232
extern "C" fn fast_switch_callback (
1205
1233
ptr : * mut bindings:: cpufreq_policy ,
1206
1234
target_freq : u32 ,
@@ -1225,7 +1253,9 @@ impl<T: Driver> Registration<T> {
1225
1253
1226
1254
/// Driver's `get_intermediate` callback.
1227
1255
///
1228
- /// SAFETY: Called from C. Inputs must be valid pointers.
1256
+ /// # Safety
1257
+ ///
1258
+ /// Called from C. Inputs must be valid pointers.
1229
1259
extern "C" fn get_intermediate_callback (
1230
1260
ptr : * mut bindings:: cpufreq_policy ,
1231
1261
index : u32 ,
@@ -1243,7 +1273,9 @@ impl<T: Driver> Registration<T> {
1243
1273
1244
1274
/// Driver's `target_intermediate` callback.
1245
1275
///
1246
- /// SAFETY: Called from C. Inputs must be valid pointers.
1276
+ /// # Safety
1277
+ ///
1278
+ /// Called from C. Inputs must be valid pointers.
1247
1279
extern "C" fn target_intermediate_callback (
1248
1280
ptr : * mut bindings:: cpufreq_policy ,
1249
1281
index : u32 ,
@@ -1276,7 +1308,9 @@ impl<T: Driver> Registration<T> {
1276
1308
1277
1309
/// Driver's `bios_limit` callback.
1278
1310
///
1279
- /// SAFETY: Called from C. Inputs must be valid pointers.
1311
+ /// # Safety
1312
+ ///
1313
+ /// Called from C. Inputs must be valid pointers.
1280
1314
extern "C" fn bios_limit_callback ( cpu : i32 , limit : * mut u32 ) -> kernel:: ffi:: c_int {
1281
1315
from_result ( || {
1282
1316
let mut policy = PolicyCpu :: from_cpu ( cpu as u32 ) ?;
@@ -1288,7 +1322,9 @@ impl<T: Driver> Registration<T> {
1288
1322
1289
1323
/// Driver's `set_boost` callback.
1290
1324
///
1291
- /// SAFETY: Called from C. Inputs must be valid pointers.
1325
+ /// # Safety
1326
+ ///
1327
+ /// Called from C. Inputs must be valid pointers.
1292
1328
extern "C" fn set_boost_callback (
1293
1329
ptr : * mut bindings:: cpufreq_policy ,
1294
1330
state : i32 ,
@@ -1303,7 +1339,9 @@ impl<T: Driver> Registration<T> {
1303
1339
1304
1340
/// Driver's `register_em` callback.
1305
1341
///
1306
- /// SAFETY: Called from C. Inputs must be valid pointers.
1342
+ /// # Safety
1343
+ ///
1344
+ /// Called from C. Inputs must be valid pointers.
1307
1345
extern "C" fn register_em_callback ( ptr : * mut bindings:: cpufreq_policy ) {
1308
1346
// SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
1309
1347
// lifetime of `policy`.
0 commit comments