Lines Matching +full:1 +full:- +full:stop
1 // SPDX-License-Identifier: GPL-2.0
46 return (void *)((long)site->addr + (long)&site->addr); in static_call_addr()
51 return (long)site->key + (long)&site->key; in __static_call_key()
59 /* These assume the key is word-aligned. */
72 site->key = (__static_call_key(site) | STATIC_CALL_SITE_INIT) - in static_call_set_init()
73 (long)&site->key; in static_call_set_init()
84 return -1; in static_call_site_cmp()
87 return 1; in static_call_site_cmp()
94 long delta = (unsigned long)_a - (unsigned long)_b; in static_call_site_swap()
99 a->addr = b->addr - delta; in static_call_site_swap()
100 a->key = b->key - delta; in static_call_site_swap()
102 b->addr = tmp.addr + delta; in static_call_site_swap()
103 b->key = tmp.key + delta; in static_call_site_swap()
107 struct static_call_site *stop) in static_call_sort_entries() argument
109 sort(start, stop - start, sizeof(struct static_call_site), in static_call_sort_entries()
115 return !(key->type & 1); in static_call_key_has_mods()
123 return key->mods; in static_call_key_next()
131 return (struct static_call_site *)(key->type & ~1); in static_call_key_sites()
136 struct static_call_site *site, *stop; in __static_call_update() local
142 if (key->func == func) in __static_call_update()
145 key->func = func; in __static_call_update()
162 for (site_mod = &first; site_mod; site_mod = site_mod->next) { in __static_call_update()
164 struct module *mod = site_mod->mod; in __static_call_update()
166 if (!site_mod->sites) { in __static_call_update()
177 stop = __stop_static_call_sites; in __static_call_update()
181 stop = mod->static_call_sites + in __static_call_update()
182 mod->num_static_call_sites; in __static_call_update()
183 init = mod->state == MODULE_STATE_COMING; in __static_call_update()
187 for (site = site_mod->sites; in __static_call_update()
188 site < stop && static_call_key(site) == key; site++) { in __static_call_update()
196 * This skips patching built-in __exit, which in __static_call_update()
200 * Skipping built-in __exit is fine since it in __static_call_update()
222 struct static_call_site *stop) in __static_call_init() argument
228 if (start == stop) in __static_call_init()
231 static_call_sort_entries(start, stop); in __static_call_init()
233 for (site = start; site < stop; site++) { in __static_call_init()
237 (!mod && init_section_contains(site_addr, 1))) in __static_call_init()
253 key->sites = site; in __static_call_init()
254 key->type |= 1; in __static_call_init()
260 return -ENOMEM; in __static_call_init()
268 site_mod->mod = NULL; in __static_call_init()
269 site_mod->next = NULL; in __static_call_init()
270 site_mod->sites = static_call_key_sites(key); in __static_call_init()
272 key->mods = site_mod; in __static_call_init()
276 return -ENOMEM; in __static_call_init()
279 site_mod->mod = mod; in __static_call_init()
280 site_mod->sites = site; in __static_call_init()
281 site_mod->next = static_call_key_next(key); in __static_call_init()
282 key->mods = site_mod; in __static_call_init()
286 arch_static_call_transform(site_addr, NULL, key->func, in __static_call_init()
299 return 1; in addr_conflict()
313 return 1; in __static_call_text_reserved()
338 ret = __static_call_text_reserved(mod->static_call_sites, in __static_call_mod_text_reserved()
339 mod->static_call_sites + mod->num_static_call_sites, in __static_call_mod_text_reserved()
340 start, end, mod->state == MODULE_STATE_COMING); in __static_call_mod_text_reserved()
350 struct static_call_tramp_key *stop = __stop_static_call_tramp_key; in tramp_key_lookup() local
353 for (tramp_key = start; tramp_key != stop; tramp_key++) { in tramp_key_lookup()
356 tramp = (long)tramp_key->tramp + (long)&tramp_key->tramp; in tramp_key_lookup()
358 return (long)tramp_key->key + (long)&tramp_key->key; in tramp_key_lookup()
366 struct static_call_site *start = mod->static_call_sites; in static_call_add_module()
367 struct static_call_site *stop = start + mod->num_static_call_sites; in static_call_add_module() local
370 for (site = start; site != stop; site++) { in static_call_add_module()
393 return -EINVAL; in static_call_add_module()
397 site->key = key - (long)&site->key; in static_call_add_module()
400 return __static_call_init(mod, start, stop); in static_call_add_module()
405 struct static_call_site *start = mod->static_call_sites; in static_call_del_module()
406 struct static_call_site *stop = mod->static_call_sites + in static_call_del_module() local
407 mod->num_static_call_sites; in static_call_del_module()
412 for (site = start; site < stop; site++) { in static_call_del_module()
420 * not been touched either, so stop iterating. in static_call_del_module()
430 for (prev = &key->mods, site_mod = key->mods; in static_call_del_module()
431 site_mod && site_mod->mod != mod; in static_call_del_module()
432 prev = &site_mod->next, site_mod = site_mod->next) in static_call_del_module()
438 *prev = site_mod->next; in static_call_del_module()
501 if (static_call_initialized == 1) in static_call_init()
521 static_call_initialized = 1; in static_call_init()
530 return x+1; in func_a()
557 if (scd->func) in test_static_call_init()
558 static_call_update(sc_selftest, scd->func); in test_static_call_init()
560 WARN_ON(static_call(sc_selftest)(scd->val) != scd->expect); in test_static_call_init()