@@ -2463,11 +2463,8 @@ static int qmp_combo_com_init(struct qmp_combo *qmp)
2463
2463
void __iomem * com = qmp -> com ;
2464
2464
int ret ;
2465
2465
2466
- mutex_lock (& qmp -> phy_mutex );
2467
- if (qmp -> init_count ++ ) {
2468
- mutex_unlock (& qmp -> phy_mutex );
2466
+ if (qmp -> init_count ++ )
2469
2467
return 0 ;
2470
- }
2471
2468
2472
2469
ret = regulator_bulk_enable (cfg -> num_vregs , qmp -> vregs );
2473
2470
if (ret ) {
@@ -2514,8 +2511,6 @@ static int qmp_combo_com_init(struct qmp_combo *qmp)
2514
2511
qphy_setbits (qmp -> pcs , cfg -> regs [QPHY_PCS_POWER_DOWN_CONTROL ],
2515
2512
SW_PWRDN );
2516
2513
2517
- mutex_unlock (& qmp -> phy_mutex );
2518
-
2519
2514
return 0 ;
2520
2515
2521
2516
err_assert_reset :
@@ -2524,7 +2519,6 @@ static int qmp_combo_com_init(struct qmp_combo *qmp)
2524
2519
regulator_bulk_disable (cfg -> num_vregs , qmp -> vregs );
2525
2520
err_decrement_count :
2526
2521
qmp -> init_count -- ;
2527
- mutex_unlock (& qmp -> phy_mutex );
2528
2522
2529
2523
return ret ;
2530
2524
}
@@ -2533,20 +2527,15 @@ static int qmp_combo_com_exit(struct qmp_combo *qmp)
2533
2527
{
2534
2528
const struct qmp_phy_cfg * cfg = qmp -> cfg ;
2535
2529
2536
- mutex_lock (& qmp -> phy_mutex );
2537
- if (-- qmp -> init_count ) {
2538
- mutex_unlock (& qmp -> phy_mutex );
2530
+ if (-- qmp -> init_count )
2539
2531
return 0 ;
2540
- }
2541
2532
2542
2533
reset_control_bulk_assert (cfg -> num_resets , qmp -> resets );
2543
2534
2544
2535
clk_bulk_disable_unprepare (cfg -> num_clks , qmp -> clks );
2545
2536
2546
2537
regulator_bulk_disable (cfg -> num_vregs , qmp -> vregs );
2547
2538
2548
- mutex_unlock (& qmp -> phy_mutex );
2549
-
2550
2539
return 0 ;
2551
2540
}
2552
2541
@@ -2556,21 +2545,29 @@ static int qmp_combo_dp_init(struct phy *phy)
2556
2545
const struct qmp_phy_cfg * cfg = qmp -> cfg ;
2557
2546
int ret ;
2558
2547
2548
+ mutex_lock (& qmp -> phy_mutex );
2549
+
2559
2550
ret = qmp_combo_com_init (qmp );
2560
2551
if (ret )
2561
- return ret ;
2552
+ goto out_unlock ;
2562
2553
2563
2554
cfg -> dp_aux_init (qmp );
2564
2555
2565
- return 0 ;
2556
+ out_unlock :
2557
+ mutex_unlock (& qmp -> phy_mutex );
2558
+ return ret ;
2566
2559
}
2567
2560
2568
2561
static int qmp_combo_dp_exit (struct phy * phy )
2569
2562
{
2570
2563
struct qmp_combo * qmp = phy_get_drvdata (phy );
2571
2564
2565
+ mutex_lock (& qmp -> phy_mutex );
2566
+
2572
2567
qmp_combo_com_exit (qmp );
2573
2568
2569
+ mutex_unlock (& qmp -> phy_mutex );
2570
+
2574
2571
return 0 ;
2575
2572
}
2576
2573
@@ -2687,14 +2684,19 @@ static int qmp_combo_usb_init(struct phy *phy)
2687
2684
struct qmp_combo * qmp = phy_get_drvdata (phy );
2688
2685
int ret ;
2689
2686
2687
+ mutex_lock (& qmp -> phy_mutex );
2690
2688
ret = qmp_combo_com_init (qmp );
2691
2689
if (ret )
2692
- return ret ;
2690
+ goto out_unlock ;
2693
2691
2694
2692
ret = qmp_combo_usb_power_on (phy );
2695
- if (ret )
2693
+ if (ret ) {
2696
2694
qmp_combo_com_exit (qmp );
2695
+ goto out_unlock ;
2696
+ }
2697
2697
2698
+ out_unlock :
2699
+ mutex_unlock (& qmp -> phy_mutex );
2698
2700
return ret ;
2699
2701
}
2700
2702
@@ -2703,11 +2705,18 @@ static int qmp_combo_usb_exit(struct phy *phy)
2703
2705
struct qmp_combo * qmp = phy_get_drvdata (phy );
2704
2706
int ret ;
2705
2707
2708
+ mutex_lock (& qmp -> phy_mutex );
2706
2709
ret = qmp_combo_usb_power_off (phy );
2707
2710
if (ret )
2708
- return ret ;
2711
+ goto out_unlock ;
2709
2712
2710
- return qmp_combo_com_exit (qmp );
2713
+ ret = qmp_combo_com_exit (qmp );
2714
+ if (ret )
2715
+ goto out_unlock ;
2716
+
2717
+ out_unlock :
2718
+ mutex_unlock (& qmp -> phy_mutex );
2719
+ return ret ;
2711
2720
}
2712
2721
2713
2722
static int qmp_combo_usb_set_mode (struct phy * phy , enum phy_mode mode , int submode )
0 commit comments