@@ -37,20 +37,15 @@ static bool hnae3_client_match(enum hnae3_client_type client_type,
37
37
}
38
38
39
39
static int hnae3_match_n_instantiate (struct hnae3_client * client ,
40
- struct hnae3_ae_dev * ae_dev ,
41
- bool is_reg , bool * matched )
40
+ struct hnae3_ae_dev * ae_dev , bool is_reg )
42
41
{
43
42
int ret ;
44
43
45
- * matched = false;
46
-
47
44
/* check if this client matches the type of ae_dev */
48
45
if (!(hnae3_client_match (client -> type , ae_dev -> dev_type ) &&
49
46
hnae_get_bit (ae_dev -> flag , HNAE3_DEV_INITED_B ))) {
50
47
return 0 ;
51
48
}
52
- /* there is a match of client and dev */
53
- * matched = true;
54
49
55
50
/* now, (un-)instantiate client by calling lower layer */
56
51
if (is_reg ) {
@@ -69,7 +64,6 @@ int hnae3_register_client(struct hnae3_client *client)
69
64
{
70
65
struct hnae3_client * client_tmp ;
71
66
struct hnae3_ae_dev * ae_dev ;
72
- bool matched ;
73
67
int ret = 0 ;
74
68
75
69
mutex_lock (& hnae3_common_lock );
@@ -86,7 +80,7 @@ int hnae3_register_client(struct hnae3_client *client)
86
80
/* if the client could not be initialized on current port, for
87
81
* any error reasons, move on to next available port
88
82
*/
89
- ret = hnae3_match_n_instantiate (client , ae_dev , true, & matched );
83
+ ret = hnae3_match_n_instantiate (client , ae_dev , true);
90
84
if (ret )
91
85
dev_err (& ae_dev -> pdev -> dev ,
92
86
"match and instantiation failed for port\n" );
@@ -102,12 +96,11 @@ EXPORT_SYMBOL(hnae3_register_client);
102
96
void hnae3_unregister_client (struct hnae3_client * client )
103
97
{
104
98
struct hnae3_ae_dev * ae_dev ;
105
- bool matched ;
106
99
107
100
mutex_lock (& hnae3_common_lock );
108
101
/* un-initialize the client on every matched port */
109
102
list_for_each_entry (ae_dev , & hnae3_ae_dev_list , node ) {
110
- hnae3_match_n_instantiate (client , ae_dev , false, & matched );
103
+ hnae3_match_n_instantiate (client , ae_dev , false);
111
104
}
112
105
113
106
list_del (& client -> node );
@@ -124,7 +117,6 @@ int hnae3_register_ae_algo(struct hnae3_ae_algo *ae_algo)
124
117
const struct pci_device_id * id ;
125
118
struct hnae3_ae_dev * ae_dev ;
126
119
struct hnae3_client * client ;
127
- bool matched ;
128
120
int ret = 0 ;
129
121
130
122
mutex_lock (& hnae3_common_lock );
@@ -151,13 +143,10 @@ int hnae3_register_ae_algo(struct hnae3_ae_algo *ae_algo)
151
143
* initialize the figure out client instance
152
144
*/
153
145
list_for_each_entry (client , & hnae3_client_list , node ) {
154
- ret = hnae3_match_n_instantiate (client , ae_dev , true,
155
- & matched );
146
+ ret = hnae3_match_n_instantiate (client , ae_dev , true);
156
147
if (ret )
157
148
dev_err (& ae_dev -> pdev -> dev ,
158
149
"match and instantiation failed\n" );
159
- if (matched )
160
- break ;
161
150
}
162
151
}
163
152
@@ -175,7 +164,6 @@ void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo)
175
164
const struct pci_device_id * id ;
176
165
struct hnae3_ae_dev * ae_dev ;
177
166
struct hnae3_client * client ;
178
- bool matched ;
179
167
180
168
mutex_lock (& hnae3_common_lock );
181
169
/* Check if there are matched ae_dev */
@@ -187,12 +175,8 @@ void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo)
187
175
/* check the client list for the match with this ae_dev type and
188
176
* un-initialize the figure out client instance
189
177
*/
190
- list_for_each_entry (client , & hnae3_client_list , node ) {
191
- hnae3_match_n_instantiate (client , ae_dev , false,
192
- & matched );
193
- if (matched )
194
- break ;
195
- }
178
+ list_for_each_entry (client , & hnae3_client_list , node )
179
+ hnae3_match_n_instantiate (client , ae_dev , false);
196
180
197
181
ae_algo -> ops -> uninit_ae_dev (ae_dev );
198
182
hnae_set_bit (ae_dev -> flag , HNAE3_DEV_INITED_B , 0 );
@@ -212,7 +196,6 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
212
196
const struct pci_device_id * id ;
213
197
struct hnae3_ae_algo * ae_algo ;
214
198
struct hnae3_client * client ;
215
- bool matched ;
216
199
int ret = 0 ;
217
200
218
201
mutex_lock (& hnae3_common_lock );
@@ -246,13 +229,10 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
246
229
* initialize the figure out client instance
247
230
*/
248
231
list_for_each_entry (client , & hnae3_client_list , node ) {
249
- ret = hnae3_match_n_instantiate (client , ae_dev , true,
250
- & matched );
232
+ ret = hnae3_match_n_instantiate (client , ae_dev , true);
251
233
if (ret )
252
234
dev_err (& ae_dev -> pdev -> dev ,
253
235
"match and instantiation failed\n" );
254
- if (matched )
255
- break ;
256
236
}
257
237
258
238
out_err :
@@ -270,7 +250,6 @@ void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev)
270
250
const struct pci_device_id * id ;
271
251
struct hnae3_ae_algo * ae_algo ;
272
252
struct hnae3_client * client ;
273
- bool matched ;
274
253
275
254
mutex_lock (& hnae3_common_lock );
276
255
/* Check if there are matched ae_algo */
@@ -279,12 +258,8 @@ void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev)
279
258
if (!id )
280
259
continue ;
281
260
282
- list_for_each_entry (client , & hnae3_client_list , node ) {
283
- hnae3_match_n_instantiate (client , ae_dev , false,
284
- & matched );
285
- if (matched )
286
- break ;
287
- }
261
+ list_for_each_entry (client , & hnae3_client_list , node )
262
+ hnae3_match_n_instantiate (client , ae_dev , false);
288
263
289
264
ae_algo -> ops -> uninit_ae_dev (ae_dev );
290
265
hnae_set_bit (ae_dev -> flag , HNAE3_DEV_INITED_B , 0 );
0 commit comments