.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for the Conexant CX23885 PCIe bridge |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * |
---|
15 | | - * GNU General Public License for more details. |
---|
16 | 6 | */ |
---|
17 | 7 | |
---|
18 | 8 | #include "cx23885.h" |
---|
.. | .. |
---|
1165 | 1155 | sp2_config.priv = port; |
---|
1166 | 1156 | sp2_config.ci_control = cx23885_sp2_ci_ctrl; |
---|
1167 | 1157 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
1168 | | - strlcpy(info.type, "sp2", I2C_NAME_SIZE); |
---|
| 1158 | + strscpy(info.type, "sp2", I2C_NAME_SIZE); |
---|
1169 | 1159 | info.addr = 0x40; |
---|
1170 | 1160 | info.platform_data = &sp2_config; |
---|
1171 | 1161 | request_module(info.type); |
---|
1172 | | - client_ci = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
1173 | | - if (client_ci == NULL || client_ci->dev.driver == NULL) |
---|
| 1162 | + client_ci = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 1163 | + if (!i2c_client_has_driver(client_ci)) |
---|
1174 | 1164 | return -ENODEV; |
---|
1175 | 1165 | if (!try_module_get(client_ci->dev.driver->owner)) { |
---|
1176 | 1166 | i2c_unregister_device(client_ci); |
---|
.. | .. |
---|
1832 | 1822 | case 1: |
---|
1833 | 1823 | /* attach demod + tuner combo */ |
---|
1834 | 1824 | memset(&info, 0, sizeof(info)); |
---|
1835 | | - strlcpy(info.type, "tda10071_cx24118", I2C_NAME_SIZE); |
---|
| 1825 | + strscpy(info.type, "tda10071_cx24118", I2C_NAME_SIZE); |
---|
1836 | 1826 | info.addr = 0x05; |
---|
1837 | 1827 | info.platform_data = &tda10071_pdata; |
---|
1838 | 1828 | request_module("tda10071"); |
---|
1839 | | - client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
1840 | | - if (!client_demod || !client_demod->dev.driver) |
---|
| 1829 | + client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 1830 | + if (!i2c_client_has_driver(client_demod)) |
---|
1841 | 1831 | goto frontend_detach; |
---|
1842 | 1832 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
1843 | 1833 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
1849 | 1839 | /* attach SEC */ |
---|
1850 | 1840 | a8293_pdata.dvb_frontend = fe0->dvb.frontend; |
---|
1851 | 1841 | memset(&info, 0, sizeof(info)); |
---|
1852 | | - strlcpy(info.type, "a8293", I2C_NAME_SIZE); |
---|
| 1842 | + strscpy(info.type, "a8293", I2C_NAME_SIZE); |
---|
1853 | 1843 | info.addr = 0x0b; |
---|
1854 | 1844 | info.platform_data = &a8293_pdata; |
---|
1855 | 1845 | request_module("a8293"); |
---|
1856 | | - client_sec = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
1857 | | - if (!client_sec || !client_sec->dev.driver) |
---|
| 1846 | + client_sec = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 1847 | + if (!i2c_client_has_driver(client_sec)) |
---|
1858 | 1848 | goto frontend_detach; |
---|
1859 | 1849 | if (!try_module_get(client_sec->dev.driver->owner)) { |
---|
1860 | 1850 | i2c_unregister_device(client_sec); |
---|
.. | .. |
---|
1870 | 1860 | si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL; |
---|
1871 | 1861 | si2165_pdata.ref_freq_hz = 16000000; |
---|
1872 | 1862 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
1873 | | - strlcpy(info.type, "si2165", I2C_NAME_SIZE); |
---|
| 1863 | + strscpy(info.type, "si2165", I2C_NAME_SIZE); |
---|
1874 | 1864 | info.addr = 0x64; |
---|
1875 | 1865 | info.platform_data = &si2165_pdata; |
---|
1876 | 1866 | request_module(info.type); |
---|
1877 | | - client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
1878 | | - if (client_demod == NULL || |
---|
1879 | | - client_demod->dev.driver == NULL) |
---|
| 1867 | + client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 1868 | + if (!i2c_client_has_driver(client_demod)) |
---|
1880 | 1869 | goto frontend_detach; |
---|
1881 | 1870 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
1882 | 1871 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
1904 | 1893 | |
---|
1905 | 1894 | /* attach demod + tuner combo */ |
---|
1906 | 1895 | memset(&info, 0, sizeof(info)); |
---|
1907 | | - strlcpy(info.type, "tda10071_cx24118", I2C_NAME_SIZE); |
---|
| 1896 | + strscpy(info.type, "tda10071_cx24118", I2C_NAME_SIZE); |
---|
1908 | 1897 | info.addr = 0x05; |
---|
1909 | 1898 | info.platform_data = &tda10071_pdata; |
---|
1910 | 1899 | request_module("tda10071"); |
---|
1911 | | - client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
1912 | | - if (!client_demod || !client_demod->dev.driver) |
---|
| 1900 | + client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 1901 | + if (!i2c_client_has_driver(client_demod)) |
---|
1913 | 1902 | goto frontend_detach; |
---|
1914 | 1903 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
1915 | 1904 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
1921 | 1910 | /* attach SEC */ |
---|
1922 | 1911 | a8293_pdata.dvb_frontend = fe0->dvb.frontend; |
---|
1923 | 1912 | memset(&info, 0, sizeof(info)); |
---|
1924 | | - strlcpy(info.type, "a8293", I2C_NAME_SIZE); |
---|
| 1913 | + strscpy(info.type, "a8293", I2C_NAME_SIZE); |
---|
1925 | 1914 | info.addr = 0x0b; |
---|
1926 | 1915 | info.platform_data = &a8293_pdata; |
---|
1927 | 1916 | request_module("a8293"); |
---|
1928 | | - client_sec = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
1929 | | - if (!client_sec || !client_sec->dev.driver) |
---|
| 1917 | + client_sec = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 1918 | + if (!i2c_client_has_driver(client_sec)) |
---|
1930 | 1919 | goto frontend_detach; |
---|
1931 | 1920 | if (!try_module_get(client_sec->dev.driver->owner)) { |
---|
1932 | 1921 | i2c_unregister_device(client_sec); |
---|
.. | .. |
---|
1954 | 1943 | ts2020_config.fe = fe0->dvb.frontend; |
---|
1955 | 1944 | ts2020_config.get_agc_pwm = m88ds3103_get_agc_pwm; |
---|
1956 | 1945 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
1957 | | - strlcpy(info.type, "ts2020", I2C_NAME_SIZE); |
---|
| 1946 | + strscpy(info.type, "ts2020", I2C_NAME_SIZE); |
---|
1958 | 1947 | info.addr = 0x60; |
---|
1959 | 1948 | info.platform_data = &ts2020_config; |
---|
1960 | 1949 | request_module(info.type); |
---|
1961 | | - client_tuner = i2c_new_device(adapter, &info); |
---|
1962 | | - if (client_tuner == NULL || |
---|
1963 | | - client_tuner->dev.driver == NULL) |
---|
| 1950 | + client_tuner = i2c_new_client_device(adapter, &info); |
---|
| 1951 | + if (!i2c_client_has_driver(client_tuner)) |
---|
1964 | 1952 | goto frontend_detach; |
---|
1965 | 1953 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
1966 | 1954 | i2c_unregister_device(client_tuner); |
---|
.. | .. |
---|
1991 | 1979 | si2168_config.fe = &fe0->dvb.frontend; |
---|
1992 | 1980 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
---|
1993 | 1981 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
1994 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
| 1982 | + strscpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
1995 | 1983 | info.addr = 0x64; |
---|
1996 | 1984 | info.platform_data = &si2168_config; |
---|
1997 | 1985 | request_module(info.type); |
---|
1998 | | - client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
1999 | | - if (client_demod == NULL || |
---|
2000 | | - client_demod->dev.driver == NULL) |
---|
| 1986 | + client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 1987 | + if (!i2c_client_has_driver(client_demod)) |
---|
2001 | 1988 | goto frontend_detach; |
---|
2002 | 1989 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
2003 | 1990 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
2010 | 1997 | si2157_config.fe = fe0->dvb.frontend; |
---|
2011 | 1998 | si2157_config.if_port = 1; |
---|
2012 | 1999 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2013 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2000 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2014 | 2001 | info.addr = 0x60; |
---|
2015 | 2002 | info.platform_data = &si2157_config; |
---|
2016 | 2003 | request_module(info.type); |
---|
2017 | | - client_tuner = i2c_new_device(adapter, &info); |
---|
2018 | | - if (client_tuner == NULL || |
---|
2019 | | - client_tuner->dev.driver == NULL) |
---|
| 2004 | + client_tuner = i2c_new_client_device(adapter, &info); |
---|
| 2005 | + if (!i2c_client_has_driver(client_tuner)) |
---|
2020 | 2006 | goto frontend_detach; |
---|
2021 | 2007 | |
---|
2022 | 2008 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
.. | .. |
---|
2038 | 2024 | si2168_config.fe = &fe0->dvb.frontend; |
---|
2039 | 2025 | si2168_config.ts_mode = SI2168_TS_PARALLEL; |
---|
2040 | 2026 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2041 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
| 2027 | + strscpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
2042 | 2028 | info.addr = 0x64; |
---|
2043 | 2029 | info.platform_data = &si2168_config; |
---|
2044 | 2030 | request_module(info.type); |
---|
2045 | | - client_demod = i2c_new_device(&i2c_bus2->i2c_adap, &info); |
---|
2046 | | - if (client_demod == NULL || client_demod->dev.driver == NULL) |
---|
| 2031 | + client_demod = i2c_new_client_device(&i2c_bus2->i2c_adap, &info); |
---|
| 2032 | + if (!i2c_client_has_driver(client_demod)) |
---|
2047 | 2033 | goto frontend_detach; |
---|
2048 | 2034 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
2049 | 2035 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
2056 | 2042 | si2157_config.fe = fe0->dvb.frontend; |
---|
2057 | 2043 | si2157_config.if_port = 1; |
---|
2058 | 2044 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2059 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2045 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2060 | 2046 | info.addr = 0x60; |
---|
2061 | 2047 | info.platform_data = &si2157_config; |
---|
2062 | 2048 | request_module(info.type); |
---|
2063 | | - client_tuner = i2c_new_device(adapter, &info); |
---|
2064 | | - if (client_tuner == NULL || |
---|
2065 | | - client_tuner->dev.driver == NULL) |
---|
| 2049 | + client_tuner = i2c_new_client_device(adapter, &info); |
---|
| 2050 | + if (!i2c_client_has_driver(client_tuner)) |
---|
2066 | 2051 | goto frontend_detach; |
---|
2067 | 2052 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
2068 | 2053 | i2c_unregister_device(client_tuner); |
---|
.. | .. |
---|
2086 | 2071 | ts2020_config.fe = fe0->dvb.frontend; |
---|
2087 | 2072 | ts2020_config.get_agc_pwm = m88ds3103_get_agc_pwm; |
---|
2088 | 2073 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2089 | | - strlcpy(info.type, "ts2020", I2C_NAME_SIZE); |
---|
| 2074 | + strscpy(info.type, "ts2020", I2C_NAME_SIZE); |
---|
2090 | 2075 | info.addr = 0x60; |
---|
2091 | 2076 | info.platform_data = &ts2020_config; |
---|
2092 | 2077 | request_module(info.type); |
---|
2093 | | - client_tuner = i2c_new_device(adapter, &info); |
---|
2094 | | - if (client_tuner == NULL || client_tuner->dev.driver == NULL) |
---|
| 2078 | + client_tuner = i2c_new_client_device(adapter, &info); |
---|
| 2079 | + if (!i2c_client_has_driver(client_tuner)) |
---|
2095 | 2080 | goto frontend_detach; |
---|
2096 | 2081 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
2097 | 2082 | i2c_unregister_device(client_tuner); |
---|
.. | .. |
---|
2135 | 2120 | } |
---|
2136 | 2121 | |
---|
2137 | 2122 | memset(&info, 0, sizeof(info)); |
---|
2138 | | - strlcpy(info.type, "m88ds3103", I2C_NAME_SIZE); |
---|
| 2123 | + strscpy(info.type, "m88ds3103", I2C_NAME_SIZE); |
---|
2139 | 2124 | info.addr = 0x68; |
---|
2140 | 2125 | info.platform_data = &m88ds3103_pdata; |
---|
2141 | 2126 | request_module(info.type); |
---|
2142 | | - client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
2143 | | - if (client_demod == NULL || client_demod->dev.driver == NULL) |
---|
| 2127 | + client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 2128 | + if (!i2c_client_has_driver(client_demod)) |
---|
2144 | 2129 | goto frontend_detach; |
---|
2145 | 2130 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
2146 | 2131 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
2155 | 2140 | ts2020_config.fe = fe0->dvb.frontend; |
---|
2156 | 2141 | ts2020_config.get_agc_pwm = m88ds3103_get_agc_pwm; |
---|
2157 | 2142 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2158 | | - strlcpy(info.type, "ts2020", I2C_NAME_SIZE); |
---|
| 2143 | + strscpy(info.type, "ts2020", I2C_NAME_SIZE); |
---|
2159 | 2144 | info.addr = 0x60; |
---|
2160 | 2145 | info.platform_data = &ts2020_config; |
---|
2161 | 2146 | request_module(info.type); |
---|
2162 | | - client_tuner = i2c_new_device(adapter, &info); |
---|
2163 | | - if (client_tuner == NULL || client_tuner->dev.driver == NULL) |
---|
| 2147 | + client_tuner = i2c_new_client_device(adapter, &info); |
---|
| 2148 | + if (!i2c_client_has_driver(client_tuner)) |
---|
2164 | 2149 | goto frontend_detach; |
---|
2165 | 2150 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
2166 | 2151 | i2c_unregister_device(client_tuner); |
---|
.. | .. |
---|
2200 | 2185 | si2168_config.i2c_adapter = &adapter; |
---|
2201 | 2186 | si2168_config.fe = &fe0->dvb.frontend; |
---|
2202 | 2187 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2203 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
| 2188 | + strscpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
2204 | 2189 | info.addr = 0x64; |
---|
2205 | 2190 | info.platform_data = &si2168_config; |
---|
2206 | 2191 | request_module(info.type); |
---|
2207 | | - client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
2208 | | - if (client_demod == NULL || client_demod->dev.driver == NULL) |
---|
| 2192 | + client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 2193 | + if (!i2c_client_has_driver(client_demod)) |
---|
2209 | 2194 | goto frontend_detach; |
---|
2210 | 2195 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
2211 | 2196 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
2218 | 2203 | si2157_config.fe = fe0->dvb.frontend; |
---|
2219 | 2204 | si2157_config.if_port = 1; |
---|
2220 | 2205 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2221 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2206 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2222 | 2207 | info.addr = 0x60; |
---|
2223 | 2208 | info.platform_data = &si2157_config; |
---|
2224 | 2209 | request_module(info.type); |
---|
2225 | | - client_tuner = i2c_new_device(adapter, &info); |
---|
2226 | | - if (client_tuner == NULL || |
---|
2227 | | - client_tuner->dev.driver == NULL) |
---|
| 2210 | + client_tuner = i2c_new_client_device(adapter, &info); |
---|
| 2211 | + if (!i2c_client_has_driver(client_tuner)) |
---|
2228 | 2212 | goto frontend_detach; |
---|
2229 | 2213 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
2230 | 2214 | i2c_unregister_device(client_tuner); |
---|
.. | .. |
---|
2251 | 2235 | /* attach SEC */ |
---|
2252 | 2236 | a8293_pdata.dvb_frontend = fe0->dvb.frontend; |
---|
2253 | 2237 | memset(&info, 0, sizeof(info)); |
---|
2254 | | - strlcpy(info.type, "a8293", I2C_NAME_SIZE); |
---|
| 2238 | + strscpy(info.type, "a8293", I2C_NAME_SIZE); |
---|
2255 | 2239 | info.addr = 0x0b; |
---|
2256 | 2240 | info.platform_data = &a8293_pdata; |
---|
2257 | 2241 | request_module("a8293"); |
---|
2258 | | - client_sec = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
2259 | | - if (!client_sec || !client_sec->dev.driver) |
---|
| 2242 | + client_sec = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 2243 | + if (!i2c_client_has_driver(client_sec)) |
---|
2260 | 2244 | goto frontend_detach; |
---|
2261 | 2245 | if (!try_module_get(client_sec->dev.driver->owner)) { |
---|
2262 | 2246 | i2c_unregister_device(client_sec); |
---|
.. | .. |
---|
2268 | 2252 | memset(&m88rs6000t_config, 0, sizeof(m88rs6000t_config)); |
---|
2269 | 2253 | m88rs6000t_config.fe = fe0->dvb.frontend; |
---|
2270 | 2254 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2271 | | - strlcpy(info.type, "m88rs6000t", I2C_NAME_SIZE); |
---|
| 2255 | + strscpy(info.type, "m88rs6000t", I2C_NAME_SIZE); |
---|
2272 | 2256 | info.addr = 0x21; |
---|
2273 | 2257 | info.platform_data = &m88rs6000t_config; |
---|
2274 | 2258 | request_module("%s", info.type); |
---|
2275 | | - client_tuner = i2c_new_device(adapter, &info); |
---|
2276 | | - if (!client_tuner || !client_tuner->dev.driver) |
---|
| 2259 | + client_tuner = i2c_new_client_device(adapter, &info); |
---|
| 2260 | + if (!i2c_client_has_driver(client_tuner)) |
---|
2277 | 2261 | goto frontend_detach; |
---|
2278 | 2262 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
2279 | 2263 | i2c_unregister_device(client_tuner); |
---|
.. | .. |
---|
2293 | 2277 | si2168_config.fe = &fe0->dvb.frontend; |
---|
2294 | 2278 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
---|
2295 | 2279 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2296 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
| 2280 | + strscpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
2297 | 2281 | info.addr = 0x64; |
---|
2298 | 2282 | info.platform_data = &si2168_config; |
---|
2299 | 2283 | request_module("%s", info.type); |
---|
2300 | | - client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
---|
2301 | | - if (!client_demod || !client_demod->dev.driver) |
---|
| 2284 | + client_demod = i2c_new_client_device(&i2c_bus->i2c_adap, &info); |
---|
| 2285 | + if (!i2c_client_has_driver(client_demod)) |
---|
2302 | 2286 | goto frontend_detach; |
---|
2303 | 2287 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
2304 | 2288 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
2311 | 2295 | si2157_config.fe = fe0->dvb.frontend; |
---|
2312 | 2296 | si2157_config.if_port = 1; |
---|
2313 | 2297 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2314 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2298 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2315 | 2299 | info.addr = 0x60; |
---|
2316 | 2300 | info.platform_data = &si2157_config; |
---|
2317 | 2301 | request_module("%s", info.type); |
---|
2318 | | - client_tuner = i2c_new_device(&i2c_bus2->i2c_adap, &info); |
---|
2319 | | - if (!client_tuner || !client_tuner->dev.driver) { |
---|
| 2302 | + client_tuner = i2c_new_client_device(&i2c_bus2->i2c_adap, &info); |
---|
| 2303 | + if (!i2c_client_has_driver(client_tuner)) { |
---|
2320 | 2304 | module_put(client_demod->dev.driver->owner); |
---|
2321 | 2305 | i2c_unregister_device(client_demod); |
---|
2322 | 2306 | port->i2c_client_demod = NULL; |
---|
.. | .. |
---|
2330 | 2314 | goto frontend_detach; |
---|
2331 | 2315 | } |
---|
2332 | 2316 | port->i2c_client_tuner = client_tuner; |
---|
| 2317 | + |
---|
| 2318 | + dev->ts1.analog_fe.tuner_priv = client_tuner; |
---|
| 2319 | + memcpy(&dev->ts1.analog_fe.ops.tuner_ops, |
---|
| 2320 | + &fe0->dvb.frontend->ops.tuner_ops, |
---|
| 2321 | + sizeof(struct dvb_tuner_ops)); |
---|
| 2322 | + |
---|
2333 | 2323 | break; |
---|
2334 | 2324 | } |
---|
2335 | 2325 | break; |
---|
.. | .. |
---|
2346 | 2336 | si2168_config.fe = &fe0->dvb.frontend; |
---|
2347 | 2337 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
---|
2348 | 2338 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2349 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
| 2339 | + strscpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
2350 | 2340 | info.addr = 0x64; |
---|
2351 | 2341 | info.platform_data = &si2168_config; |
---|
2352 | 2342 | request_module("%s", info.type); |
---|
2353 | | - client_demod = i2c_new_device(&dev->i2c_bus[0].i2c_adap, &info); |
---|
2354 | | - if (!client_demod || !client_demod->dev.driver) |
---|
| 2343 | + client_demod = i2c_new_client_device(&dev->i2c_bus[0].i2c_adap, &info); |
---|
| 2344 | + if (!i2c_client_has_driver(client_demod)) |
---|
2355 | 2345 | goto frontend_detach; |
---|
2356 | 2346 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
2357 | 2347 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
2364 | 2354 | si2157_config.fe = fe0->dvb.frontend; |
---|
2365 | 2355 | si2157_config.if_port = 1; |
---|
2366 | 2356 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2367 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2357 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2368 | 2358 | info.addr = 0x60; |
---|
2369 | 2359 | info.platform_data = &si2157_config; |
---|
2370 | 2360 | request_module("%s", info.type); |
---|
2371 | | - client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
2372 | | - if (!client_tuner || !client_tuner->dev.driver) { |
---|
| 2361 | + client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
| 2362 | + if (!i2c_client_has_driver(client_tuner)) { |
---|
2373 | 2363 | module_put(client_demod->dev.driver->owner); |
---|
2374 | 2364 | i2c_unregister_device(client_demod); |
---|
2375 | 2365 | port->i2c_client_demod = NULL; |
---|
.. | .. |
---|
2383 | 2373 | goto frontend_detach; |
---|
2384 | 2374 | } |
---|
2385 | 2375 | port->i2c_client_tuner = client_tuner; |
---|
| 2376 | + |
---|
| 2377 | + /* we only attach tuner for analog on the 888 version */ |
---|
| 2378 | + if (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_DVB) { |
---|
| 2379 | + pr_info("%s(): QUADHD_DVB analog setup\n", |
---|
| 2380 | + __func__); |
---|
| 2381 | + dev->ts1.analog_fe.tuner_priv = client_tuner; |
---|
| 2382 | + memcpy(&dev->ts1.analog_fe.ops.tuner_ops, |
---|
| 2383 | + &fe0->dvb.frontend->ops.tuner_ops, |
---|
| 2384 | + sizeof(struct dvb_tuner_ops)); |
---|
| 2385 | + } |
---|
2386 | 2386 | break; |
---|
2387 | 2387 | |
---|
2388 | 2388 | /* port c - terrestrial/cable */ |
---|
.. | .. |
---|
2393 | 2393 | si2168_config.fe = &fe0->dvb.frontend; |
---|
2394 | 2394 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
---|
2395 | 2395 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2396 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
| 2396 | + strscpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
2397 | 2397 | info.addr = 0x66; |
---|
2398 | 2398 | info.platform_data = &si2168_config; |
---|
2399 | 2399 | request_module("%s", info.type); |
---|
2400 | | - client_demod = i2c_new_device(&dev->i2c_bus[0].i2c_adap, &info); |
---|
2401 | | - if (!client_demod || !client_demod->dev.driver) |
---|
| 2400 | + client_demod = i2c_new_client_device(&dev->i2c_bus[0].i2c_adap, &info); |
---|
| 2401 | + if (!i2c_client_has_driver(client_demod)) |
---|
2402 | 2402 | goto frontend_detach; |
---|
2403 | 2403 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
2404 | 2404 | i2c_unregister_device(client_demod); |
---|
.. | .. |
---|
2411 | 2411 | si2157_config.fe = fe0->dvb.frontend; |
---|
2412 | 2412 | si2157_config.if_port = 1; |
---|
2413 | 2413 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2414 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2414 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2415 | 2415 | info.addr = 0x62; |
---|
2416 | 2416 | info.platform_data = &si2157_config; |
---|
2417 | 2417 | request_module("%s", info.type); |
---|
2418 | | - client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
2419 | | - if (!client_tuner || !client_tuner->dev.driver) { |
---|
| 2418 | + client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
| 2419 | + if (!i2c_client_has_driver(client_tuner)) { |
---|
2420 | 2420 | module_put(client_demod->dev.driver->owner); |
---|
2421 | 2421 | i2c_unregister_device(client_demod); |
---|
2422 | 2422 | port->i2c_client_demod = NULL; |
---|
.. | .. |
---|
2453 | 2453 | si2157_config.if_port = 1; |
---|
2454 | 2454 | si2157_config.inversion = 1; |
---|
2455 | 2455 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2456 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2456 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2457 | 2457 | info.addr = 0x60; |
---|
2458 | 2458 | info.platform_data = &si2157_config; |
---|
2459 | 2459 | request_module("%s", info.type); |
---|
2460 | | - client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
2461 | | - if (!client_tuner || !client_tuner->dev.driver) { |
---|
2462 | | - module_put(client_demod->dev.driver->owner); |
---|
2463 | | - i2c_unregister_device(client_demod); |
---|
2464 | | - port->i2c_client_demod = NULL; |
---|
| 2460 | + client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
| 2461 | + if (!i2c_client_has_driver(client_tuner)) { |
---|
2465 | 2462 | goto frontend_detach; |
---|
2466 | 2463 | } |
---|
2467 | 2464 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
2468 | 2465 | i2c_unregister_device(client_tuner); |
---|
2469 | | - module_put(client_demod->dev.driver->owner); |
---|
2470 | | - i2c_unregister_device(client_demod); |
---|
2471 | | - port->i2c_client_demod = NULL; |
---|
2472 | 2466 | goto frontend_detach; |
---|
2473 | 2467 | } |
---|
2474 | 2468 | port->i2c_client_tuner = client_tuner; |
---|
| 2469 | + |
---|
| 2470 | + /* we only attach tuner for analog on the 888 version */ |
---|
| 2471 | + if (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC) { |
---|
| 2472 | + pr_info("%s(): QUADHD_ATSC analog setup\n", |
---|
| 2473 | + __func__); |
---|
| 2474 | + dev->ts1.analog_fe.tuner_priv = client_tuner; |
---|
| 2475 | + memcpy(&dev->ts1.analog_fe.ops.tuner_ops, |
---|
| 2476 | + &fe0->dvb.frontend->ops.tuner_ops, |
---|
| 2477 | + sizeof(struct dvb_tuner_ops)); |
---|
| 2478 | + } |
---|
2475 | 2479 | break; |
---|
2476 | 2480 | |
---|
2477 | 2481 | /* port c - terrestrial/cable */ |
---|
.. | .. |
---|
2489 | 2493 | si2157_config.if_port = 1; |
---|
2490 | 2494 | si2157_config.inversion = 1; |
---|
2491 | 2495 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2492 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2496 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2493 | 2497 | info.addr = 0x62; |
---|
2494 | 2498 | info.platform_data = &si2157_config; |
---|
2495 | 2499 | request_module("%s", info.type); |
---|
2496 | | - client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
2497 | | - if (!client_tuner || !client_tuner->dev.driver) { |
---|
2498 | | - module_put(client_demod->dev.driver->owner); |
---|
2499 | | - i2c_unregister_device(client_demod); |
---|
2500 | | - port->i2c_client_demod = NULL; |
---|
| 2500 | + client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
| 2501 | + if (!i2c_client_has_driver(client_tuner)) { |
---|
2501 | 2502 | goto frontend_detach; |
---|
2502 | 2503 | } |
---|
2503 | 2504 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
2504 | 2505 | i2c_unregister_device(client_tuner); |
---|
2505 | | - module_put(client_demod->dev.driver->owner); |
---|
2506 | | - i2c_unregister_device(client_demod); |
---|
2507 | | - port->i2c_client_demod = NULL; |
---|
2508 | 2506 | goto frontend_detach; |
---|
2509 | 2507 | } |
---|
2510 | 2508 | port->i2c_client_tuner = client_tuner; |
---|
.. | .. |
---|
2529 | 2527 | si2157_config.if_port = 1; |
---|
2530 | 2528 | si2157_config.inversion = 1; |
---|
2531 | 2529 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
2532 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 2530 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
2533 | 2531 | info.addr = 0x60; |
---|
2534 | 2532 | info.platform_data = &si2157_config; |
---|
2535 | 2533 | request_module("%s", info.type); |
---|
2536 | | - client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
2537 | | - if (!client_tuner || !client_tuner->dev.driver) |
---|
| 2534 | + client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
| 2535 | + if (!i2c_client_has_driver(client_tuner)) |
---|
2538 | 2536 | goto frontend_detach; |
---|
2539 | 2537 | |
---|
2540 | 2538 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
---|
.. | .. |
---|
2543 | 2541 | goto frontend_detach; |
---|
2544 | 2542 | } |
---|
2545 | 2543 | port->i2c_client_tuner = client_tuner; |
---|
| 2544 | + |
---|
| 2545 | + dev->ts1.analog_fe.tuner_priv = client_tuner; |
---|
| 2546 | + memcpy(&dev->ts1.analog_fe.ops.tuner_ops, |
---|
| 2547 | + &fe0->dvb.frontend->ops.tuner_ops, |
---|
| 2548 | + sizeof(struct dvb_tuner_ops)); |
---|
2546 | 2549 | break; |
---|
2547 | 2550 | } |
---|
2548 | 2551 | break; |
---|
.. | .. |
---|
2656 | 2659 | dev->name, |
---|
2657 | 2660 | dev->pci_bus, |
---|
2658 | 2661 | dev->pci_slot); |
---|
2659 | | - |
---|
2660 | | - err = -ENODEV; |
---|
2661 | 2662 | |
---|
2662 | 2663 | /* dvb stuff */ |
---|
2663 | 2664 | /* We have to init the queue for each frontend on a port. */ |
---|