@@ -901,12 +901,16 @@ pub trait Driver {
901901#[ repr( transparent) ]
902902pub struct Registration < T : Driver > ( KBox < UnsafeCell < bindings:: cpufreq_driver > > , PhantomData < T > ) ;
903903
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
905907/// or CPUs, so it is safe to share it.
906908unsafe impl < T : Driver > Sync for Registration < T > { }
907909
908910#[ 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
910914/// thread.
911915unsafe impl < T : Driver > Send for Registration < T > { }
912916
@@ -1055,7 +1059,9 @@ impl<T: Driver> Registration<T> {
10551059impl < T : Driver > Registration < T > {
10561060 /// Driver's `init` callback.
10571061 ///
1058- /// SAFETY: Called from C. Inputs must be valid pointers.
1062+ /// # Safety
1063+ ///
1064+ /// Called from C. Inputs must be valid pointers.
10591065 extern "C" fn init_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
10601066 from_result ( || {
10611067 // 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> {
10701076
10711077 /// Driver's `exit` callback.
10721078 ///
1073- /// SAFETY: Called from C. Inputs must be valid pointers.
1079+ /// # Safety
1080+ ///
1081+ /// Called from C. Inputs must be valid pointers.
10741082 extern "C" fn exit_callback ( ptr : * mut bindings:: cpufreq_policy ) {
10751083 // SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
10761084 // lifetime of `policy`.
@@ -1082,7 +1090,9 @@ impl<T: Driver> Registration<T> {
10821090
10831091 /// Driver's `online` callback.
10841092 ///
1085- /// SAFETY: Called from C. Inputs must be valid pointers.
1093+ /// # Safety
1094+ ///
1095+ /// Called from C. Inputs must be valid pointers.
10861096 extern "C" fn online_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
10871097 from_result ( || {
10881098 // 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> {
10941104
10951105 /// Driver's `offline` callback.
10961106 ///
1097- /// SAFETY: Called from C. Inputs must be valid pointers.
1107+ /// # Safety
1108+ ///
1109+ /// Called from C. Inputs must be valid pointers.
10981110 extern "C" fn offline_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
10991111 from_result ( || {
11001112 // 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> {
11061118
11071119 /// Driver's `suspend` callback.
11081120 ///
1109- /// SAFETY: Called from C. Inputs must be valid pointers.
1121+ /// # Safety
1122+ ///
1123+ /// Called from C. Inputs must be valid pointers.
11101124 extern "C" fn suspend_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
11111125 from_result ( || {
11121126 // 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> {
11181132
11191133 /// Driver's `resume` callback.
11201134 ///
1121- /// SAFETY: Called from C. Inputs must be valid pointers.
1135+ /// # Safety
1136+ ///
1137+ /// Called from C. Inputs must be valid pointers.
11221138 extern "C" fn resume_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
11231139 from_result ( || {
11241140 // 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> {
11301146
11311147 /// Driver's `ready` callback.
11321148 ///
1133- /// SAFETY: Called from C. Inputs must be valid pointers.
1149+ /// # Safety
1150+ ///
1151+ /// Called from C. Inputs must be valid pointers.
11341152 extern "C" fn ready_callback ( ptr : * mut bindings:: cpufreq_policy ) {
11351153 // SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
11361154 // lifetime of `policy`.
@@ -1140,7 +1158,9 @@ impl<T: Driver> Registration<T> {
11401158
11411159 /// Driver's `verify` callback.
11421160 ///
1143- /// SAFETY: Called from C. Inputs must be valid pointers.
1161+ /// # Safety
1162+ ///
1163+ /// Called from C. Inputs must be valid pointers.
11441164 extern "C" fn verify_callback ( ptr : * mut bindings:: cpufreq_policy_data ) -> kernel:: ffi:: c_int {
11451165 from_result ( || {
11461166 // 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> {
11521172
11531173 /// Driver's `setpolicy` callback.
11541174 ///
1155- /// SAFETY: Called from C. Inputs must be valid pointers.
1175+ /// # Safety
1176+ ///
1177+ /// Called from C. Inputs must be valid pointers.
11561178 extern "C" fn setpolicy_callback ( ptr : * mut bindings:: cpufreq_policy ) -> kernel:: ffi:: c_int {
11571179 from_result ( || {
11581180 // 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> {
11641186
11651187 /// Driver's `target` callback.
11661188 ///
1167- /// SAFETY: Called from C. Inputs must be valid pointers.
1189+ /// # Safety
1190+ ///
1191+ /// Called from C. Inputs must be valid pointers.
11681192 extern "C" fn target_callback (
11691193 ptr : * mut bindings:: cpufreq_policy ,
11701194 target_freq : u32 ,
@@ -1180,7 +1204,9 @@ impl<T: Driver> Registration<T> {
11801204
11811205 /// Driver's `target_index` callback.
11821206 ///
1183- /// SAFETY: Called from C. Inputs must be valid pointers.
1207+ /// # Safety
1208+ ///
1209+ /// Called from C. Inputs must be valid pointers.
11841210 extern "C" fn target_index_callback (
11851211 ptr : * mut bindings:: cpufreq_policy ,
11861212 index : u32 ,
@@ -1200,7 +1226,9 @@ impl<T: Driver> Registration<T> {
12001226
12011227 /// Driver's `fast_switch` callback.
12021228 ///
1203- /// SAFETY: Called from C. Inputs must be valid pointers.
1229+ /// # Safety
1230+ ///
1231+ /// Called from C. Inputs must be valid pointers.
12041232 extern "C" fn fast_switch_callback (
12051233 ptr : * mut bindings:: cpufreq_policy ,
12061234 target_freq : u32 ,
@@ -1225,7 +1253,9 @@ impl<T: Driver> Registration<T> {
12251253
12261254 /// Driver's `get_intermediate` callback.
12271255 ///
1228- /// SAFETY: Called from C. Inputs must be valid pointers.
1256+ /// # Safety
1257+ ///
1258+ /// Called from C. Inputs must be valid pointers.
12291259 extern "C" fn get_intermediate_callback (
12301260 ptr : * mut bindings:: cpufreq_policy ,
12311261 index : u32 ,
@@ -1243,7 +1273,9 @@ impl<T: Driver> Registration<T> {
12431273
12441274 /// Driver's `target_intermediate` callback.
12451275 ///
1246- /// SAFETY: Called from C. Inputs must be valid pointers.
1276+ /// # Safety
1277+ ///
1278+ /// Called from C. Inputs must be valid pointers.
12471279 extern "C" fn target_intermediate_callback (
12481280 ptr : * mut bindings:: cpufreq_policy ,
12491281 index : u32 ,
@@ -1276,7 +1308,9 @@ impl<T: Driver> Registration<T> {
12761308
12771309 /// Driver's `bios_limit` callback.
12781310 ///
1279- /// SAFETY: Called from C. Inputs must be valid pointers.
1311+ /// # Safety
1312+ ///
1313+ /// Called from C. Inputs must be valid pointers.
12801314 extern "C" fn bios_limit_callback ( cpu : i32 , limit : * mut u32 ) -> kernel:: ffi:: c_int {
12811315 from_result ( || {
12821316 let mut policy = PolicyCpu :: from_cpu ( cpu as u32 ) ?;
@@ -1288,7 +1322,9 @@ impl<T: Driver> Registration<T> {
12881322
12891323 /// Driver's `set_boost` callback.
12901324 ///
1291- /// SAFETY: Called from C. Inputs must be valid pointers.
1325+ /// # Safety
1326+ ///
1327+ /// Called from C. Inputs must be valid pointers.
12921328 extern "C" fn set_boost_callback (
12931329 ptr : * mut bindings:: cpufreq_policy ,
12941330 state : i32 ,
@@ -1303,7 +1339,9 @@ impl<T: Driver> Registration<T> {
13031339
13041340 /// Driver's `register_em` callback.
13051341 ///
1306- /// SAFETY: Called from C. Inputs must be valid pointers.
1342+ /// # Safety
1343+ ///
1344+ /// Called from C. Inputs must be valid pointers.
13071345 extern "C" fn register_em_callback ( ptr : * mut bindings:: cpufreq_policy ) {
13081346 // SAFETY: The `ptr` is guaranteed to be valid by the contract with the C code for the
13091347 // lifetime of `policy`.
0 commit comments