+static int try_match_acpi_hid(struct acpi_device *child,
+ struct mfd_cell_acpi_match *match, char **hids,
+ int hids_num)
+{
+ struct acpi_device_id ids[2] = {};
+ int i;
+
+ for (i = 0; i < hids_num; i++) {
+ strlcpy(ids[0].id, hids[i], sizeof(ids[0].id));
+ if (!acpi_match_device_ids(child, ids)) {
+ match->pnpid = hids[i];
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static int precheck_acpi_hid(struct usb_interface *intf)
+{
+ struct acpi_device *parent, *child;
+
+ parent = ACPI_COMPANION(&intf->dev);
+ if (!parent)
+ return -ENODEV;
+
+ list_for_each_entry (child, &parent->children, node) {
+ try_match_acpi_hid(child,
+ &ljca_acpi_match_gpio,
+ gpio_hids, ARRAY_SIZE(gpio_hids));
+ try_match_acpi_hid(child,
+ &ljca_acpi_match_i2cs[0],
+ i2c_hids, ARRAY_SIZE(i2c_hids));
+ try_match_acpi_hid(child,
+ &ljca_acpi_match_i2cs[1],
+ i2c_hids, ARRAY_SIZE(i2c_hids));
+ try_match_acpi_hid(child,
+ &ljca_acpi_match_spis[0],
+ spi_hids, ARRAY_SIZE(spi_hids));
+ }
+
+ return 0;
+}
+