mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 19:10:51 +07:00
[media] dvb-usb-v2: create one media_dev per adapter
Instead of assuming just one adapter, change the code to store one media controller per adapter. This works fine for dvb-usb, as, on all drivers here, it is not possible to write a media graph that would mix resources between the two different adapters. Acked-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
6f6c77d8d2
commit
823b460ee7
@ -392,10 +392,6 @@ struct dvb_usb_device {
|
||||
struct delayed_work rc_query_work;
|
||||
|
||||
void *priv;
|
||||
|
||||
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
|
||||
struct media_device *media_dev;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern int dvb_usbv2_probe(struct usb_interface *,
|
||||
|
@ -400,11 +400,11 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dvb_usbv2_media_device_register(struct dvb_usb_device *d)
|
||||
static void dvb_usbv2_media_device_register(struct dvb_usb_adapter *adap)
|
||||
{
|
||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||
|
||||
struct media_device *mdev;
|
||||
struct dvb_usb_device *d = adap_to_d(adap);
|
||||
struct usb_device *udev = d->udev;
|
||||
int ret;
|
||||
|
||||
@ -429,22 +429,23 @@ static void dvb_usbv2_media_device_register(struct dvb_usb_device *d)
|
||||
return;
|
||||
}
|
||||
|
||||
d->media_dev = mdev;
|
||||
adap->dvb_adap.mdev = mdev;
|
||||
|
||||
dev_info(&d->udev->dev, "media controller created\n");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void dvb_usbv2_media_device_unregister(struct dvb_usb_device *d)
|
||||
static void dvb_usbv2_media_device_unregister(struct dvb_usb_adapter *adap)
|
||||
{
|
||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||
if (!d->media_dev)
|
||||
|
||||
if (!adap->dvb_adap.mdev)
|
||||
return;
|
||||
|
||||
media_device_unregister(d->media_dev);
|
||||
kfree(d->media_dev);
|
||||
d->media_dev = NULL;
|
||||
media_device_unregister(adap->dvb_adap.mdev);
|
||||
kfree(adap->dvb_adap.mdev);
|
||||
adap->dvb_adap.mdev = NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -453,6 +454,7 @@ static int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
|
||||
{
|
||||
int ret;
|
||||
struct dvb_usb_device *d = adap_to_d(adap);
|
||||
|
||||
dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id);
|
||||
|
||||
ret = dvb_register_adapter(&adap->dvb_adap, d->name, d->props->owner,
|
||||
@ -466,8 +468,7 @@ static int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
|
||||
adap->dvb_adap.priv = adap;
|
||||
|
||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||
dvb_usbv2_media_device_register(d);
|
||||
adap->dvb_adap.mdev = d->media_dev;
|
||||
dvb_usbv2_media_device_register(adap);
|
||||
#endif
|
||||
|
||||
if (d->props->read_mac_address) {
|
||||
@ -518,7 +519,7 @@ static int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
|
||||
err_dvb_dmxdev_init:
|
||||
dvb_dmx_release(&adap->demux);
|
||||
err_dvb_dmx_init:
|
||||
dvb_usbv2_media_device_unregister(d);
|
||||
dvb_usbv2_media_device_unregister(adap);
|
||||
dvb_unregister_adapter(&adap->dvb_adap);
|
||||
err_dvb_register_adapter:
|
||||
adap->dvb_adap.priv = NULL;
|
||||
@ -537,7 +538,7 @@ static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
|
||||
adap->demux.dmx.close(&adap->demux.dmx);
|
||||
dvb_dmxdev_release(&adap->dmxdev);
|
||||
dvb_dmx_release(&adap->demux);
|
||||
dvb_usbv2_media_device_unregister(d);
|
||||
dvb_usbv2_media_device_unregister(adap);
|
||||
dvb_unregister_adapter(&adap->dvb_adap);
|
||||
}
|
||||
|
||||
@ -701,7 +702,7 @@ static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
|
||||
}
|
||||
}
|
||||
|
||||
dvb_create_media_graph(d->media_dev);
|
||||
dvb_create_media_graph(adap->dvb_adap.mdev);
|
||||
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user