Lines Matching +full:render +full:- +full:max
1 // SPDX-License-Identifier: GPL-2.0
3 // Register cache access API - maple tree based cache
19 struct maple_tree *mt = map->cache; in regcache_maple_read()
28 return -ENOENT; in regcache_maple_read()
31 *value = entry[reg - mas.index]; in regcache_maple_read()
41 struct maple_tree *mt = map->cache; in regcache_maple_write()
52 entry[reg - mas.index] = val; in regcache_maple_write()
58 mas_set_range(&mas, reg - 1, reg + 1); in regcache_maple_write()
62 lower = mas_find(&mas, reg - 1); in regcache_maple_write()
65 lower_sz = (mas.last - mas.index + 1) * sizeof(unsigned long); in regcache_maple_write()
71 upper_sz = (mas.last - mas.index + 1) * sizeof(unsigned long); in regcache_maple_write()
76 entry = kmalloc((last - index + 1) * sizeof(unsigned long), in regcache_maple_write()
77 map->alloc_flags); in regcache_maple_write()
79 return -ENOMEM; in regcache_maple_write()
83 entry[reg - index] = val; in regcache_maple_write()
85 memcpy(&entry[reg - index + 1], upper, upper_sz); in regcache_maple_write()
95 ret = mas_store_gfp(&mas, entry, map->alloc_flags); in regcache_maple_write()
108 unsigned int max) in regcache_maple_drop() argument
110 struct maple_tree *mt = map->cache; in regcache_maple_drop()
111 MA_STATE(mas, mt, min, max); in regcache_maple_drop()
122 mas_for_each(&mas, entry, max) { in regcache_maple_drop()
133 lower_last = min -1; in regcache_maple_drop()
135 lower = kmemdup(entry, ((min - mas.index) * in regcache_maple_drop()
137 map->alloc_flags); in regcache_maple_drop()
139 ret = -ENOMEM; in regcache_maple_drop()
144 if (mas.last > max) { in regcache_maple_drop()
145 upper_index = max + 1; in regcache_maple_drop()
148 upper = kmemdup(&entry[max + 1], in regcache_maple_drop()
149 ((mas.last - max) * in regcache_maple_drop()
151 map->alloc_flags); in regcache_maple_drop()
153 ret = -ENOMEM; in regcache_maple_drop()
165 ret = mas_store_gfp(&mas, lower, map->alloc_flags); in regcache_maple_drop()
173 ret = mas_store_gfp(&mas, upper, map->alloc_flags); in regcache_maple_drop()
191 unsigned int min, unsigned int max) in regcache_maple_sync_block() argument
195 size_t val_bytes = map->format.val_bytes; in regcache_maple_sync_block()
206 if (max - min > 1 && regmap_can_raw_write(map)) { in regcache_maple_sync_block()
207 buf = kmalloc(val_bytes * (max - min), map->alloc_flags); in regcache_maple_sync_block()
209 ret = -ENOMEM; in regcache_maple_sync_block()
213 /* Render the data for a raw write */ in regcache_maple_sync_block()
214 for (r = min; r < max; r++) { in regcache_maple_sync_block()
215 regcache_set_val(map, buf, r - min, in regcache_maple_sync_block()
216 entry[r - mas->index]); in regcache_maple_sync_block()
219 ret = _regmap_raw_write(map, min, buf, (max - min) * val_bytes, in regcache_maple_sync_block()
224 for (r = min; r < max; r++) { in regcache_maple_sync_block()
226 entry[r - mas->index]); in regcache_maple_sync_block()
239 unsigned int max) in regcache_maple_sync() argument
241 struct maple_tree *mt = map->cache; in regcache_maple_sync()
243 MA_STATE(mas, mt, min, max); in regcache_maple_sync()
245 unsigned long lmax = max; in regcache_maple_sync()
250 map->cache_bypass = true; in regcache_maple_sync()
254 mas_for_each(&mas, entry, max) { in regcache_maple_sync()
255 for (r = max(mas.index, lmin); r <= min(mas.last, lmax); r++) { in regcache_maple_sync()
256 v = entry[r - mas.index]; in regcache_maple_sync()
288 map->cache_bypass = false; in regcache_maple_sync()
295 struct maple_tree *mt = map->cache; in regcache_maple_exit()
310 map->cache = NULL; in regcache_maple_exit()
318 struct maple_tree *mt = map->cache; in regcache_maple_insert_block()
323 entry = kcalloc(last - first + 1, sizeof(unsigned long), map->alloc_flags); in regcache_maple_insert_block()
325 return -ENOMEM; in regcache_maple_insert_block()
327 for (i = 0; i < last - first + 1; i++) in regcache_maple_insert_block()
328 entry[i] = map->reg_defaults[first + i].def; in regcache_maple_insert_block()
332 mas_set_range(&mas, map->reg_defaults[first].reg, in regcache_maple_insert_block()
333 map->reg_defaults[last].reg); in regcache_maple_insert_block()
334 ret = mas_store_gfp(&mas, entry, map->alloc_flags); in regcache_maple_insert_block()
353 return -ENOMEM; in regcache_maple_init()
354 map->cache = mt; in regcache_maple_init()
358 if (!map->num_reg_defaults) in regcache_maple_init()
364 for (i = 1; i < map->num_reg_defaults; i++) { in regcache_maple_init()
365 if (map->reg_defaults[i].reg != in regcache_maple_init()
366 map->reg_defaults[i - 1].reg + 1) { in regcache_maple_init()
368 i - 1); in regcache_maple_init()
378 map->num_reg_defaults - 1); in regcache_maple_init()