@@ -171,6 +171,7 @@ nvlink_lib_is_registerd_device_with_reduced_config(void)
171171{
172172 NvlStatus lock_status = NVL_SUCCESS ;
173173 nvlink_device * dev = NULL ;
174+ NvBool bIsReducedConfg = NV_FALSE ;
174175
175176 // Acquire top-level lock
176177 lock_status = nvlink_lib_top_lock_acquire ();
@@ -187,58 +188,13 @@ nvlink_lib_is_registerd_device_with_reduced_config(void)
187188 {
188189 if (dev -> bReducedNvlinkConfig == NV_TRUE )
189190 {
190- return NV_TRUE ;
191+ bIsReducedConfg = NV_TRUE ;
192+ break ;
191193 }
192194 }
193195
194- // Release and free top-level lock
196+ // Release top-level lock
195197 nvlink_lib_top_lock_release ();
196- nvlink_lib_top_lock_free ();
197198
198- return NV_FALSE ;
199- }
200-
201- /*
202- * Get the number of devices that have the device type deviceType
203- */
204- NvlStatus
205- nvlink_lib_return_device_count_by_type
206- (
207- NvU32 deviceType ,
208- NvU32 * numDevices
209- )
210- {
211- NvlStatus lock_status = NVL_SUCCESS ;
212- nvlink_device * dev = NULL ;
213- NvU32 device_count = 0 ;
214-
215- if (nvlink_lib_is_initialized ())
216- {
217- // Acquire top-level lock
218- lock_status = nvlink_lib_top_lock_acquire ();
219- if (lock_status != NVL_SUCCESS )
220- {
221- NVLINK_PRINT ((DBG_MODULE_NVLINK_CORE , NVLINK_DBG_LEVEL_ERRORS ,
222- "%s: Failed to acquire top-level lock\n" ,
223- __FUNCTION__ ));
224-
225- return lock_status ;
226- }
227-
228- // Top-level lock is now acquired
229-
230- // Loop through device list
231- FOR_EACH_DEVICE_REGISTERED (dev , nvlinkLibCtx .nv_devicelist_head , node )
232- {
233- if (dev -> type == deviceType )
234- {
235- device_count ++ ;
236- }
237- }
238-
239- // Release top-level lock
240- nvlink_lib_top_lock_release ();
241- }
242- * numDevices = device_count ;
243- return NVL_SUCCESS ;
199+ return bIsReducedConfg ;
244200}
0 commit comments