Commit b57ef81ff8ffb830e1b3e404d692e55161992d27

Authored by stephen hemminger
Committed by David S. Miller
1 parent 65c64ce8ee

netlink: af_netlink cleanup (v2)

Don't inline functions that cover several lines, and do inline
the trivial ones. Also make some arguments const.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 14 additions and 18 deletions Side-by-side Diff

net/netlink/af_netlink.c
... ... @@ -98,7 +98,7 @@
98 98 return container_of(sk, struct netlink_sock, sk);
99 99 }
100 100  
101   -static inline int netlink_is_kernel(struct sock *sk)
  101 +static inline int netlink_is_kernel(const struct sock *sk)
102 102 {
103 103 return nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET;
104 104 }
105 105  
... ... @@ -139,12 +139,12 @@
139 139  
140 140 static ATOMIC_NOTIFIER_HEAD(netlink_chain);
141 141  
142   -static u32 netlink_group_mask(u32 group)
  142 +static inline u32 netlink_group_mask(u32 group)
143 143 {
144 144 return group ? 1 << (group - 1) : 0;
145 145 }
146 146  
147   -static struct hlist_head *nl_pid_hashfn(struct nl_pid_hash *hash, u32 pid)
  147 +static inline struct hlist_head *nl_pid_hashfn(struct nl_pid_hash *hash, u32 pid)
148 148 {
149 149 return &hash->table[jhash_1word(pid, hash->rnd) & hash->mask];
150 150 }
... ... @@ -226,8 +226,7 @@
226 226 wake_up(&nl_table_wait);
227 227 }
228 228  
229   -static inline struct sock *netlink_lookup(struct net *net, int protocol,
230   - u32 pid)
  229 +static struct sock *netlink_lookup(struct net *net, int protocol, u32 pid)
231 230 {
232 231 struct nl_pid_hash *hash = &nl_table[protocol].hash;
233 232 struct hlist_head *head;
... ... @@ -248,7 +247,7 @@
248 247 return sk;
249 248 }
250 249  
251   -static inline struct hlist_head *nl_pid_hash_zalloc(size_t size)
  250 +static struct hlist_head *nl_pid_hash_zalloc(size_t size)
252 251 {
253 252 if (size <= PAGE_SIZE)
254 253 return kzalloc(size, GFP_ATOMIC);
... ... @@ -258,7 +257,7 @@
258 257 get_order(size));
259 258 }
260 259  
261   -static inline void nl_pid_hash_free(struct hlist_head *table, size_t size)
  260 +static void nl_pid_hash_free(struct hlist_head *table, size_t size)
262 261 {
263 262 if (size <= PAGE_SIZE)
264 263 kfree(table);
... ... @@ -578,7 +577,7 @@
578 577 return err;
579 578 }
580 579  
581   -static inline int netlink_capable(struct socket *sock, unsigned int flag)
  580 +static inline int netlink_capable(const struct socket *sock, unsigned int flag)
582 581 {
583 582 return (nl_table[sock->sk->sk_protocol].nl_nonroot & flag) ||
584 583 capable(CAP_NET_ADMIN);
... ... @@ -846,8 +845,7 @@
846 845 sock_put(sk);
847 846 }
848 847  
849   -static inline struct sk_buff *netlink_trim(struct sk_buff *skb,
850   - gfp_t allocation)
  848 +static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
851 849 {
852 850 int delta;
853 851  
... ... @@ -871,7 +869,7 @@
871 869 return skb;
872 870 }
873 871  
874   -static inline void netlink_rcv_wake(struct sock *sk)
  872 +static void netlink_rcv_wake(struct sock *sk)
875 873 {
876 874 struct netlink_sock *nlk = nlk_sk(sk);
877 875  
... ... @@ -881,7 +879,7 @@
881 879 wake_up_interruptible(&nlk->wait);
882 880 }
883 881  
884   -static inline int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb)
  882 +static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb)
885 883 {
886 884 int ret;
887 885 struct netlink_sock *nlk = nlk_sk(sk);
... ... @@ -952,8 +950,7 @@
952 950 }
953 951 EXPORT_SYMBOL_GPL(netlink_has_listeners);
954 952  
955   -static inline int netlink_broadcast_deliver(struct sock *sk,
956   - struct sk_buff *skb)
  953 +static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
957 954 {
958 955 struct netlink_sock *nlk = nlk_sk(sk);
959 956  
... ... @@ -982,7 +979,7 @@
982 979 void *tx_data;
983 980 };
984 981  
985   -static inline int do_one_broadcast(struct sock *sk,
  982 +static int do_one_broadcast(struct sock *sk,
986 983 struct netlink_broadcast_data *p)
987 984 {
988 985 struct netlink_sock *nlk = nlk_sk(sk);
... ... @@ -1110,8 +1107,7 @@
1110 1107 int code;
1111 1108 };
1112 1109  
1113   -static inline int do_one_set_err(struct sock *sk,
1114   - struct netlink_set_err_data *p)
  1110 +static int do_one_set_err(struct sock *sk, struct netlink_set_err_data *p)
1115 1111 {
1116 1112 struct netlink_sock *nlk = nlk_sk(sk);
1117 1113 int ret = 0;
net/netlink/genetlink.c
... ... @@ -106,7 +106,7 @@
106 106 /* Of course we are going to have problems once we hit
107 107 * 2^16 alive types, but that can only happen by year 2K
108 108 */
109   -static inline u16 genl_generate_id(void)
  109 +static u16 genl_generate_id(void)
110 110 {
111 111 static u16 id_gen_idx = GENL_MIN_ID;
112 112 int i;