Lines Matching +full:data +full:- +full:active
1 // SPDX-License-Identifier: GPL-2.0
25 struct stm_source_data data; member
27 unsigned int active; member
37 stm_source_write(&heartbeat->data, 0, str, sizeof str); in stm_heartbeat_hrtimer_handler()
38 if (heartbeat->active) in stm_heartbeat_hrtimer_handler()
41 return heartbeat->active ? HRTIMER_RESTART : HRTIMER_NORESTART; in stm_heartbeat_hrtimer_handler()
44 static int stm_heartbeat_link(struct stm_source_data *data) in stm_heartbeat_link() argument
47 container_of(data, struct stm_heartbeat, data); in stm_heartbeat_link()
49 heartbeat->active = 1; in stm_heartbeat_link()
50 hrtimer_start(&heartbeat->hrtimer, ms_to_ktime(interval_ms), in stm_heartbeat_link()
56 static void stm_heartbeat_unlink(struct stm_source_data *data) in stm_heartbeat_unlink() argument
59 container_of(data, struct stm_heartbeat, data); in stm_heartbeat_unlink()
61 heartbeat->active = 0; in stm_heartbeat_unlink()
62 hrtimer_cancel(&heartbeat->hrtimer); in stm_heartbeat_unlink()
70 return -EINVAL; in stm_heartbeat_init()
73 stm_heartbeat[i].data.name = in stm_heartbeat_init()
75 if (!stm_heartbeat[i].data.name) { in stm_heartbeat_init()
76 ret = -ENOMEM; in stm_heartbeat_init()
80 stm_heartbeat[i].data.nr_chans = 1; in stm_heartbeat_init()
81 stm_heartbeat[i].data.type = STM_USER; in stm_heartbeat_init()
82 stm_heartbeat[i].data.link = stm_heartbeat_link; in stm_heartbeat_init()
83 stm_heartbeat[i].data.unlink = stm_heartbeat_unlink; in stm_heartbeat_init()
89 ret = stm_source_register_device(NULL, &stm_heartbeat[i].data); in stm_heartbeat_init()
97 for (i--; i >= 0; i--) { in stm_heartbeat_init()
98 stm_source_unregister_device(&stm_heartbeat[i].data); in stm_heartbeat_init()
100 kfree(stm_heartbeat[i].data.name); in stm_heartbeat_init()
111 stm_source_unregister_device(&stm_heartbeat[i].data); in stm_heartbeat_exit()
112 kfree(stm_heartbeat[i].data.name); in stm_heartbeat_exit()