media: dvb-usb/tbs5530: Implemented tbs5530_disconnect() - unregister tuner/demod i2c_client.

This commit is contained in:
CrazyCat
2024-03-15 23:03:54 +02:00
parent 515f56d958
commit 5de30a2b2d

View File

@@ -19,9 +19,8 @@
struct tbs5530_state {
struct i2c_client *i2c_client_demod;
struct i2c_client *i2c_client_tuner;
u32 last_key_pressed;
struct i2c_client *i2c_client;
u8 initialized;
};
@@ -191,28 +190,20 @@ static int tbs5530_frontend_cxd2878_attach(struct dvb_usb_adapter *adap)
{
struct dvb_usb_device *d = adap->dev;
//u8 buf[20];
/* attach frontend */
adap->fe_adap[0].fe = dvb_attach(cxd2878_attach, &tbs5530_cfg, &d->i2c_adap);
if(adap->fe_adap[0].fe!=NULL){
strscpy(adap->fe_adap[0].fe->ops.info.name,d->props.devices[0].name,60);
strcat(adap->fe_adap[0].fe->ops.info.name," DVB-T/T2/C/C2,ISDB-T/C,ATSC1.0");
return 0;
}
// strscpy(adap->fe_adap[0].fe->ops.info.name,d->props.devices[0].name,52);
if(adap->fe_adap[0].fe == NULL)
return -ENODEV;
// strscpy(adap->fe_adap[0].fe2->ops.info.name,d->props.devices[0].name,52);
// strcat(adap->fe_adap[0].fe2->ops.info.name," DVB-S/S2/S2X");
return -EIO;
strscpy(adap->fe_adap[0].fe->ops.info.name,d->props.devices[0].name,60);
strcat(adap->fe_adap[0].fe->ops.info.name," DVB-T/T2/C/C2,ISDB-T/C,ATSC,J83B");
return 0;
}
static int tbs5930_frontend_m88rs6060_attach(struct dvb_usb_adapter *adap)
static int tbs5530_frontend_m88rs6060_attach(struct dvb_usb_adapter *adap)
{
struct dvb_usb_device *d = adap->dev;
struct tbs5530_state *st = d->priv;
struct i2c_client *client;
struct i2c_board_info info;
struct m88rs6060_cfg m88rs6060_config;
@@ -244,8 +235,8 @@ static int tbs5930_frontend_m88rs6060_attach(struct dvb_usb_adapter *adap)
return -ENODEV;
}
st->i2c_client = client;
buf[0] = 0;
buf[1] = 0;
tbs5530_op_rw(d->udev, 0xb7, 0, 0,
@@ -356,7 +347,7 @@ static struct dvb_usb_device_properties tbs5530_properties = {
}
},
},{
.frontend_attach = tbs5930_frontend_m88rs6060_attach,
.frontend_attach = tbs5530_frontend_m88rs6060_attach,
.streaming_ctrl = tbs5530_sat_streaming_ctrl,
.tuner_attach = NULL,
.stream = {
@@ -378,7 +369,7 @@ static struct dvb_usb_device_properties tbs5530_properties = {
.num_device_descs = 1,
.devices = {
{"TurboSight TBS 5530 DVB-T2/T/C/S/S2/S2x,ISDB-T,ATSC1.0",
{"TurboSight TBS 5530",
{&tbs5530_table[0], NULL},
{NULL},
}
@@ -395,10 +386,27 @@ static int tbs5530_probe(struct usb_interface *intf,
return -ENODEV;
}
static void tbs5530_disconnect(struct usb_interface *intf)
{
#if 1
struct dvb_usb_device *d = usb_get_intfdata(intf);
struct tbs5530_state *st = d->priv;
struct i2c_client *client;
/* remove I2C client for tuner/demod*/
client = st->i2c_client;
if (client) {
module_put(client->dev.driver->owner);
i2c_unregister_device(client);
}
#endif
dvb_usb_device_exit(intf);
}
static struct usb_driver tbs5530_driver = {
.name = "tbs5530",
.probe = tbs5530_probe,
.disconnect = dvb_usb_device_exit,
.disconnect = tbs5530_disconnect,
.id_table = tbs5530_table,
};