@@ -129,17 +129,19 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev,
static int i2c_acpi_get_info(struct acpi_device *adev,
struct i2c_board_info *info,
+ int index,
struct i2c_adapter *adapter,
acpi_handle *adapter_handle)
{
struct list_head resource_list;
struct resource_entry *entry;
struct i2c_acpi_lookup lookup;
+ unsigned int n;
int ret;
memset(&lookup, 0, sizeof(lookup));
lookup.info = info;
- lookup.index = -1;
+ lookup.index = index;
ret = i2c_acpi_do_lookup(adev, &lookup);
if (ret)
@@ -170,10 +172,13 @@ static int i2c_acpi_get_info(struct acpi_device *adev,
if (ret < 0)
return -EINVAL;
+ n = 0;
resource_list_for_each_entry(entry, &resource_list) {
if (resource_type(entry->res) == IORESOURCE_IRQ) {
- info->irq = entry->res->start;
- break;
+ if (index == -1 || n++ == index) {
+ info->irq = entry->res->start;
+ break;
+ }
}
}
@@ -210,7 +215,7 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
if (acpi_bus_get_device(handle, &adev))
return AE_OK;
- if (i2c_acpi_get_info(adev, &info, adapter, NULL))
+ if (i2c_acpi_get_info(adev, &info, -1, adapter, NULL))
return AE_OK;
i2c_acpi_register_device(adapter, adev, &info);
@@ -356,7 +361,7 @@ static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
switch (value) {
case ACPI_RECONFIG_DEVICE_ADD:
- if (i2c_acpi_get_info(adev, &info, NULL, &adapter_handle))
+ if (i2c_acpi_get_info(adev, &info, -1, NULL, &adapter_handle))
break;
adapter = i2c_acpi_find_adapter_by_handle(adapter_handle);