+};
+
/* Helpers to hide struct msi_desc implementation details */
#define msi_desc_to_dev(desc) ((desc)->dev)
#define dev_to_msi_list(dev) (&(dev)->msi_list)
@@ -145,21 +151,31 @@ enum platform_msi_type {
#define for_each_msi_entry_safe(desc, tmp, dev) \
list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list)
-#define dev_to_platform_msi_list(dev) (&(dev)->platform_msi_list)
-#define first_platform_msi_entry(dev) \
- list_first_entry(dev_to_platform_msi_list((dev)), struct msi_desc, list)
-#define for_each_platform_msi_entry(desc, dev) \
- list_for_each_entry((desc), dev_to_platform_msi_list((dev)), list)
-#define for_each_platform_msi_entry_safe(desc, tmp, dev) \
- list_for_each_entry_safe((desc), (tmp), dev_to_platform_msi_list((dev)), list)
+#define dev_to_platform_msi_group_list(dev) (&(dev)->platform_msi_list)
+
+#define first_platform_msi_group_entry(dev) \
+ list_first_entry(dev_to_platform_msi_group_list((dev)), \
+ struct platform_msi_group_entry, group_list)
-#define first_msi_entry_common(dev) \
- list_first_entry_select((dev)->platform_msi_type, dev_to_platform_msi_list((dev)), \
+#define platform_msi_current_group_entry_list(dev) \
+ (&((list_last_entry(dev_to_platform_msi_group_list((dev)), \
+ struct platform_msi_group_entry, \
+ group_list))->entry_list))
+
+#define first_msi_entry_current_group(dev) \
+ list_first_entry_select((dev)->platform_msi_type, \
+ platform_msi_current_group_entry_list((dev)), \
dev_to_msi_list((dev)), struct msi_desc, list)
-#define for_each_msi_entry_common(desc, dev) \
- list_for_each_entry_select((dev)->platform_msi_type, desc, dev_to_platform_msi_list((dev)), \
- dev_to_msi_list((dev)), list) \
+#define for_each_msi_entry_current_group(desc, dev) \
+ list_for_each_entry_select((dev)->platform_msi_type, desc, \
+ platform_msi_current_group_entry_list((dev)),\
+ dev_to_msi_list((dev)), list)
+
+#define for_each_platform_msi_entry_in_group(desc, platform_msi_group, group, dev) \
+ list_for_each_entry((platform_msi_group), dev_to_platform_msi_group_list((dev)), group_list) \
+ if (((platform_msi_group)->group_id) == (group)) \
+ list_for_each_entry((desc), (&(platform_msi_group)->entry_list), list)