@@ -35,27 +35,30 @@ static inline void *static_call_addr(struct static_call_site *site)
35
35
return (void * )((long )site -> addr + (long )& site -> addr );
36
36
}
37
37
38
+ static inline unsigned long __static_call_key (const struct static_call_site * site )
39
+ {
40
+ return (long )site -> key + (long )& site -> key ;
41
+ }
38
42
39
43
static inline struct static_call_key * static_call_key (const struct static_call_site * site )
40
44
{
41
- return (struct static_call_key * )
42
- (((long )site -> key + (long )& site -> key ) & ~STATIC_CALL_SITE_FLAGS );
45
+ return (void * )(__static_call_key (site ) & ~STATIC_CALL_SITE_FLAGS );
43
46
}
44
47
45
48
/* These assume the key is word-aligned. */
46
49
static inline bool static_call_is_init (struct static_call_site * site )
47
50
{
48
- return (( long ) site -> key + ( long ) & site -> key ) & STATIC_CALL_SITE_INIT ;
51
+ return __static_call_key ( site ) & STATIC_CALL_SITE_INIT ;
49
52
}
50
53
51
54
static inline bool static_call_is_tail (struct static_call_site * site )
52
55
{
53
- return (( long ) site -> key + ( long ) & site -> key ) & STATIC_CALL_SITE_TAIL ;
56
+ return __static_call_key ( site ) & STATIC_CALL_SITE_TAIL ;
54
57
}
55
58
56
59
static inline void static_call_set_init (struct static_call_site * site )
57
60
{
58
- site -> key = (( long ) static_call_key (site ) | STATIC_CALL_SITE_INIT ) -
61
+ site -> key = (__static_call_key (site ) | STATIC_CALL_SITE_INIT ) -
59
62
(long )& site -> key ;
60
63
}
61
64
@@ -190,7 +193,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func)
190
193
}
191
194
192
195
arch_static_call_transform (site_addr , NULL , func ,
193
- static_call_is_tail (site ));
196
+ static_call_is_tail (site ));
194
197
}
195
198
}
196
199
@@ -349,7 +352,7 @@ static int static_call_add_module(struct module *mod)
349
352
struct static_call_site * site ;
350
353
351
354
for (site = start ; site != stop ; site ++ ) {
352
- unsigned long s_key = ( long ) site -> key + ( long ) & site -> key ;
355
+ unsigned long s_key = __static_call_key ( site ) ;
353
356
unsigned long addr = s_key & ~STATIC_CALL_SITE_FLAGS ;
354
357
unsigned long key ;
355
358
0 commit comments