aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDarron Broad <darron@kewl.org>2008-10-21 10:28:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-21 12:32:08 -0400
commit878595f6e7225c996523965b61ce3fe29addca9d (patch)
treeca45e688480b5a32c060897a10e6bc6ae1a6ed62 /drivers/media
parent0fcd488d8d90d2332f9ff463929ec4b7676102b6 (diff)
V4L/DVB (9335): videobuf: split unregister bus creating self-contained frontend de-allocator
This creates a self contained frontend de-allocator for the instances where an adapter has not been registered yet frontend de-allocation may be required. Signed-off-by: Darron Broad <darron@kewl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/videobuf-dvb.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/drivers/media/video/videobuf-dvb.c b/drivers/media/video/videobuf-dvb.c
index 917277d36605..0e7dcba8e4ae 100644
--- a/drivers/media/video/videobuf-dvb.c
+++ b/drivers/media/video/videobuf-dvb.c
@@ -296,29 +296,7 @@ EXPORT_SYMBOL(videobuf_dvb_register_bus);
296 296
297void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) 297void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f)
298{ 298{
299 struct list_head *list, *q; 299 videobuf_dvb_dealloc_frontends(f);
300 struct videobuf_dvb_frontend *fe;
301
302 mutex_lock(&f->lock);
303 list_for_each_safe(list, q, &f->felist) {
304 fe = list_entry(list, struct videobuf_dvb_frontend, felist);
305 if (fe->dvb.net.dvbdev) {
306 dvb_net_release(&fe->dvb.net);
307 fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx,
308 &fe->dvb.fe_mem);
309 fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx,
310 &fe->dvb.fe_hw);
311 dvb_dmxdev_release(&fe->dvb.dmxdev);
312 dvb_dmx_release(&fe->dvb.demux);
313 dvb_unregister_frontend(fe->dvb.frontend);
314 }
315 if (fe->dvb.frontend)
316 /* always allocated, may have been reset */
317 dvb_frontend_detach(fe->dvb.frontend);
318 list_del(list);
319 kfree(fe);
320 }
321 mutex_unlock(&f->lock);
322 300
323 dvb_unregister_adapter(&f->adapter); 301 dvb_unregister_adapter(&f->adapter);
324} 302}
@@ -389,3 +367,31 @@ fail_alloc:
389 return fe; 367 return fe;
390} 368}
391EXPORT_SYMBOL(videobuf_dvb_alloc_frontend); 369EXPORT_SYMBOL(videobuf_dvb_alloc_frontend);
370
371void videobuf_dvb_dealloc_frontends(struct videobuf_dvb_frontends *f)
372{
373 struct list_head *list, *q;
374 struct videobuf_dvb_frontend *fe;
375
376 mutex_lock(&f->lock);
377 list_for_each_safe(list, q, &f->felist) {
378 fe = list_entry(list, struct videobuf_dvb_frontend, felist);
379 if (fe->dvb.net.dvbdev) {
380 dvb_net_release(&fe->dvb.net);
381 fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx,
382 &fe->dvb.fe_mem);
383 fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx,
384 &fe->dvb.fe_hw);
385 dvb_dmxdev_release(&fe->dvb.dmxdev);
386 dvb_dmx_release(&fe->dvb.demux);
387 dvb_unregister_frontend(fe->dvb.frontend);
388 }
389 if (fe->dvb.frontend)
390 /* always allocated, may have been reset */
391 dvb_frontend_detach(fe->dvb.frontend);
392 list_del(list); /* remove list entry */
393 kfree(fe); /* free frontend allocation */
394 }
395 mutex_unlock(&f->lock);
396}
397EXPORT_SYMBOL(videobuf_dvb_dealloc_frontends);