diff options
| author | Mark Brown <broonie@linaro.org> | 2013-11-24 09:35:18 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2013-11-24 09:35:18 -0500 |
| commit | 30c27abd28fa168d7ebd2e5286f1fe473c74bfa9 (patch) | |
| tree | 9936b38c0c81cd430d5e75906c1207d127fe588c /include/linux/genl_magic_func.h | |
| parent | 16ec790938d4f356c82fab27b9a9adf4d6fe19a6 (diff) | |
| parent | 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff) | |
Merge tag 'v3.13-rc1' into asoc-arizona
Linux 3.13-rc1
Diffstat (limited to 'include/linux/genl_magic_func.h')
| -rw-r--r-- | include/linux/genl_magic_func.h | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h index 023bc346b877..c0894dd8827b 100644 --- a/include/linux/genl_magic_func.h +++ b/include/linux/genl_magic_func.h | |||
| @@ -273,49 +273,40 @@ static struct genl_family ZZZ_genl_family __read_mostly = { | |||
| 273 | * Magic: define multicast groups | 273 | * Magic: define multicast groups |
| 274 | * Magic: define multicast group registration helper | 274 | * Magic: define multicast group registration helper |
| 275 | */ | 275 | */ |
| 276 | #define ZZZ_genl_mcgrps CONCAT_(GENL_MAGIC_FAMILY, _genl_mcgrps) | ||
| 277 | static const struct genl_multicast_group ZZZ_genl_mcgrps[] = { | ||
| 278 | #undef GENL_mc_group | ||
| 279 | #define GENL_mc_group(group) { .name = #group, }, | ||
| 280 | #include GENL_MAGIC_INCLUDE_FILE | ||
| 281 | }; | ||
| 282 | |||
| 283 | enum CONCAT_(GENL_MAGIC_FAMILY, group_ids) { | ||
| 284 | #undef GENL_mc_group | ||
| 285 | #define GENL_mc_group(group) CONCAT_(GENL_MAGIC_FAMILY, _group_ ## group), | ||
| 286 | #include GENL_MAGIC_INCLUDE_FILE | ||
| 287 | }; | ||
| 288 | |||
| 276 | #undef GENL_mc_group | 289 | #undef GENL_mc_group |
| 277 | #define GENL_mc_group(group) \ | 290 | #define GENL_mc_group(group) \ |
| 278 | static struct genl_multicast_group \ | ||
| 279 | CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group) __read_mostly = { \ | ||
| 280 | .name = #group, \ | ||
| 281 | }; \ | ||
| 282 | static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \ | 291 | static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \ |
| 283 | struct sk_buff *skb, gfp_t flags) \ | 292 | struct sk_buff *skb, gfp_t flags) \ |
| 284 | { \ | 293 | { \ |
| 285 | unsigned int group_id = \ | 294 | unsigned int group_id = \ |
| 286 | CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group).id; \ | 295 | CONCAT_(GENL_MAGIC_FAMILY, _group_ ## group); \ |
| 287 | if (!group_id) \ | 296 | return genlmsg_multicast(&ZZZ_genl_family, skb, 0, \ |
| 288 | return -EINVAL; \ | 297 | group_id, flags); \ |
| 289 | return genlmsg_multicast(skb, 0, group_id, flags); \ | ||
| 290 | } | 298 | } |
| 291 | 299 | ||
| 292 | #include GENL_MAGIC_INCLUDE_FILE | 300 | #include GENL_MAGIC_INCLUDE_FILE |
| 293 | 301 | ||
| 294 | int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void) | ||
| 295 | { | ||
| 296 | int err = genl_register_family_with_ops(&ZZZ_genl_family, | ||
| 297 | ZZZ_genl_ops, ARRAY_SIZE(ZZZ_genl_ops)); | ||
| 298 | if (err) | ||
| 299 | return err; | ||
| 300 | #undef GENL_mc_group | ||
| 301 | #define GENL_mc_group(group) \ | ||
| 302 | err = genl_register_mc_group(&ZZZ_genl_family, \ | ||
| 303 | &CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group)); \ | ||
| 304 | if (err) \ | ||
| 305 | goto fail; \ | ||
| 306 | else \ | ||
| 307 | pr_info("%s: mcg %s: %u\n", #group, \ | ||
| 308 | __stringify(GENL_MAGIC_FAMILY), \ | ||
| 309 | CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group).id); | ||
| 310 | |||
| 311 | #include GENL_MAGIC_INCLUDE_FILE | ||
| 312 | |||
| 313 | #undef GENL_mc_group | 302 | #undef GENL_mc_group |
| 314 | #define GENL_mc_group(group) | 303 | #define GENL_mc_group(group) |
| 315 | return 0; | 304 | |
| 316 | fail: | 305 | int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void) |
| 317 | genl_unregister_family(&ZZZ_genl_family); | 306 | { |
| 318 | return err; | 307 | return genl_register_family_with_ops_groups(&ZZZ_genl_family, \ |
| 308 | ZZZ_genl_ops, \ | ||
| 309 | ZZZ_genl_mcgrps); | ||
| 319 | } | 310 | } |
| 320 | 311 | ||
| 321 | void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void) | 312 | void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void) |
