}
}
+ if (info->resources) {
+ devinfo->board_info.resources =
+ kmemdup(info->resources,
+ info->num_resources *
+ sizeof(*info->resources),
+ GFP_KERNEL);
+ if (!devinfo->board_info.resources) {
+ status = -ENOMEM;
+ break;
+ }
+ }
+
list_add_tail(&devinfo->list, &__i2c_board_list);
}
i2c_encode_flags_to_addr(client));
}
+static int i2c_dev_irq_from_resources(const struct resource *resources,
+ unsigned int num_resources)
+{
+ struct irq_data *irqd;
+ int i;
+
+ for (i = 0; i < num_resources; i++) {
+ const struct resource *r = &resources[i];
+
+ if (resource_type(r) != IORESOURCE_IRQ)
+ continue;
+
+ if (r->flags & IORESOURCE_BITS) {
+ irqd = irq_get_irq_data(r->start);
+ if (!irqd)
+ break;
+
+ irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS);
+ }
+
+ return r->start;
+ }
+
+ return 0;
+}
+
/**
* i2c_new_device - instantiate an i2c device
* @adap: the adapter managing the device
client->flags = info->flags;
client->addr = info->addr;
+
client->irq = info->irq;
+ if (!client->irq)
+ client->irq = i2c_dev_irq_from_resources(info->resources,
+ info->num_resources);
strlcpy(client->name, info->type, sizeof(client->name));
* @of_node: pointer to OpenFirmware device node
* @fwnode: device node supplied by the platform firmware
* @properties: additional device properties for the device
+ * @resources: resources associated with the device
+ * @num_resources: number of resources in the @resources array
* @irq: stored in i2c_client.irq
*
* I2C doesn't actually support hardware probing, although controllers and
struct device_node *of_node;
struct fwnode_handle *fwnode;
const struct property_entry *properties;
+ const struct resource *resources;
+ unsigned int num_resources;
int irq;
};