@@ -1355,25 +1355,23 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream,
1355
1355
return - EINVAL ;
1356
1356
}
1357
1357
1358
- if (!update_params )
1359
- goto program_params ;
1360
-
1361
- /* Increment cumulative bus bandwidth */
1362
- /* TODO: Update this during Device-Device support */
1363
- bus -> params .bandwidth += m_rt -> stream -> params .rate *
1364
- m_rt -> ch_count * m_rt -> stream -> params .bps ;
1365
-
1366
- /* Compute params */
1367
- if (bus -> compute_params ) {
1368
- ret = bus -> compute_params (bus );
1369
- if (ret < 0 ) {
1370
- dev_err (bus -> dev , "Compute params failed: %d\n" ,
1371
- ret );
1372
- goto restore_params ;
1358
+ if (update_params ) {
1359
+ /* Increment cumulative bus bandwidth */
1360
+ /* TODO: Update this during Device-Device support */
1361
+ bus -> params .bandwidth += m_rt -> stream -> params .rate *
1362
+ m_rt -> ch_count * m_rt -> stream -> params .bps ;
1363
+
1364
+ /* Compute params */
1365
+ if (bus -> compute_params ) {
1366
+ ret = bus -> compute_params (bus );
1367
+ if (ret < 0 ) {
1368
+ dev_err (bus -> dev , "Compute params failed: %d\n" ,
1369
+ ret );
1370
+ goto restore_params ;
1371
+ }
1373
1372
}
1374
1373
}
1375
1374
1376
- program_params :
1377
1375
/* Program params */
1378
1376
ret = sdw_program_params (bus , true);
1379
1377
if (ret < 0 ) {
@@ -1876,30 +1874,25 @@ int sdw_stream_add_master(struct sdw_bus *bus,
1876
1874
* it first), if so skip allocation and go to configuration
1877
1875
*/
1878
1876
m_rt = sdw_master_rt_find (bus , stream );
1879
- if (m_rt )
1880
- goto skip_alloc_master_rt ;
1881
-
1882
- m_rt = sdw_master_rt_alloc (bus , stream );
1883
1877
if (!m_rt ) {
1884
- dev_err (bus -> dev , "%s: Master runtime alloc failed for stream:%s\n" ,
1885
- __func__ , stream -> name );
1886
- ret = - ENOMEM ;
1887
- goto unlock ;
1888
- }
1889
-
1890
- alloc_master_rt = true;
1891
- skip_alloc_master_rt :
1892
-
1893
- if (sdw_master_port_allocated (m_rt ))
1894
- goto skip_alloc_master_port ;
1878
+ m_rt = sdw_master_rt_alloc (bus , stream );
1879
+ if (!m_rt ) {
1880
+ dev_err (bus -> dev , "%s: Master runtime alloc failed for stream:%s\n" ,
1881
+ __func__ , stream -> name );
1882
+ ret = - ENOMEM ;
1883
+ goto unlock ;
1884
+ }
1895
1885
1896
- ret = sdw_master_port_alloc (m_rt , num_ports );
1897
- if (ret )
1898
- goto alloc_error ;
1886
+ alloc_master_rt = true;
1887
+ }
1899
1888
1900
- stream -> m_rt_count ++ ;
1889
+ if (!sdw_master_port_allocated (m_rt )) {
1890
+ ret = sdw_master_port_alloc (m_rt , num_ports );
1891
+ if (ret )
1892
+ goto alloc_error ;
1901
1893
1902
- skip_alloc_master_port :
1894
+ stream -> m_rt_count ++ ;
1895
+ }
1903
1896
1904
1897
ret = sdw_master_rt_config (m_rt , stream_config );
1905
1898
if (ret < 0 )
@@ -1992,46 +1985,41 @@ int sdw_stream_add_slave(struct sdw_slave *slave,
1992
1985
* and go to configuration
1993
1986
*/
1994
1987
m_rt = sdw_master_rt_find (slave -> bus , stream );
1995
- if (m_rt )
1996
- goto skip_alloc_master_rt ;
1997
-
1998
- /*
1999
- * If this API is invoked by Slave first then m_rt is not valid.
2000
- * So, allocate m_rt and add Slave to it.
2001
- */
2002
- m_rt = sdw_master_rt_alloc (slave -> bus , stream );
2003
1988
if (!m_rt ) {
2004
- dev_err (& slave -> dev , "%s: Master runtime alloc failed for stream:%s\n" ,
2005
- __func__ , stream -> name );
2006
- ret = - ENOMEM ;
2007
- goto unlock ;
2008
- }
1989
+ /*
1990
+ * If this API is invoked by Slave first then m_rt is not valid.
1991
+ * So, allocate m_rt and add Slave to it.
1992
+ */
1993
+ m_rt = sdw_master_rt_alloc (slave -> bus , stream );
1994
+ if (!m_rt ) {
1995
+ dev_err (& slave -> dev , "%s: Master runtime alloc failed for stream:%s\n" ,
1996
+ __func__ , stream -> name );
1997
+ ret = - ENOMEM ;
1998
+ goto unlock ;
1999
+ }
2009
2000
2010
- alloc_master_rt = true;
2001
+ alloc_master_rt = true;
2002
+ }
2011
2003
2012
- skip_alloc_master_rt :
2013
2004
s_rt = sdw_slave_rt_find (slave , stream );
2014
- if (s_rt )
2015
- goto skip_alloc_slave_rt ;
2016
-
2017
- s_rt = sdw_slave_rt_alloc (slave , m_rt );
2018
2005
if (!s_rt ) {
2019
- dev_err (& slave -> dev , "Slave runtime alloc failed for stream:%s\n" , stream -> name );
2020
- ret = - ENOMEM ;
2021
- goto alloc_error ;
2022
- }
2023
-
2024
- alloc_slave_rt = true;
2006
+ s_rt = sdw_slave_rt_alloc (slave , m_rt );
2007
+ if (!s_rt ) {
2008
+ dev_err (& slave -> dev , "Slave runtime alloc failed for stream:%s\n" ,
2009
+ stream -> name );
2010
+ ret = - ENOMEM ;
2011
+ goto alloc_error ;
2012
+ }
2025
2013
2026
- skip_alloc_slave_rt :
2027
- if (sdw_slave_port_allocated (s_rt ))
2028
- goto skip_port_alloc ;
2014
+ alloc_slave_rt = true;
2015
+ }
2029
2016
2030
- ret = sdw_slave_port_alloc (slave , s_rt , num_ports );
2031
- if (ret )
2032
- goto alloc_error ;
2017
+ if (!sdw_slave_port_allocated (s_rt )) {
2018
+ ret = sdw_slave_port_alloc (slave , s_rt , num_ports );
2019
+ if (ret )
2020
+ goto alloc_error ;
2021
+ }
2033
2022
2034
- skip_port_alloc :
2035
2023
ret = sdw_master_rt_config (m_rt , stream_config );
2036
2024
if (ret )
2037
2025
goto unlock ;
0 commit comments