summaryrefslogtreecommitdiff
path: root/drivers/i2c/i2c-boardinfo.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-03-01 11:45:51 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-04-01 09:36:19 -0700
commit4124c4eba40256b65acb5016a1edfdd59a1960b6 (patch)
tree6e4ca51577d3df12ada66b8bc62abfd7d444c5a7 /drivers/i2c/i2c-boardinfo.c
parent0daaf99d8424f12cdf87e00c435c9cb93667f519 (diff)
downloadlinux-4124c4eba40256b65acb5016a1edfdd59a1960b6.tar.gz
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>
Diffstat (limited to 'drivers/i2c/i2c-boardinfo.c')
-rw-r--r--drivers/i2c/i2c-boardinfo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c
index 0e285c68b2ff..31186ead5a40 100644
--- a/drivers/i2c/i2c-boardinfo.c
+++ b/drivers/i2c/i2c-boardinfo.c
@@ -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);
}