Skip to content

Commit

Permalink
media: usb: dvb-usb-v2: rtl28xxu: convert to use i2c_new_client_device()
Browse files Browse the repository at this point in the history
Use the newer API returning an ERRPTR and use the new helper to bail
out.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
Wolfram Sang authored and Mauro Carvalho Chehab committed Jan 9, 2020
1 parent 402e77c commit 9785a61
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions drivers/media/usb/dvb-usb-v2/rtl28xxu.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap)
board_info.addr = 0x10;
board_info.platform_data = pdata;
request_module("%s", board_info.type);
client = i2c_new_device(&d->i2c_adap, &board_info);
if (client == NULL || client->dev.driver == NULL) {
client = i2c_new_client_device(&d->i2c_adap, &board_info);
if (!i2c_client_has_driver(client)) {
ret = -ENODEV;
goto err;
}
Expand Down Expand Up @@ -918,8 +918,8 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
board_info.addr = 0x10;
board_info.platform_data = pdata;
request_module("%s", board_info.type);
client = i2c_new_device(&d->i2c_adap, &board_info);
if (client == NULL || client->dev.driver == NULL) {
client = i2c_new_client_device(&d->i2c_adap, &board_info);
if (!i2c_client_has_driver(client)) {
ret = -ENODEV;
goto err;
}
Expand Down Expand Up @@ -960,8 +960,8 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
info.addr = 0x18;
info.platform_data = &mn88472_config;
request_module(info.type);
client = i2c_new_device(&d->i2c_adap, &info);
if (client == NULL || client->dev.driver == NULL) {
client = i2c_new_client_device(&d->i2c_adap, &info);
if (!i2c_client_has_driver(client)) {
dev->slave_demod = SLAVE_DEMOD_NONE;
goto err_slave_demod_failed;
}
Expand All @@ -982,8 +982,8 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
info.addr = 0x18;
info.platform_data = &mn88473_config;
request_module(info.type);
client = i2c_new_device(&d->i2c_adap, &info);
if (client == NULL || client->dev.driver == NULL) {
client = i2c_new_client_device(&d->i2c_adap, &info);
if (!i2c_client_has_driver(client)) {
dev->slave_demod = SLAVE_DEMOD_NONE;
goto err_slave_demod_failed;
}
Expand Down Expand Up @@ -1025,8 +1025,8 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
info.addr = 0x64;
info.platform_data = &si2168_config;
request_module(info.type);
client = i2c_new_device(&d->i2c_adap, &info);
if (client == NULL || client->dev.driver == NULL) {
client = i2c_new_client_device(&d->i2c_adap, &info);
if (!i2c_client_has_driver(client)) {
dev->slave_demod = SLAVE_DEMOD_NONE;
goto err_slave_demod_failed;
}
Expand Down Expand Up @@ -1217,8 +1217,9 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
info.platform_data = &e4000_config;

request_module(info.type);
client = i2c_new_device(dev->demod_i2c_adapter, &info);
if (client == NULL || client->dev.driver == NULL)
client = i2c_new_client_device(dev->demod_i2c_adapter,
&info);
if (!i2c_client_has_driver(client))
break;

if (!try_module_get(client->dev.driver->owner)) {
Expand All @@ -1240,9 +1241,9 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
board_info.addr = 0x56;
board_info.platform_data = &fc2580_pdata;
request_module("fc2580");
client = i2c_new_device(dev->demod_i2c_adapter,
&board_info);
if (client == NULL || client->dev.driver == NULL)
client = i2c_new_client_device(dev->demod_i2c_adapter,
&board_info);
if (!i2c_client_has_driver(client))
break;
if (!try_module_get(client->dev.driver->owner)) {
i2c_unregister_device(client);
Expand Down Expand Up @@ -1271,8 +1272,9 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
board_info.addr = 0x60;
board_info.platform_data = &tua9001_pdata;
request_module("tua9001");
client = i2c_new_device(dev->demod_i2c_adapter, &board_info);
if (client == NULL || client->dev.driver == NULL)
client = i2c_new_client_device(dev->demod_i2c_adapter,
&board_info);
if (!i2c_client_has_driver(client))
break;
if (!try_module_get(client->dev.driver->owner)) {
i2c_unregister_device(client);
Expand Down Expand Up @@ -1316,8 +1318,8 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module(info.type);
client = i2c_new_device(&d->i2c_adap, &info);
if (client == NULL || client->dev.driver == NULL)
client = i2c_new_client_device(&d->i2c_adap, &info);
if (!i2c_client_has_driver(client))
break;

if (!try_module_get(client->dev.driver->owner)) {
Expand Down

0 comments on commit 9785a61

Please sign in to comment.