aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2016-10-24 08:40:03 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-27 16:16:09 -0400
commit489111e5c25b93be80340c3113d71903d7c82136 (patch)
treebf1af9c989ee4cd1decbfcbfe0633d7f563f5c83 /net/nfc
parenta07ea4d9941af5a0c6f0be2a71b51ac9c083c5e5 (diff)
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 <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/netlink.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index c230403e066c..450b1e5144cc 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -38,13 +38,7 @@ static const struct genl_multicast_group nfc_genl_mcgrps[] = {
38 { .name = NFC_GENL_MCAST_EVENT_NAME, }, 38 { .name = NFC_GENL_MCAST_EVENT_NAME, },
39}; 39};
40 40
41static struct genl_family nfc_genl_family = { 41static struct genl_family nfc_genl_family;
42 .hdrsize = 0,
43 .name = NFC_GENL_NAME,
44 .version = NFC_GENL_VERSION,
45 .maxattr = NFC_ATTR_MAX,
46};
47
48static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = { 42static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
49 [NFC_ATTR_DEVICE_INDEX] = { .type = NLA_U32 }, 43 [NFC_ATTR_DEVICE_INDEX] = { .type = NLA_U32 },
50 [NFC_ATTR_DEVICE_NAME] = { .type = NLA_STRING, 44 [NFC_ATTR_DEVICE_NAME] = { .type = NLA_STRING,
@@ -1752,6 +1746,18 @@ static const struct genl_ops nfc_genl_ops[] = {
1752 }, 1746 },
1753}; 1747};
1754 1748
1749static struct genl_family nfc_genl_family = {
1750 .hdrsize = 0,
1751 .name = NFC_GENL_NAME,
1752 .version = NFC_GENL_VERSION,
1753 .maxattr = NFC_ATTR_MAX,
1754 .module = THIS_MODULE,
1755 .ops = nfc_genl_ops,
1756 .n_ops = ARRAY_SIZE(nfc_genl_ops),
1757 .mcgrps = nfc_genl_mcgrps,
1758 .n_mcgrps = ARRAY_SIZE(nfc_genl_mcgrps),
1759};
1760
1755 1761
1756struct urelease_work { 1762struct urelease_work {
1757 struct work_struct w; 1763 struct work_struct w;
@@ -1837,9 +1843,7 @@ int __init nfc_genl_init(void)
1837{ 1843{
1838 int rc; 1844 int rc;
1839 1845
1840 rc = genl_register_family_with_ops_groups(&nfc_genl_family, 1846 rc = genl_register_family(&nfc_genl_family);
1841 nfc_genl_ops,
1842 nfc_genl_mcgrps);
1843 if (rc) 1847 if (rc)
1844 return rc; 1848 return rc;
1845 1849