@@ -70,38 +70,6 @@ struct ipa_power {
70
70
struct icc_bulk_data * interconnect ;
71
71
};
72
72
73
- static int ipa_interconnect_init_one (struct device * dev ,
74
- struct icc_bulk_data * interconnect ,
75
- const struct ipa_interconnect_data * data )
76
- {
77
- int ret ;
78
-
79
- /* interconnect->path is filled in by of_icc_bulk_get() */
80
- interconnect -> name = data -> name ;
81
- interconnect -> avg_bw = data -> average_bandwidth ;
82
- interconnect -> peak_bw = data -> peak_bandwidth ;
83
-
84
- ret = of_icc_bulk_get (dev , 1 , interconnect );
85
- if (ret )
86
- return ret ;
87
-
88
- /* All interconnects are initially disabled */
89
- icc_bulk_disable (1 , interconnect );
90
-
91
- /* Set the bandwidth values to be used when enabled */
92
- ret = icc_bulk_set_bw (1 , interconnect );
93
- if (ret )
94
- icc_bulk_put (1 , interconnect );
95
-
96
- return ret ;
97
- }
98
-
99
- static void ipa_interconnect_exit_one (struct icc_bulk_data * interconnect )
100
- {
101
- icc_bulk_put (1 , interconnect );
102
- memset (interconnect , 0 , sizeof (* interconnect ));
103
- }
104
-
105
73
/* Initialize interconnects required for IPA operation */
106
74
static int ipa_interconnect_init (struct ipa_power * power , struct device * dev ,
107
75
const struct ipa_interconnect_data * data )
@@ -116,18 +84,34 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
116
84
return - ENOMEM ;
117
85
power -> interconnect = interconnect ;
118
86
87
+ /* Initialize our interconnect data array for bulk operations */
119
88
while (count -- ) {
120
- ret = ipa_interconnect_init_one (dev , interconnect , data ++ );
121
- if (ret )
122
- goto out_unwind ;
89
+ /* interconnect->path is filled in by of_icc_bulk_get() */
90
+ interconnect -> name = data -> name ;
91
+ interconnect -> avg_bw = data -> average_bandwidth ;
92
+ interconnect -> peak_bw = data -> peak_bandwidth ;
93
+ data ++ ;
123
94
interconnect ++ ;
124
95
}
125
96
97
+ ret = of_icc_bulk_get (dev , power -> interconnect_count ,
98
+ power -> interconnect );
99
+ if (ret )
100
+ goto err_free ;
101
+
102
+ /* All interconnects are initially disabled */
103
+ icc_bulk_disable (power -> interconnect_count , power -> interconnect );
104
+
105
+ /* Set the bandwidth values to be used when enabled */
106
+ ret = icc_bulk_set_bw (power -> interconnect_count , power -> interconnect );
107
+ if (ret )
108
+ goto err_bulk_put ;
109
+
126
110
return 0 ;
127
111
128
- out_unwind :
129
- while ( interconnect -- > power -> interconnect )
130
- ipa_interconnect_exit_one ( interconnect );
112
+ err_bulk_put :
113
+ icc_bulk_put ( power -> interconnect_count , power -> interconnect );
114
+ err_free :
131
115
kfree (power -> interconnect );
132
116
power -> interconnect = NULL ;
133
117
@@ -137,11 +121,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
137
121
/* Inverse of ipa_interconnect_init() */
138
122
static void ipa_interconnect_exit (struct ipa_power * power )
139
123
{
140
- struct icc_bulk_data * interconnect ;
141
-
142
- interconnect = power -> interconnect + power -> interconnect_count ;
143
- while (interconnect -- > power -> interconnect )
144
- ipa_interconnect_exit_one (interconnect );
124
+ icc_bulk_put (power -> interconnect_count , power -> interconnect );
145
125
kfree (power -> interconnect );
146
126
power -> interconnect = NULL ;
147
127
}
0 commit comments