1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * Generic __div64_32 wrapper for __xdiv64_32. 41da177e4SLinus Torvalds */ 51da177e4SLinus Torvalds 61da177e4SLinus Torvalds #include <linux/types.h> 7fa43972fSPaul Mundt #include <asm/div64.h> 81da177e4SLinus Torvalds 9075fc19bSPaul Mundt extern uint64_t __xdiv64_32(u64 n, u32 d); 101da177e4SLinus Torvalds __div64_32(u64 * xp,u32 y)1104c7d957SPaul Mundtuint32_t __div64_32(u64 *xp, u32 y) 121da177e4SLinus Torvalds { 1304c7d957SPaul Mundt uint32_t rem; 14075fc19bSPaul Mundt uint64_t q = __xdiv64_32(*xp, y); 151da177e4SLinus Torvalds 161da177e4SLinus Torvalds rem = *xp - q * y; 171da177e4SLinus Torvalds *xp = q; 181da177e4SLinus Torvalds 191da177e4SLinus Torvalds return rem; 201da177e4SLinus Torvalds } 21