Commit 0ace5b2e authored by Wolfram Sang's avatar Wolfram Sang Committed by Mauro Carvalho Chehab

media: pci: cx23885: cx23885-dvb: convert to use i2c_new_client_device()

Use the newer API returning an ERRPTR and use the new helper to bail
out.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 2f507ffa
...@@ -1159,8 +1159,8 @@ static int dvb_register_ci_mac(struct cx23885_tsport *port) ...@@ -1159,8 +1159,8 @@ static int dvb_register_ci_mac(struct cx23885_tsport *port)
info.addr = 0x40; info.addr = 0x40;
info.platform_data = &sp2_config; info.platform_data = &sp2_config;
request_module(info.type); request_module(info.type);
client_ci = i2c_new_device(&i2c_bus->i2c_adap, &info); client_ci = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (client_ci == NULL || client_ci->dev.driver == NULL) if (!i2c_client_has_driver(client_ci))
return -ENODEV; return -ENODEV;
if (!try_module_get(client_ci->dev.driver->owner)) { if (!try_module_get(client_ci->dev.driver->owner)) {
i2c_unregister_device(client_ci); i2c_unregister_device(client_ci);
...@@ -1826,8 +1826,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -1826,8 +1826,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x05; info.addr = 0x05;
info.platform_data = &tda10071_pdata; info.platform_data = &tda10071_pdata;
request_module("tda10071"); request_module("tda10071");
client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (!client_demod || !client_demod->dev.driver) if (!i2c_client_has_driver(client_demod))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -1843,8 +1843,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -1843,8 +1843,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x0b; info.addr = 0x0b;
info.platform_data = &a8293_pdata; info.platform_data = &a8293_pdata;
request_module("a8293"); request_module("a8293");
client_sec = i2c_new_device(&i2c_bus->i2c_adap, &info); client_sec = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (!client_sec || !client_sec->dev.driver) if (!i2c_client_has_driver(client_sec))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_sec->dev.driver->owner)) { if (!try_module_get(client_sec->dev.driver->owner)) {
i2c_unregister_device(client_sec); i2c_unregister_device(client_sec);
...@@ -1864,9 +1864,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -1864,9 +1864,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x64; info.addr = 0x64;
info.platform_data = &si2165_pdata; info.platform_data = &si2165_pdata;
request_module(info.type); request_module(info.type);
client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (client_demod == NULL || if (!i2c_client_has_driver(client_demod))
client_demod->dev.driver == NULL)
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -1898,8 +1897,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -1898,8 +1897,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x05; info.addr = 0x05;
info.platform_data = &tda10071_pdata; info.platform_data = &tda10071_pdata;
request_module("tda10071"); request_module("tda10071");
client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (!client_demod || !client_demod->dev.driver) if (!i2c_client_has_driver(client_demod))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -1915,8 +1914,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -1915,8 +1914,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x0b; info.addr = 0x0b;
info.platform_data = &a8293_pdata; info.platform_data = &a8293_pdata;
request_module("a8293"); request_module("a8293");
client_sec = i2c_new_device(&i2c_bus->i2c_adap, &info); client_sec = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (!client_sec || !client_sec->dev.driver) if (!i2c_client_has_driver(client_sec))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_sec->dev.driver->owner)) { if (!try_module_get(client_sec->dev.driver->owner)) {
i2c_unregister_device(client_sec); i2c_unregister_device(client_sec);
...@@ -1948,9 +1947,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -1948,9 +1947,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &ts2020_config; info.platform_data = &ts2020_config;
request_module(info.type); request_module(info.type);
client_tuner = i2c_new_device(adapter, &info); client_tuner = i2c_new_client_device(adapter, &info);
if (client_tuner == NULL || if (!i2c_client_has_driver(client_tuner))
client_tuner->dev.driver == NULL)
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_tuner->dev.driver->owner)) { if (!try_module_get(client_tuner->dev.driver->owner)) {
i2c_unregister_device(client_tuner); i2c_unregister_device(client_tuner);
...@@ -1985,9 +1983,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -1985,9 +1983,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x64; info.addr = 0x64;
info.platform_data = &si2168_config; info.platform_data = &si2168_config;
request_module(info.type); request_module(info.type);
client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (client_demod == NULL || if (!i2c_client_has_driver(client_demod))
client_demod->dev.driver == NULL)
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -2004,9 +2001,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2004,9 +2001,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module(info.type); request_module(info.type);
client_tuner = i2c_new_device(adapter, &info); client_tuner = i2c_new_client_device(adapter, &info);
if (client_tuner == NULL || if (!i2c_client_has_driver(client_tuner))
client_tuner->dev.driver == NULL)
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_tuner->dev.driver->owner)) { if (!try_module_get(client_tuner->dev.driver->owner)) {
...@@ -2032,8 +2028,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2032,8 +2028,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x64; info.addr = 0x64;
info.platform_data = &si2168_config; info.platform_data = &si2168_config;
request_module(info.type); request_module(info.type);
client_demod = i2c_new_device(&i2c_bus2->i2c_adap, &info); client_demod = i2c_new_client_device(&i2c_bus2->i2c_adap, &info);
if (client_demod == NULL || client_demod->dev.driver == NULL) if (!i2c_client_has_driver(client_demod))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -2050,9 +2046,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2050,9 +2046,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module(info.type); request_module(info.type);
client_tuner = i2c_new_device(adapter, &info); client_tuner = i2c_new_client_device(adapter, &info);
if (client_tuner == NULL || if (!i2c_client_has_driver(client_tuner))
client_tuner->dev.driver == NULL)
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_tuner->dev.driver->owner)) { if (!try_module_get(client_tuner->dev.driver->owner)) {
i2c_unregister_device(client_tuner); i2c_unregister_device(client_tuner);
...@@ -2080,8 +2075,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2080,8 +2075,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &ts2020_config; info.platform_data = &ts2020_config;
request_module(info.type); request_module(info.type);
client_tuner = i2c_new_device(adapter, &info); client_tuner = i2c_new_client_device(adapter, &info);
if (client_tuner == NULL || client_tuner->dev.driver == NULL) if (!i2c_client_has_driver(client_tuner))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_tuner->dev.driver->owner)) { if (!try_module_get(client_tuner->dev.driver->owner)) {
i2c_unregister_device(client_tuner); i2c_unregister_device(client_tuner);
...@@ -2129,8 +2124,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2129,8 +2124,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x68; info.addr = 0x68;
info.platform_data = &m88ds3103_pdata; info.platform_data = &m88ds3103_pdata;
request_module(info.type); request_module(info.type);
client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (client_demod == NULL || client_demod->dev.driver == NULL) if (!i2c_client_has_driver(client_demod))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -2149,8 +2144,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2149,8 +2144,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &ts2020_config; info.platform_data = &ts2020_config;
request_module(info.type); request_module(info.type);
client_tuner = i2c_new_device(adapter, &info); client_tuner = i2c_new_client_device(adapter, &info);
if (client_tuner == NULL || client_tuner->dev.driver == NULL) if (!i2c_client_has_driver(client_tuner))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_tuner->dev.driver->owner)) { if (!try_module_get(client_tuner->dev.driver->owner)) {
i2c_unregister_device(client_tuner); i2c_unregister_device(client_tuner);
...@@ -2194,8 +2189,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2194,8 +2189,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x64; info.addr = 0x64;
info.platform_data = &si2168_config; info.platform_data = &si2168_config;
request_module(info.type); request_module(info.type);
client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (client_demod == NULL || client_demod->dev.driver == NULL) if (!i2c_client_has_driver(client_demod))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -2212,9 +2207,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2212,9 +2207,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module(info.type); request_module(info.type);
client_tuner = i2c_new_device(adapter, &info); client_tuner = i2c_new_client_device(adapter, &info);
if (client_tuner == NULL || if (!i2c_client_has_driver(client_tuner))
client_tuner->dev.driver == NULL)
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_tuner->dev.driver->owner)) { if (!try_module_get(client_tuner->dev.driver->owner)) {
i2c_unregister_device(client_tuner); i2c_unregister_device(client_tuner);
...@@ -2245,8 +2239,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2245,8 +2239,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x0b; info.addr = 0x0b;
info.platform_data = &a8293_pdata; info.platform_data = &a8293_pdata;
request_module("a8293"); request_module("a8293");
client_sec = i2c_new_device(&i2c_bus->i2c_adap, &info); client_sec = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (!client_sec || !client_sec->dev.driver) if (!i2c_client_has_driver(client_sec))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_sec->dev.driver->owner)) { if (!try_module_get(client_sec->dev.driver->owner)) {
i2c_unregister_device(client_sec); i2c_unregister_device(client_sec);
...@@ -2262,8 +2256,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2262,8 +2256,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x21; info.addr = 0x21;
info.platform_data = &m88rs6000t_config; info.platform_data = &m88rs6000t_config;
request_module("%s", info.type); request_module("%s", info.type);
client_tuner = i2c_new_device(adapter, &info); client_tuner = i2c_new_client_device(adapter, &info);
if (!client_tuner || !client_tuner->dev.driver) if (!i2c_client_has_driver(client_tuner))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_tuner->dev.driver->owner)) { if (!try_module_get(client_tuner->dev.driver->owner)) {
i2c_unregister_device(client_tuner); i2c_unregister_device(client_tuner);
...@@ -2287,8 +2281,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2287,8 +2281,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x64; info.addr = 0x64;
info.platform_data = &si2168_config; info.platform_data = &si2168_config;
request_module("%s", info.type); request_module("%s", info.type);
client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info);
if (!client_demod || !client_demod->dev.driver) if (!i2c_client_has_driver(client_demod))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -2305,8 +2299,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2305,8 +2299,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module("%s", info.type); request_module("%s", info.type);
client_tuner = i2c_new_device(&i2c_bus2->i2c_adap, &info); client_tuner = i2c_new_client_device(&i2c_bus2->i2c_adap, &info);
if (!client_tuner || !client_tuner->dev.driver) { if (!i2c_client_has_driver(client_tuner)) {
module_put(client_demod->dev.driver->owner); module_put(client_demod->dev.driver->owner);
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
port->i2c_client_demod = NULL; port->i2c_client_demod = NULL;
...@@ -2340,8 +2334,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2340,8 +2334,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x64; info.addr = 0x64;
info.platform_data = &si2168_config; info.platform_data = &si2168_config;
request_module("%s", info.type); request_module("%s", info.type);
client_demod = i2c_new_device(&dev->i2c_bus[0].i2c_adap, &info); client_demod = i2c_new_client_device(&dev->i2c_bus[0].i2c_adap, &info);
if (!client_demod || !client_demod->dev.driver) if (!i2c_client_has_driver(client_demod))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -2358,8 +2352,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2358,8 +2352,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module("%s", info.type); request_module("%s", info.type);
client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info);
if (!client_tuner || !client_tuner->dev.driver) { if (!i2c_client_has_driver(client_tuner)) {
module_put(client_demod->dev.driver->owner); module_put(client_demod->dev.driver->owner);
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
port->i2c_client_demod = NULL; port->i2c_client_demod = NULL;
...@@ -2387,8 +2381,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2387,8 +2381,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x66; info.addr = 0x66;
info.platform_data = &si2168_config; info.platform_data = &si2168_config;
request_module("%s", info.type); request_module("%s", info.type);
client_demod = i2c_new_device(&dev->i2c_bus[0].i2c_adap, &info); client_demod = i2c_new_client_device(&dev->i2c_bus[0].i2c_adap, &info);
if (!client_demod || !client_demod->dev.driver) if (!i2c_client_has_driver(client_demod))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_demod->dev.driver->owner)) { if (!try_module_get(client_demod->dev.driver->owner)) {
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
...@@ -2405,8 +2399,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2405,8 +2399,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x62; info.addr = 0x62;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module("%s", info.type); request_module("%s", info.type);
client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info);
if (!client_tuner || !client_tuner->dev.driver) { if (!i2c_client_has_driver(client_tuner)) {
module_put(client_demod->dev.driver->owner); module_put(client_demod->dev.driver->owner);
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
port->i2c_client_demod = NULL; port->i2c_client_demod = NULL;
...@@ -2447,8 +2441,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2447,8 +2441,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module("%s", info.type); request_module("%s", info.type);
client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info);
if (!client_tuner || !client_tuner->dev.driver) { if (!i2c_client_has_driver(client_tuner)) {
module_put(client_demod->dev.driver->owner); module_put(client_demod->dev.driver->owner);
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
port->i2c_client_demod = NULL; port->i2c_client_demod = NULL;
...@@ -2483,8 +2477,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2483,8 +2477,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x62; info.addr = 0x62;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module("%s", info.type); request_module("%s", info.type);
client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info);
if (!client_tuner || !client_tuner->dev.driver) { if (!i2c_client_has_driver(client_tuner)) {
module_put(client_demod->dev.driver->owner); module_put(client_demod->dev.driver->owner);
i2c_unregister_device(client_demod); i2c_unregister_device(client_demod);
port->i2c_client_demod = NULL; port->i2c_client_demod = NULL;
...@@ -2523,8 +2517,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2523,8 +2517,8 @@ static int dvb_register(struct cx23885_tsport *port)
info.addr = 0x60; info.addr = 0x60;
info.platform_data = &si2157_config; info.platform_data = &si2157_config;
request_module("%s", info.type); request_module("%s", info.type);
client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info);
if (!client_tuner || !client_tuner->dev.driver) if (!i2c_client_has_driver(client_tuner))
goto frontend_detach; goto frontend_detach;
if (!try_module_get(client_tuner->dev.driver->owner)) { if (!try_module_get(client_tuner->dev.driver->owner)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment