@@ -1076,7 +1076,7 @@ static int _opp_set_required_opps_genpd(struct device *dev,
1076
1076
{
1077
1077
struct device * * genpd_virt_devs =
1078
1078
opp_table -> genpd_virt_devs ? opp_table -> genpd_virt_devs : & dev ;
1079
- int index , target , delta , ret = 0 ;
1079
+ int index , target , delta , ret ;
1080
1080
1081
1081
/* Scaling up? Set required OPPs in normal order, else reverse */
1082
1082
if (!scaling_down ) {
@@ -1089,23 +1089,15 @@ static int _opp_set_required_opps_genpd(struct device *dev,
1089
1089
delta = -1 ;
1090
1090
}
1091
1091
1092
- /*
1093
- * Acquire genpd_virt_dev_lock to make sure we don't use a genpd_dev
1094
- * after it is freed from another thread.
1095
- */
1096
- mutex_lock (& opp_table -> genpd_virt_dev_lock );
1097
-
1098
1092
while (index != target ) {
1099
1093
ret = _set_performance_state (dev , genpd_virt_devs [index ], opp , index );
1100
1094
if (ret )
1101
- break ;
1095
+ return ret ;
1102
1096
1103
1097
index += delta ;
1104
1098
}
1105
1099
1106
- mutex_unlock (& opp_table -> genpd_virt_dev_lock );
1107
-
1108
- return ret ;
1100
+ return 0 ;
1109
1101
}
1110
1102
1111
1103
/* This is only called for PM domain for now */
@@ -1474,7 +1466,6 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
1474
1466
return ERR_PTR (- ENOMEM );
1475
1467
1476
1468
mutex_init (& opp_table -> lock );
1477
- mutex_init (& opp_table -> genpd_virt_dev_lock );
1478
1469
INIT_LIST_HEAD (& opp_table -> dev_list );
1479
1470
INIT_LIST_HEAD (& opp_table -> lazy );
1480
1471
@@ -1510,7 +1501,6 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
1510
1501
remove_opp_dev :
1511
1502
_of_clear_opp_table (opp_table );
1512
1503
_remove_opp_dev (opp_dev , opp_table );
1513
- mutex_destroy (& opp_table -> genpd_virt_dev_lock );
1514
1504
mutex_destroy (& opp_table -> lock );
1515
1505
err :
1516
1506
kfree (opp_table );
@@ -1678,7 +1668,6 @@ static void _opp_table_kref_release(struct kref *kref)
1678
1668
list_for_each_entry_safe (opp_dev , temp , & opp_table -> dev_list , node )
1679
1669
_remove_opp_dev (opp_dev , opp_table );
1680
1670
1681
- mutex_destroy (& opp_table -> genpd_virt_dev_lock );
1682
1671
mutex_destroy (& opp_table -> lock );
1683
1672
kfree (opp_table );
1684
1673
}
@@ -2395,7 +2384,7 @@ static void _opp_put_config_regulators_helper(struct opp_table *opp_table)
2395
2384
opp_table -> config_regulators = NULL ;
2396
2385
}
2397
2386
2398
- static void _detach_genpd (struct opp_table * opp_table )
2387
+ static void _opp_detach_genpd (struct opp_table * opp_table )
2399
2388
{
2400
2389
int index ;
2401
2390
@@ -2449,13 +2438,11 @@ static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev,
2449
2438
if (!opp_table -> required_opp_count )
2450
2439
return - EPROBE_DEFER ;
2451
2440
2452
- mutex_lock (& opp_table -> genpd_virt_dev_lock );
2453
-
2454
2441
opp_table -> genpd_virt_devs = kcalloc (opp_table -> required_opp_count ,
2455
2442
sizeof (* opp_table -> genpd_virt_devs ),
2456
2443
GFP_KERNEL );
2457
2444
if (!opp_table -> genpd_virt_devs )
2458
- goto unlock ;
2445
+ return - ENOMEM ;
2459
2446
2460
2447
while (* name ) {
2461
2448
if (index >= opp_table -> required_opp_count ) {
@@ -2478,29 +2465,15 @@ static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev,
2478
2465
2479
2466
if (virt_devs )
2480
2467
* virt_devs = opp_table -> genpd_virt_devs ;
2481
- mutex_unlock (& opp_table -> genpd_virt_dev_lock );
2482
2468
2483
2469
return 0 ;
2484
2470
2485
2471
err :
2486
- _detach_genpd (opp_table );
2487
- unlock :
2488
- mutex_unlock (& opp_table -> genpd_virt_dev_lock );
2472
+ _opp_detach_genpd (opp_table );
2489
2473
return ret ;
2490
2474
2491
2475
}
2492
2476
2493
- static void _opp_detach_genpd (struct opp_table * opp_table )
2494
- {
2495
- /*
2496
- * Acquire genpd_virt_dev_lock to make sure virt_dev isn't getting
2497
- * used in parallel.
2498
- */
2499
- mutex_lock (& opp_table -> genpd_virt_dev_lock );
2500
- _detach_genpd (opp_table );
2501
- mutex_unlock (& opp_table -> genpd_virt_dev_lock );
2502
- }
2503
-
2504
2477
static void _opp_clear_config (struct opp_config_data * data )
2505
2478
{
2506
2479
if (data -> flags & OPP_CONFIG_GENPD )
0 commit comments