@@ -108,7 +108,18 @@ static bool acpi_nondev_subnode_extract(union acpi_object *desc,
108108 if (handle )
109109 acpi_get_parent (handle , & scope );
110110
111+ /*
112+ * Extract properties from the _DSD-equivalent package pointed to by
113+ * desc and use scope (if not NULL) for the completion of relative
114+ * pathname segments.
115+ *
116+ * The extracted properties will be held in the new data node dn.
117+ */
111118 result = acpi_extract_properties (scope , desc , & dn -> data );
119+ /*
120+ * Look for subnodes in the _DSD-equivalent package pointed to by desc
121+ * and create child nodes of dn if there are any.
122+ */
112123 if (acpi_enumerate_nondev_subnodes (scope , desc , & dn -> data , & dn -> fwnode ))
113124 result = true;
114125
@@ -133,6 +144,12 @@ static bool acpi_nondev_subnode_ok(acpi_handle scope,
133144 acpi_handle handle ;
134145 acpi_status status ;
135146
147+ /*
148+ * If the scope is unknown, the _DSD-equivalent package being parsed
149+ * was embedded in an outer _DSD-equivalent package as a result of
150+ * direct evaluation of an object pointed to by a reference. In that
151+ * case, using a pathname as the target object pointer is invalid.
152+ */
136153 if (!scope )
137154 return false;
138155
@@ -162,6 +179,10 @@ static bool acpi_add_nondev_subnodes(acpi_handle scope,
162179 bool ret = false;
163180 int i ;
164181
182+ /*
183+ * Every element in the links package is expected to represent a link
184+ * to a non-device node in a tree containing device-specific data.
185+ */
165186 for (i = 0 ; i < links -> package .count ; i ++ ) {
166187 union acpi_object * link , * desc ;
167188 bool result ;
@@ -171,17 +192,38 @@ static bool acpi_add_nondev_subnodes(acpi_handle scope,
171192 if (link -> package .count != 2 )
172193 continue ;
173194
174- /* The first one must be a string. */
195+ /* The first one (the key) must be a string. */
175196 if (link -> package .elements [0 ].type != ACPI_TYPE_STRING )
176197 continue ;
177198
178- /* The second one may be a string or a package. */
199+ /* The second one (the target) may be a string or a package. */
179200 switch (link -> package .elements [1 ].type ) {
180201 case ACPI_TYPE_STRING :
202+ /*
203+ * The string is expected to be a full pathname or a
204+ * pathname segment relative to the given scope. That
205+ * pathname is expected to point to an object returning
206+ * a package that contains _DSD-equivalent information.
207+ */
181208 result = acpi_nondev_subnode_ok (scope , link , list ,
182209 parent );
183210 break ;
184211 case ACPI_TYPE_PACKAGE :
212+ /*
213+ * This happens when a reference is used in AML to
214+ * point to the target. Since the target is expected
215+ * to be a named object, a reference to it will cause it
216+ * to be avaluated in place and its return package will
217+ * be embedded in the links package at the location of
218+ * the reference.
219+ *
220+ * The target package is expected to contain _DSD-
221+ * equivalent information, but the scope in which it
222+ * is located in the original AML is unknown. Thus
223+ * it cannot contain pathname segments represented as
224+ * strings because there is no way to build full
225+ * pathnames out of them.
226+ */
185227 desc = & link -> package .elements [1 ];
186228 result = acpi_nondev_subnode_extract (desc , NULL , link ,
187229 list , parent );
0 commit comments