Re: [Pcihpd-discuss] [patch] acpiphp: handle dock stations

From: Kenji Kaneshige
Date: Thu Feb 02 2006 - 00:10:29 EST


Kristen Carlson Accardi wrote:
+int is_dependent_device(acpi_handle handle)
+{
+ struct dependent_device *dd;
+
+ if (!ds)
+ return 0;
+
+ list_for_each_entry(dd, &ds->dependent_devices, device_list) {
+ if (handle == dd->handle)
+ return 1;
+ }
+ return 0;
+}
(snip.)
+struct dependent_device * get_dependent_device(acpi_handle handle)
+{
+ struct dependent_device *dd;
+
+ list_for_each_entry(dd, &ds->dependent_devices, device_list) {
+ if (handle == dd->handle)
+ return dd;
+ }
+ return NULL;
+}

Those look very similar...



+
+ /* make sure we are dependent on the dock device */
+ acpi_get_name(dck_handle, ACPI_FULL_PATHNAME, &buffer);
+ status = acpi_evaluate_object(handle, "_EJD", NULL, &ejd_buffer);
+ if (ACPI_FAILURE(status)) {
+ err("Unable to execute _EJD!\n");
+ goto find_ejd_out;
+ }
+
+ /* because acpi_get_name will pad the names if they are less
+ * than 4 characters, we can't compare the strings returned
+ * from _EJD with those returned from acpi_get_name. So,
+ * we have to get a handle to the object referenced by _EJD
+ * and then call get name on that.
+ */
+ ejd_obj = ejd_buffer.pointer;
+ status = acpi_get_handle(NULL, ejd_obj->string.pointer, &tmp);
+ if (ACPI_FAILURE(status))
+ goto find_ejd_out;
+ acpi_get_name(tmp, ACPI_FULL_PATHNAME, &ejd_name_buffer);
+
+ dck_obj = buffer.pointer;
+ if (!strncmp(ejd_objname, objname, strlen(ejd_objname))) {

I don't think you need to compare pathnames.
Why not just compare ACPI handles like below?

if (dck_handle == tmp) {
...

Thanks,
Kenji Kaneshige

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/