genetlink: statically initialize families

Instead of providing macros/inline functions to initialize
the families, make all users initialize them statically and
get rid of the macros.

This reduces the kernel code size by about 1.6k on x86-64
(with allyesconfig).

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Johannes Berg 2016-10-24 14:40:03 +02:00 • committed by David S. Miller
commit 489111e5c2
37 changed files with 414 additions and 337 deletions

View file

@ -38,13 +38,7 @@ static const struct genl_multicast_group nfc_genl_mcgrps[] = {
{ .name = NFC_GENL_MCAST_EVENT_NAME, },
};
static struct genl_family nfc_genl_family = {
.hdrsize = 0,
.name = NFC_GENL_NAME,
.version = NFC_GENL_VERSION,
.maxattr = NFC_ATTR_MAX,
};
static struct genl_family nfc_genl_family;
static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
[NFC_ATTR_DEVICE_INDEX] = { .type = NLA_U32 },
[NFC_ATTR_DEVICE_NAME] = { .type = NLA_STRING,
@ -1752,6 +1746,18 @@ static const struct genl_ops nfc_genl_ops[] = {
},
};
static struct genl_family nfc_genl_family = {
.hdrsize = 0,
.name = NFC_GENL_NAME,
.version = NFC_GENL_VERSION,
.maxattr = NFC_ATTR_MAX,
.module = THIS_MODULE,
.ops = nfc_genl_ops,
.n_ops = ARRAY_SIZE(nfc_genl_ops),
.mcgrps = nfc_genl_mcgrps,
.n_mcgrps = ARRAY_SIZE(nfc_genl_mcgrps),
};
struct urelease_work {
struct work_struct w;
@ -1837,9 +1843,7 @@ int __init nfc_genl_init(void)
{
int rc;
rc = genl_register_family_with_ops_groups(&nfc_genl_family,
nfc_genl_ops,
nfc_genl_mcgrps);
rc = genl_register_family(&nfc_genl_family);
if (rc)
return rc;