mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 08:38:45 +02:00 
			
		
		
		
	 1b7bbd5975
			
		
	
	
		1b7bbd5975
		
	
	
	
	
		
			
			Avoid 64-bit integer division that 32-bit architectures don't implement generally. This uses ktime_to_us() and ktime_to_ms() instead. The time abstraction needs i64 / u32 division so C's div_s64() can be used but ktime_to_us() and ktime_to_ms() provide a simpler solution for this time abstraction problem on 32-bit architectures. 32-bit ARM is the only 32-bit architecture currently supported by Rust. Using the cfg attribute, only 32-bit architectures will call ktime_to_us() and ktime_to_ms(), while the other 64-bit architectures will continue to use the current code as-is to avoid the overhead. One downside of calling the C's functions is that the as_micros/millis methods can no longer be const fn. We stick with the simpler approach unless there's a compelling need for a const fn. Suggested-by: Arnd Bergmann <arnd@arndb.de> Suggested-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250502004524.230553-1-fujita.tomonori@gmail.com Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| // SPDX-License-Identifier: GPL-2.0
 | |
| /*
 | |
|  * Non-trivial C macros cannot be used in Rust. Similarly, inlined C functions
 | |
|  * cannot be called either. This file explicitly creates functions ("helpers")
 | |
|  * that wrap those so that they can be called from Rust.
 | |
|  *
 | |
|  * Sorted alphabetically.
 | |
|  */
 | |
| 
 | |
| #include "auxiliary.c"
 | |
| #include "blk.c"
 | |
| #include "bug.c"
 | |
| #include "build_assert.c"
 | |
| #include "build_bug.c"
 | |
| #include "clk.c"
 | |
| #include "cpu.c"
 | |
| #include "cpufreq.c"
 | |
| #include "cpumask.c"
 | |
| #include "cred.c"
 | |
| #include "device.c"
 | |
| #include "dma.c"
 | |
| #include "drm.c"
 | |
| #include "err.c"
 | |
| #include "fs.c"
 | |
| #include "io.c"
 | |
| #include "jump_label.c"
 | |
| #include "kunit.c"
 | |
| #include "mm.c"
 | |
| #include "mutex.c"
 | |
| #include "page.c"
 | |
| #include "platform.c"
 | |
| #include "pci.c"
 | |
| #include "pid_namespace.c"
 | |
| #include "rbtree.c"
 | |
| #include "rcu.c"
 | |
| #include "refcount.c"
 | |
| #include "security.c"
 | |
| #include "signal.c"
 | |
| #include "slab.c"
 | |
| #include "spinlock.c"
 | |
| #include "sync.c"
 | |
| #include "task.c"
 | |
| #include "time.c"
 | |
| #include "uaccess.c"
 | |
| #include "vmalloc.c"
 | |
| #include "wait.c"
 | |
| #include "workqueue.c"
 | |
| #include "xarray.c"
 |