@@ -3009,6 +3009,37 @@ static bool ath10k_pci_chip_is_supported(u32 dev_id, u32 chip_id)
3009
3009
return false;
3010
3010
}
3011
3011
3012
+ int ath10k_pci_setup_resource (struct ath10k * ar )
3013
+ {
3014
+ struct ath10k_pci * ar_pci = ath10k_pci_priv (ar );
3015
+ int ret ;
3016
+
3017
+ spin_lock_init (& ar_pci -> ce_lock );
3018
+ spin_lock_init (& ar_pci -> ps_lock );
3019
+
3020
+ setup_timer (& ar_pci -> rx_post_retry , ath10k_pci_rx_replenish_retry ,
3021
+ (unsigned long )ar );
3022
+
3023
+ if (QCA_REV_6174 (ar ))
3024
+ ath10k_pci_override_ce_config (ar );
3025
+
3026
+ ret = ath10k_pci_alloc_pipes (ar );
3027
+ if (ret ) {
3028
+ ath10k_err (ar , "failed to allocate copy engine pipes: %d\n" ,
3029
+ ret );
3030
+ return ret ;
3031
+ }
3032
+
3033
+ return 0 ;
3034
+ }
3035
+
3036
+ void ath10k_pci_release_resource (struct ath10k * ar )
3037
+ {
3038
+ ath10k_pci_kill_tasklet (ar );
3039
+ ath10k_pci_ce_deinit (ar );
3040
+ ath10k_pci_free_pipes (ar );
3041
+ }
3042
+
3012
3043
static const struct ath10k_bus_ops ath10k_pci_bus_ops = {
3013
3044
.read32 = ath10k_bus_pci_read32 ,
3014
3045
.write32 = ath10k_bus_pci_write32 ,
@@ -3072,34 +3103,25 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3072
3103
ar -> id .subsystem_vendor = pdev -> subsystem_vendor ;
3073
3104
ar -> id .subsystem_device = pdev -> subsystem_device ;
3074
3105
3075
- spin_lock_init (& ar_pci -> ce_lock );
3076
- spin_lock_init (& ar_pci -> ps_lock );
3077
-
3078
- setup_timer (& ar_pci -> rx_post_retry , ath10k_pci_rx_replenish_retry ,
3079
- (unsigned long )ar );
3080
3106
setup_timer (& ar_pci -> ps_timer , ath10k_pci_ps_timer ,
3081
3107
(unsigned long )ar );
3082
3108
3083
- ret = ath10k_pci_claim (ar );
3109
+ ret = ath10k_pci_setup_resource (ar );
3084
3110
if (ret ) {
3085
- ath10k_err (ar , "failed to claim device : %d\n" , ret );
3111
+ ath10k_err (ar , "failed to setup resource : %d\n" , ret );
3086
3112
goto err_core_destroy ;
3087
3113
}
3088
3114
3089
- if (QCA_REV_6174 (ar ))
3090
- ath10k_pci_override_ce_config (ar );
3091
-
3092
- ret = ath10k_pci_alloc_pipes (ar );
3115
+ ret = ath10k_pci_claim (ar );
3093
3116
if (ret ) {
3094
- ath10k_err (ar , "failed to allocate copy engine pipes: %d\n" ,
3095
- ret );
3096
- goto err_sleep ;
3117
+ ath10k_err (ar , "failed to claim device: %d\n" , ret );
3118
+ goto err_free_pipes ;
3097
3119
}
3098
3120
3099
3121
ret = ath10k_pci_force_wake (ar );
3100
3122
if (ret ) {
3101
3123
ath10k_warn (ar , "failed to wake up device : %d\n" , ret );
3102
- goto err_free_pipes ;
3124
+ goto err_sleep ;
3103
3125
}
3104
3126
3105
3127
ath10k_pci_ce_deinit (ar );
@@ -3108,7 +3130,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3108
3130
ret = ath10k_pci_init_irq (ar );
3109
3131
if (ret ) {
3110
3132
ath10k_err (ar , "failed to init irqs: %d\n" , ret );
3111
- goto err_free_pipes ;
3133
+ goto err_sleep ;
3112
3134
}
3113
3135
3114
3136
ath10k_info (ar , "pci irq %s interrupts %d irq_mode %d reset_mode %d\n" ,
@@ -3154,13 +3176,13 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3154
3176
err_deinit_irq :
3155
3177
ath10k_pci_deinit_irq (ar );
3156
3178
3157
- err_free_pipes :
3158
- ath10k_pci_free_pipes (ar );
3159
-
3160
3179
err_sleep :
3161
3180
ath10k_pci_sleep_sync (ar );
3162
3181
ath10k_pci_release (ar );
3163
3182
3183
+ err_free_pipes :
3184
+ ath10k_pci_free_pipes (ar );
3185
+
3164
3186
err_core_destroy :
3165
3187
ath10k_core_destroy (ar );
3166
3188
@@ -3184,10 +3206,8 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
3184
3206
3185
3207
ath10k_core_unregister (ar );
3186
3208
ath10k_pci_free_irq (ar );
3187
- ath10k_pci_kill_tasklet (ar );
3188
3209
ath10k_pci_deinit_irq (ar );
3189
- ath10k_pci_ce_deinit (ar );
3190
- ath10k_pci_free_pipes (ar );
3210
+ ath10k_pci_release_resource (ar );
3191
3211
ath10k_pci_sleep_sync (ar );
3192
3212
ath10k_pci_release (ar );
3193
3213
ath10k_core_destroy (ar );
0 commit comments