static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color,
enum drm_mm_search_flags flags);
static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color,
u64 start,
u64 end,
static void drm_mm_insert_helper(struct drm_mm_node *hole_node,
struct drm_mm_node *node,
- u64 size, unsigned alignment,
+ u64 size, u64 alignment,
unsigned long color,
enum drm_mm_allocator_flags flags)
{
adj_start = adj_end - size;
if (alignment) {
- u64 tmp = adj_start;
- unsigned rem;
+ u64 rem;
- rem = do_div(tmp, alignment);
+ div64_u64_rem(adj_start, alignment, &rem);
if (rem) {
if (flags & DRM_MM_CREATE_TOP)
adj_start -= rem;
* 0 on success, -ENOSPC if there's no suitable hole.
*/
int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node,
- u64 size, unsigned alignment,
+ u64 size, u64 alignment,
unsigned long color,
enum drm_mm_search_flags sflags,
enum drm_mm_allocator_flags aflags)
static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
struct drm_mm_node *node,
- u64 size, unsigned alignment,
+ u64 size, u64 alignment,
unsigned long color,
u64 start, u64 end,
enum drm_mm_allocator_flags flags)
adj_start = adj_end - size;
if (alignment) {
- u64 tmp = adj_start;
- unsigned rem;
+ u64 rem;
- rem = do_div(tmp, alignment);
+ div64_u64_rem(adj_start, alignment, &rem);
if (rem) {
if (flags & DRM_MM_CREATE_TOP)
adj_start -= rem;
* 0 on success, -ENOSPC if there's no suitable hole.
*/
int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node,
- u64 size, unsigned alignment,
+ u64 size, u64 alignment,
unsigned long color,
u64 start, u64 end,
enum drm_mm_search_flags sflags,
}
EXPORT_SYMBOL(drm_mm_remove_node);
-static int check_free_hole(u64 start, u64 end, u64 size, unsigned alignment)
+static int check_free_hole(u64 start, u64 end, u64 size, u64 alignment)
{
if (end - start < size)
return 0;
if (alignment) {
- u64 tmp = start;
- unsigned rem;
+ u64 rem;
- rem = do_div(tmp, alignment);
+ div64_u64_rem(start, alignment, &rem);
if (rem)
start += alignment - rem;
}
static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color,
enum drm_mm_search_flags flags)
{
static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color,
u64 start,
u64 end,
*/
void drm_mm_init_scan(struct drm_mm *mm,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color)
{
mm->scan_color = color;
*/
void drm_mm_init_scan_with_range(struct drm_mm *mm,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color,
u64 start,
u64 end)
static void show_scan(const struct drm_mm *scan)
{
- pr_info("scan: hit [%llx, %llx], size=%lld, align=%d, color=%ld\n",
+ pr_info("scan: hit [%llx, %llx], size=%lld, align=%lld, color=%ld\n",
scan->scan_hit_start, scan->scan_hit_end,
scan->scan_size, scan->scan_alignment, scan->scan_color);
}
list_del(&e->link);
}
if (list_empty(evict_list)) {
- pr_err("Failed to find eviction: size=%lld [avail=%d], align=%d (color=%lu)\n",
+ pr_err("Failed to find eviction: size=%lld [avail=%d], align=%lld (color=%lu)\n",
mm->scan_size, count,
mm->scan_alignment,
mm->scan_color);
struct rb_root interval_tree;
unsigned int scan_check_range : 1;
- unsigned scan_alignment;
+ unsigned int scanned_blocks;
unsigned long scan_color;
+ u64 scan_alignment;
u64 scan_size;
u64 scan_hit_start;
u64 scan_hit_end;
- unsigned scanned_blocks;
u64 scan_start;
u64 scan_end;
struct drm_mm_node *prev_scanned_node;
int drm_mm_insert_node_generic(struct drm_mm *mm,
struct drm_mm_node *node,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color,
enum drm_mm_search_flags sflags,
enum drm_mm_allocator_flags aflags);
static inline int drm_mm_insert_node(struct drm_mm *mm,
struct drm_mm_node *node,
u64 size,
- unsigned alignment,
+ u64 alignment,
enum drm_mm_search_flags flags)
{
return drm_mm_insert_node_generic(mm, node, size, alignment, 0, flags,
int drm_mm_insert_node_in_range_generic(struct drm_mm *mm,
struct drm_mm_node *node,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color,
u64 start,
u64 end,
static inline int drm_mm_insert_node_in_range(struct drm_mm *mm,
struct drm_mm_node *node,
u64 size,
- unsigned alignment,
+ u64 alignment,
u64 start,
u64 end,
enum drm_mm_search_flags flags)
void drm_mm_init_scan(struct drm_mm *mm,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color);
void drm_mm_init_scan_with_range(struct drm_mm *mm,
u64 size,
- unsigned alignment,
+ u64 alignment,
unsigned long color,
u64 start,
u64 end);