From 480884b647c7efecb904a9ed022ee533afb9cb80 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 2 Mar 2015 10:49:04 -0300 Subject: [PATCH] [media] dvbdev: use adapter arg for dvb_create_media_graph() Instead of using media_dev argument for dvb_create_media_graph(), use the adapter. That allows to create a stub for this function, if compiled without DVB support, avoiding to add extra if's at the drivers. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/siano/smsdvb-main.c | 2 +- drivers/media/dvb-core/dvbdev.c | 7 ++++--- drivers/media/dvb-core/dvbdev.h | 7 ++++++- drivers/media/usb/cx231xx/cx231xx-dvb.c | 5 ++--- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 2 +- drivers/media/usb/dvb-usb/dvb-usb-dvb.c | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c index dd3c1516013f..387db145d37e 100644 --- a/drivers/media/common/siano/smsdvb-main.c +++ b/drivers/media/common/siano/smsdvb-main.c @@ -1185,7 +1185,7 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev, if (smsdvb_debugfs_create(client) < 0) pr_info("failed to create debugfs node\n"); - dvb_create_media_graph(coredev->media_dev); + dvb_create_media_graph(&client->adapter); pr_info("DVB interface registered.\n"); return 0; diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index 0af9d0c5f889..13bb57f0457f 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -381,9 +381,10 @@ void dvb_unregister_device(struct dvb_device *dvbdev) EXPORT_SYMBOL(dvb_unregister_device); -void dvb_create_media_graph(struct media_device *mdev) -{ #ifdef CONFIG_MEDIA_CONTROLLER_DVB +void dvb_create_media_graph(struct dvb_adapter *adap) +{ + struct media_device *mdev = adap->mdev; struct media_entity *entity, *tuner = NULL, *fe = NULL; struct media_entity *demux = NULL, *dvr = NULL, *ca = NULL; @@ -421,9 +422,9 @@ void dvb_create_media_graph(struct media_device *mdev) if (demux && ca) media_entity_create_link(demux, 1, ca, 0, MEDIA_LNK_FL_ENABLED); -#endif } EXPORT_SYMBOL_GPL(dvb_create_media_graph); +#endif static int dvbdev_check_free_adapter_num(int num) { diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h index 467c1311bd4c..556c9e9d1d4e 100644 --- a/drivers/media/dvb-core/dvbdev.h +++ b/drivers/media/dvb-core/dvbdev.h @@ -122,7 +122,12 @@ extern int dvb_register_device (struct dvb_adapter *adap, int type); extern void dvb_unregister_device (struct dvb_device *dvbdev); -void dvb_create_media_graph(struct media_device *mdev); + +#ifdef CONFIG_MEDIA_CONTROLLER_DVB +void dvb_create_media_graph(struct dvb_adapter *adap); +#else +static inline void dvb_create_media_graph(struct dvb_adapter *adap) {} +#endif extern int dvb_generic_open (struct inode *inode, struct file *file); extern int dvb_generic_release (struct inode *inode, struct file *file); diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 44229a2c2d32..8bf2baae387f 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -540,9 +540,8 @@ static int register_dvb(struct cx231xx_dvb *dvb, /* register network adapter */ dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); -#ifdef CONFIG_MEDIA_CONTROLLER_DVB - dvb_create_media_graph(dev->media_dev); -#endif + dvb_create_media_graph(&dvb->adapter); + return 0; fail_fe_conn: diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index 0666c8f33ac7..08a3cd1c8b44 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c @@ -702,7 +702,7 @@ static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap) } } - dvb_create_media_graph(adap->dvb_adap.mdev); + dvb_create_media_graph(&adap->dvb_adap); return 0; diff --git a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c index a7bc4535c58f..6c9f5ecf949c 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c @@ -320,7 +320,7 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap) adap->num_frontends_initialized++; } - dvb_create_media_graph(adap->dvb_adap.mdev); + dvb_create_media_graph(&adap->dvb_adap); return 0; } -- 2.39.5