Skip to content

Commit 70769b2

Browse files
trsqrmchehab
authored andcommitted
[media] dw2102: store i2c client for tuner into dw2102_state
Prepare the dw2102 driver for tuner drivers that are implemented as I2C drivers (such as m88ts2022). The I2C client is stored in to the state and released at disconnect. Signed-off-by: Olli Salonen <[email protected]> Signed-off-by: Antti Palosaari <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 2c4ffe2 commit 70769b2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/media/usb/dvb-usb/dw2102.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114

115115
struct dw2102_state {
116116
u8 initialized;
117+
struct i2c_client *i2c_client_tuner;
117118
int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v);
118119
};
119120

@@ -2138,10 +2139,26 @@ static int dw2102_probe(struct usb_interface *intf,
21382139
return -ENODEV;
21392140
}
21402141

2142+
static void dw2102_disconnect(struct usb_interface *intf)
2143+
{
2144+
struct dvb_usb_device *d = usb_get_intfdata(intf);
2145+
struct dw2102_state *st = (struct dw2102_state *)d->priv;
2146+
struct i2c_client *client;
2147+
2148+
/* remove I2C client for tuner */
2149+
client = st->i2c_client_tuner;
2150+
if (client) {
2151+
module_put(client->dev.driver->owner);
2152+
i2c_unregister_device(client);
2153+
}
2154+
2155+
dvb_usb_device_exit(intf);
2156+
}
2157+
21412158
static struct usb_driver dw2102_driver = {
21422159
.name = "dw2102",
21432160
.probe = dw2102_probe,
2144-
.disconnect = dvb_usb_device_exit,
2161+
.disconnect = dw2102_disconnect,
21452162
.id_table = dw2102_table,
21462163
};
21472164

0 commit comments

Comments
 (0)