Lines Matching refs:mp

30 static void pvr2_context_set_notify(struct pvr2_context *mp, int fl)  in pvr2_context_set_notify()  argument
35 if (!mp->notify_flag) { in pvr2_context_set_notify()
37 mp->notify_prev = pvr2_context_notify_last; in pvr2_context_set_notify()
38 mp->notify_next = NULL; in pvr2_context_set_notify()
39 pvr2_context_notify_last = mp; in pvr2_context_set_notify()
40 if (mp->notify_prev) { in pvr2_context_set_notify()
41 mp->notify_prev->notify_next = mp; in pvr2_context_set_notify()
43 pvr2_context_notify_first = mp; in pvr2_context_set_notify()
45 mp->notify_flag = !0; in pvr2_context_set_notify()
48 if (mp->notify_flag) { in pvr2_context_set_notify()
49 mp->notify_flag = 0; in pvr2_context_set_notify()
50 if (mp->notify_next) { in pvr2_context_set_notify()
51 mp->notify_next->notify_prev = mp->notify_prev; in pvr2_context_set_notify()
53 pvr2_context_notify_last = mp->notify_prev; in pvr2_context_set_notify()
55 if (mp->notify_prev) { in pvr2_context_set_notify()
56 mp->notify_prev->notify_next = mp->notify_next; in pvr2_context_set_notify()
58 pvr2_context_notify_first = mp->notify_next; in pvr2_context_set_notify()
67 static void pvr2_context_destroy(struct pvr2_context *mp) in pvr2_context_destroy() argument
69 pvr2_trace(PVR2_TRACE_CTXT,"pvr2_context %p (destroy)",mp); in pvr2_context_destroy()
70 pvr2_hdw_destroy(mp->hdw); in pvr2_context_destroy()
71 pvr2_context_set_notify(mp, 0); in pvr2_context_destroy()
73 if (mp->exist_next) { in pvr2_context_destroy()
74 mp->exist_next->exist_prev = mp->exist_prev; in pvr2_context_destroy()
76 pvr2_context_exist_last = mp->exist_prev; in pvr2_context_destroy()
78 if (mp->exist_prev) { in pvr2_context_destroy()
79 mp->exist_prev->exist_next = mp->exist_next; in pvr2_context_destroy()
81 pvr2_context_exist_first = mp->exist_next; in pvr2_context_destroy()
89 kfree(mp); in pvr2_context_destroy()
95 struct pvr2_context *mp = ptr; in pvr2_context_notify() local
97 pvr2_context_set_notify(mp,!0); in pvr2_context_notify()
101 static void pvr2_context_check(struct pvr2_context *mp) in pvr2_context_check() argument
105 "pvr2_context %p (notify)", mp); in pvr2_context_check()
106 if (!mp->initialized_flag && !mp->disconnect_flag) { in pvr2_context_check()
107 mp->initialized_flag = !0; in pvr2_context_check()
109 "pvr2_context %p (initialize)", mp); in pvr2_context_check()
111 if (pvr2_hdw_initialize(mp->hdw, pvr2_context_notify, mp)) { in pvr2_context_check()
112 mp->video_stream.stream = in pvr2_context_check()
113 pvr2_hdw_get_video_stream(mp->hdw); in pvr2_context_check()
117 if (mp->setup_func) mp->setup_func(mp); in pvr2_context_check()
121 mp); in pvr2_context_check()
130 for (ch1 = mp->mc_first; ch1; ch1 = ch2) { in pvr2_context_check()
135 if (mp->disconnect_flag && !mp->mc_first) { in pvr2_context_check()
137 pvr2_context_destroy(mp); in pvr2_context_check()
151 struct pvr2_context *mp; in pvr2_context_thread_func() local
156 while ((mp = pvr2_context_notify_first) != NULL) { in pvr2_context_thread_func()
157 pvr2_context_set_notify(mp, 0); in pvr2_context_thread_func()
158 pvr2_context_check(mp); in pvr2_context_thread_func()
206 struct pvr2_context *mp = NULL; in pvr2_context_create() local
207 mp = kzalloc(sizeof(*mp),GFP_KERNEL); in pvr2_context_create()
208 if (!mp) goto done; in pvr2_context_create()
209 pvr2_trace(PVR2_TRACE_CTXT,"pvr2_context %p (create)",mp); in pvr2_context_create()
210 mp->setup_func = setup_func; in pvr2_context_create()
211 mutex_init(&mp->mutex); in pvr2_context_create()
213 mp->exist_prev = pvr2_context_exist_last; in pvr2_context_create()
214 mp->exist_next = NULL; in pvr2_context_create()
215 pvr2_context_exist_last = mp; in pvr2_context_create()
216 if (mp->exist_prev) { in pvr2_context_create()
217 mp->exist_prev->exist_next = mp; in pvr2_context_create()
219 pvr2_context_exist_first = mp; in pvr2_context_create()
222 mp->hdw = pvr2_hdw_create(intf,devid); in pvr2_context_create()
223 if (!mp->hdw) { in pvr2_context_create()
224 pvr2_context_destroy(mp); in pvr2_context_create()
225 mp = NULL; in pvr2_context_create()
228 pvr2_context_set_notify(mp, !0); in pvr2_context_create()
230 return mp; in pvr2_context_create()
234 static void pvr2_context_reset_input_limits(struct pvr2_context *mp) in pvr2_context_reset_input_limits() argument
238 struct pvr2_hdw *hdw = mp->hdw; in pvr2_context_reset_input_limits()
241 for (cp = mp->mc_first; cp; cp = cp->mc_next) { in pvr2_context_reset_input_limits()
250 static void pvr2_context_enter(struct pvr2_context *mp) in pvr2_context_enter() argument
252 mutex_lock(&mp->mutex); in pvr2_context_enter()
256 static void pvr2_context_exit(struct pvr2_context *mp) in pvr2_context_exit() argument
259 if (!(mp->mc_first || !mp->disconnect_flag)) { in pvr2_context_exit()
262 mutex_unlock(&mp->mutex); in pvr2_context_exit()
263 if (destroy_flag) pvr2_context_notify(mp); in pvr2_context_exit()
267 void pvr2_context_disconnect(struct pvr2_context *mp) in pvr2_context_disconnect() argument
269 pvr2_hdw_disconnect(mp->hdw); in pvr2_context_disconnect()
271 pvr2_context_notify(mp); in pvr2_context_disconnect()
272 mp->disconnect_flag = !0; in pvr2_context_disconnect()
276 void pvr2_channel_init(struct pvr2_channel *cp,struct pvr2_context *mp) in pvr2_channel_init() argument
278 pvr2_context_enter(mp); in pvr2_channel_init()
279 cp->hdw = mp->hdw; in pvr2_channel_init()
280 cp->mc_head = mp; in pvr2_channel_init()
282 cp->mc_prev = mp->mc_last; in pvr2_channel_init()
283 if (mp->mc_last) { in pvr2_channel_init()
284 mp->mc_last->mc_next = cp; in pvr2_channel_init()
286 mp->mc_first = cp; in pvr2_channel_init()
288 mp->mc_last = cp; in pvr2_channel_init()
289 pvr2_context_exit(mp); in pvr2_channel_init()
304 struct pvr2_context *mp = cp->mc_head; in pvr2_channel_done() local
305 pvr2_context_enter(mp); in pvr2_channel_done()
308 pvr2_context_reset_input_limits(mp); in pvr2_channel_done()
312 mp->mc_last = cp->mc_prev; in pvr2_channel_done()
317 mp->mc_first = cp->mc_next; in pvr2_channel_done()
320 pvr2_context_exit(mp); in pvr2_channel_done()