Lines Matching refs:mp

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