[media] use a function for DVB media controller register
This is really a simple function, but using it avoids to have if's inside the drivers. Also, the kABI becomes a little more clearer. This shouldn't generate any overhead, and the type check will happen when compiling with MC DVB enabled. So, let's do it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
872b9dbedd
commit
89a2c1d60a
|
@ -1104,9 +1104,7 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
|
||||||
pr_err("dvb_register_adapter() failed %d\n", rc);
|
pr_err("dvb_register_adapter() failed %d\n", rc);
|
||||||
goto adapter_error;
|
goto adapter_error;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
dvb_register_media_controller(&client->adapter, coredev->media_dev);
|
||||||
client->adapter.mdev = coredev->media_dev;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* init dvb demux */
|
/* init dvb demux */
|
||||||
client->demux.dmx.capabilities = DMX_TS_FILTERING;
|
client->demux.dmx.capabilities = DMX_TS_FILTERING;
|
||||||
|
|
|
@ -125,8 +125,15 @@ extern void dvb_unregister_device (struct dvb_device *dvbdev);
|
||||||
|
|
||||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||||
void dvb_create_media_graph(struct dvb_adapter *adap);
|
void dvb_create_media_graph(struct dvb_adapter *adap);
|
||||||
|
static inline void dvb_register_media_controller(struct dvb_adapter *adap,
|
||||||
|
struct media_device *mdev)
|
||||||
|
{
|
||||||
|
adap->mdev = mdev;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static inline void dvb_create_media_graph(struct dvb_adapter *adap) {}
|
static inline void dvb_create_media_graph(struct dvb_adapter *adap) {}
|
||||||
|
#define dvb_register_media_controller(a, b) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int dvb_generic_open (struct inode *inode, struct file *file);
|
extern int dvb_generic_open (struct inode *inode, struct file *file);
|
||||||
|
|
|
@ -465,9 +465,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
|
||||||
dev->name, result);
|
dev->name, result);
|
||||||
goto fail_adapter;
|
goto fail_adapter;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
dvb_register_media_controller(&dvb->adapter, dev->media_dev);
|
||||||
dvb->adapter.mdev = dev->media_dev;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Ensure all frontends negotiate bus access */
|
/* Ensure all frontends negotiate bus access */
|
||||||
dvb->frontend->ops.ts_bus_ctrl = cx231xx_dvb_bus_ctrl;
|
dvb->frontend->ops.ts_bus_ctrl = cx231xx_dvb_bus_ctrl;
|
||||||
|
|
|
@ -429,7 +429,7 @@ static void dvb_usbv2_media_device_register(struct dvb_usb_adapter *adap)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
adap->dvb_adap.mdev = mdev;
|
dvb_register_media_controller(&adap->dvb_adap, mdev);
|
||||||
|
|
||||||
dev_info(&d->udev->dev, "media controller created\n");
|
dev_info(&d->udev->dev, "media controller created\n");
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ static void dvb_usb_media_device_register(struct dvb_usb_adapter *adap)
|
||||||
kfree(mdev);
|
kfree(mdev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
adap->dvb_adap.mdev = mdev;
|
dvb_register_media_controller(&adap->dvb_adap, mdev);
|
||||||
|
|
||||||
dev_info(&d->udev->dev, "media controller created\n");
|
dev_info(&d->udev->dev, "media controller created\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue