[media] dvb-usb: 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. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
496ccf92b9
commit
a3dfc6d925
@ -94,11 +94,11 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
|
|||||||
return dvb_usb_ctrl_feed(dvbdmxfeed,0);
|
return dvb_usb_ctrl_feed(dvbdmxfeed,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dvb_usb_media_device_register(struct dvb_usb_device *d)
|
static void dvb_usb_media_device_register(struct dvb_usb_adapter *adap)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||||
|
|
||||||
struct media_device *mdev;
|
struct media_device *mdev;
|
||||||
|
struct dvb_usb_device *d = adap->dev;
|
||||||
struct usb_device *udev = d->udev;
|
struct usb_device *udev = d->udev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -122,24 +122,21 @@ static void dvb_usb_media_device_register(struct dvb_usb_device *d)
|
|||||||
kfree(mdev);
|
kfree(mdev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
adap->dvb_adap.mdev = mdev;
|
||||||
d->media_dev = mdev;
|
|
||||||
|
|
||||||
dev_info(&d->udev->dev, "media controller created\n");
|
dev_info(&d->udev->dev, "media controller created\n");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dvb_usb_media_device_unregister(struct dvb_usb_device *d)
|
static void dvb_usb_media_device_unregister(struct dvb_usb_adapter *adap)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||||
if (!d->media_dev)
|
if (!adap->dvb_adap.mdev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
media_device_unregister(d->media_dev);
|
media_device_unregister(adap->dvb_adap.mdev);
|
||||||
kfree(d->media_dev);
|
kfree(adap->dvb_adap.mdev);
|
||||||
d->media_dev = NULL;
|
adap->dvb_adap.mdev = NULL;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,8 +154,7 @@ int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums)
|
|||||||
adap->dvb_adap.priv = adap;
|
adap->dvb_adap.priv = adap;
|
||||||
|
|
||||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||||
dvb_usb_media_device_register(adap->dev);
|
dvb_usb_media_device_register(adap);
|
||||||
adap->dvb_adap.mdev = adap->dev->media_dev;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (adap->dev->props.read_mac_address) {
|
if (adap->dev->props.read_mac_address) {
|
||||||
@ -208,7 +204,7 @@ err_net_init:
|
|||||||
err_dmx_dev:
|
err_dmx_dev:
|
||||||
dvb_dmx_release(&adap->demux);
|
dvb_dmx_release(&adap->demux);
|
||||||
err_dmx:
|
err_dmx:
|
||||||
dvb_usb_media_device_unregister(adap->dev);
|
dvb_usb_media_device_unregister(adap);
|
||||||
dvb_unregister_adapter(&adap->dvb_adap);
|
dvb_unregister_adapter(&adap->dvb_adap);
|
||||||
err:
|
err:
|
||||||
return ret;
|
return ret;
|
||||||
@ -222,7 +218,7 @@ int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap)
|
|||||||
adap->demux.dmx.close(&adap->demux.dmx);
|
adap->demux.dmx.close(&adap->demux.dmx);
|
||||||
dvb_dmxdev_release(&adap->dmxdev);
|
dvb_dmxdev_release(&adap->dmxdev);
|
||||||
dvb_dmx_release(&adap->demux);
|
dvb_dmx_release(&adap->demux);
|
||||||
dvb_usb_media_device_unregister(adap->dev);
|
dvb_usb_media_device_unregister(adap);
|
||||||
dvb_unregister_adapter(&adap->dvb_adap);
|
dvb_unregister_adapter(&adap->dvb_adap);
|
||||||
adap->state &= ~DVB_USB_ADAP_STATE_DVB;
|
adap->state &= ~DVB_USB_ADAP_STATE_DVB;
|
||||||
}
|
}
|
||||||
@ -324,7 +320,7 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
|
|||||||
adap->num_frontends_initialized++;
|
adap->num_frontends_initialized++;
|
||||||
}
|
}
|
||||||
|
|
||||||
dvb_create_media_graph(adap->dev->media_dev);
|
dvb_create_media_graph(adap->dvb_adap.mdev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -453,10 +453,6 @@ struct dvb_usb_device {
|
|||||||
struct module *owner;
|
struct module *owner;
|
||||||
|
|
||||||
void *priv;
|
void *priv;
|
||||||
|
|
||||||
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
|
||||||
struct media_device *media_dev;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int dvb_usb_device_init(struct usb_interface *,
|
extern int dvb_usb_device_init(struct usb_interface *,
|
||||||
|
Loading…
Reference in New Issue
Block a user