Commit c8d55a9d9e257e67d02a6f673a943dd77e6bf24e
Committed by
David S. Miller
1 parent
1650629d18
Exists in
master
and in
7 other branches
can: rename can_try_module_get to can_get_proto
can: rename can_try_module_get to can_get_proto can_try_module_get does return a struct can_proto. The name explains what is done in so much detail that a caller may not notice that a struct can_proto is locked/unlocked. Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 9 additions and 4 deletions Side-by-side Diff
net/can/af_can.c
... | ... | @@ -115,7 +115,7 @@ |
115 | 115 | skb_queue_purge(&sk->sk_receive_queue); |
116 | 116 | } |
117 | 117 | |
118 | -static const struct can_proto *can_try_module_get(int protocol) | |
118 | +static const struct can_proto *can_get_proto(int protocol) | |
119 | 119 | { |
120 | 120 | const struct can_proto *cp; |
121 | 121 | |
... | ... | @@ -128,6 +128,11 @@ |
128 | 128 | return cp; |
129 | 129 | } |
130 | 130 | |
131 | +static inline void can_put_proto(const struct can_proto *cp) | |
132 | +{ | |
133 | + module_put(cp->prot->owner); | |
134 | +} | |
135 | + | |
131 | 136 | static int can_create(struct net *net, struct socket *sock, int protocol, |
132 | 137 | int kern) |
133 | 138 | { |
... | ... | @@ -143,7 +148,7 @@ |
143 | 148 | if (!net_eq(net, &init_net)) |
144 | 149 | return -EAFNOSUPPORT; |
145 | 150 | |
146 | - cp = can_try_module_get(protocol); | |
151 | + cp = can_get_proto(protocol); | |
147 | 152 | |
148 | 153 | #ifdef CONFIG_MODULES |
149 | 154 | if (!cp) { |
... | ... | @@ -160,7 +165,7 @@ |
160 | 165 | printk(KERN_ERR "can: request_module " |
161 | 166 | "(can-proto-%d) failed.\n", protocol); |
162 | 167 | |
163 | - cp = can_try_module_get(protocol); | |
168 | + cp = can_get_proto(protocol); | |
164 | 169 | } |
165 | 170 | #endif |
166 | 171 | |
... | ... | @@ -195,7 +200,7 @@ |
195 | 200 | } |
196 | 201 | |
197 | 202 | errout: |
198 | - module_put(cp->prot->owner); | |
203 | + can_put_proto(cp); | |
199 | 204 | return err; |
200 | 205 | } |
201 | 206 |