@@ -715,28 +715,18 @@ NV_STATUS NV_API_CALL nv_acpi_ddc_method(
715715)
716716{
717717 acpi_status status ;
718- struct acpi_device * device = NULL ;
719718 union acpi_object * ddc = NULL ;
720- struct list_head * node , * next ;
721719 NvU32 i , largestEdidSize ;
722720 acpi_handle dev_handle = NULL ;
723721 acpi_handle lcd_dev_handle = NULL ;
722+ acpi_handle handle = NULL ;
724723
725724 if (!nv_acpi_get_device_handle (nv , & dev_handle ))
726725 return NV_ERR_NOT_SUPPORTED ;
727726
728727 if (!dev_handle )
729728 return NV_ERR_INVALID_ARGUMENT ;
730729
731- #if defined(NV_ACPI_BUS_GET_DEVICE_PRESENT )
732- status = acpi_bus_get_device (dev_handle , & device );
733- #else
734- return NV_ERR_NOT_SUPPORTED ;
735- #endif
736-
737- if (ACPI_FAILURE (status ) || !device )
738- return NV_ERR_INVALID_ARGUMENT ;
739-
740730 if (!NV_MAY_SLEEP ())
741731 {
742732#if defined(DEBUG )
@@ -747,16 +737,16 @@ NV_STATUS NV_API_CALL nv_acpi_ddc_method(
747737 return NV_ERR_NOT_SUPPORTED ;
748738 }
749739
750- list_for_each_safe ( node , next , & device -> children )
740+ while ( lcd_dev_handle == NULL )
751741 {
752742 unsigned long long device_id = 0 ;
753- struct acpi_device * dev =
754- list_entry (node , struct acpi_device , node );
755743
756- if (!dev )
757- continue ;
744+ status = acpi_get_next_object (ACPI_TYPE_DEVICE , dev_handle ,
745+ handle , & handle );
746+ if (ACPI_FAILURE (status ) || (handle == NULL ))
747+ break ;
758748
759- status = acpi_evaluate_integer (dev -> handle , "_ADR" , NULL , & device_id );
749+ status = acpi_evaluate_integer (handle , "_ADR" , NULL , & device_id );
760750 if (ACPI_FAILURE (status ))
761751 /* Couldnt query device_id for this device */
762752 continue ;
@@ -766,16 +756,13 @@ NV_STATUS NV_API_CALL nv_acpi_ddc_method(
766756 case 0x0118 :
767757 case 0x0400 :
768758 case 0xA420 :
769- lcd_dev_handle = dev -> handle ;
759+ lcd_dev_handle = handle ;
770760 nv_printf (NV_DBG_INFO , "NVRM: %s Found LCD: %x\n" ,
771761 __FUNCTION__ , device_id );
772762 break ;
773763 default :
774764 break ;
775765 }
776-
777- if (lcd_dev_handle != NULL )
778- break ;
779766 }
780767
781768 if (lcd_dev_handle == NULL )
@@ -1125,15 +1112,14 @@ NV_STATUS NV_API_CALL nv_acpi_mux_method(
11251112)
11261113{
11271114 acpi_status status ;
1128- struct acpi_device * device = NULL ;
11291115 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER , NULL };
11301116 union acpi_object * mux = NULL ;
11311117 union acpi_object mux_arg = { ACPI_TYPE_INTEGER };
11321118 struct acpi_object_list input = { 1 , & mux_arg };
11331119 acpi_handle dev_handle = NULL ;
11341120 acpi_handle mux_dev_handle = NULL ;
1121+ acpi_handle handle = NULL ;
11351122 unsigned long long device_id = 0 ;
1136- struct list_head * node , * next ;
11371123
11381124 if ((strcmp (pMethodName , "MXDS" ) != 0 )
11391125 && (strcmp (pMethodName , "MXDM" ) != 0 ))
@@ -1154,16 +1140,6 @@ NV_STATUS NV_API_CALL nv_acpi_mux_method(
11541140 if (!dev_handle )
11551141 return NV_ERR_INVALID_ARGUMENT ;
11561142
1157- #if defined(NV_ACPI_BUS_GET_DEVICE_PRESENT )
1158- status = acpi_bus_get_device (dev_handle , & device );
1159- #else
1160- return NV_ERR_NOT_SUPPORTED ;
1161- #endif
1162-
1163-
1164- if (ACPI_FAILURE (status ) || !device )
1165- return NV_ERR_INVALID_ARGUMENT ;
1166-
11671143 if (!NV_MAY_SLEEP ())
11681144 {
11691145#if defined(DEBUG )
@@ -1172,23 +1148,16 @@ NV_STATUS NV_API_CALL nv_acpi_mux_method(
11721148 return NV_ERR_NOT_SUPPORTED ;
11731149 }
11741150
1175- list_for_each_safe ( node , next , & device -> children )
1151+ while ( mux_dev_handle == NULL )
11761152 {
1177- struct acpi_device * dev = list_entry (node , struct acpi_device , node );
1178-
1179- if (!dev )
1180- continue ;
1181-
1182- status = acpi_evaluate_integer (dev -> handle , "_ADR" , NULL , & device_id );
1183- if (ACPI_FAILURE (status ))
1184- /* Could not query device_id for this device */
1185- continue ;
1186-
1187- if (device_id == muxAcpiId )
1188- {
1189- mux_dev_handle = dev -> handle ;
1153+ status = acpi_get_next_object (ACPI_TYPE_DEVICE , dev_handle ,
1154+ handle , & handle );
1155+ if (ACPI_FAILURE (status ) || (handle == NULL ))
11901156 break ;
1191- }
1157+
1158+ status = acpi_evaluate_integer (handle , "_ADR" , NULL , & device_id );
1159+ if (ACPI_SUCCESS (status ) && (device_id == muxAcpiId ))
1160+ mux_dev_handle = handle ;
11921161 }
11931162
11941163 if (mux_dev_handle == NULL )
0 commit comments