i2c: allow attaching IRQ resources to i2c_board_info
Simple integer for interrupt number is not expressive enough, as it does not convey interrupt trigger type that should be used. Let's allow attaching array of resources to the board info and have i2c core parse first IRQ resource and set up interrupt trigger as needed. Reviewed-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
@@ -90,6 +90,18 @@ int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsig
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user