aboutsummaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
authorKurt Van Dijck <kurt.van.dijck@eia.be>2011-05-03 14:42:04 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-04 17:08:37 -0400
commitc8d55a9d9e257e67d02a6f673a943dd77e6bf24e (patch)
tree99bf837975a0ee0d20945bc2c3d3ba2f630a9cd5 /net/can
parent1650629d1800bf05ad775f974e931ca2fa03b0ff (diff)
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>
Diffstat (limited to 'net/can')
-rw-r--r--net/can/af_can.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 5b52762b9f20..094fc5332d42 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -115,7 +115,7 @@ static void can_sock_destruct(struct sock *sk)
115 skb_queue_purge(&sk->sk_receive_queue); 115 skb_queue_purge(&sk->sk_receive_queue);
116} 116}
117 117
118static const struct can_proto *can_try_module_get(int protocol) 118static const struct can_proto *can_get_proto(int protocol)
119{ 119{
120 const struct can_proto *cp; 120 const struct can_proto *cp;
121 121
@@ -128,6 +128,11 @@ static const struct can_proto *can_try_module_get(int protocol)
128 return cp; 128 return cp;
129} 129}
130 130
131static inline void can_put_proto(const struct can_proto *cp)
132{
133 module_put(cp->prot->owner);
134}
135
131static int can_create(struct net *net, struct socket *sock, int protocol, 136static int can_create(struct net *net, struct socket *sock, int protocol,
132 int kern) 137 int kern)
133{ 138{
@@ -143,7 +148,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
143 if (!net_eq(net, &init_net)) 148 if (!net_eq(net, &init_net))
144 return -EAFNOSUPPORT; 149 return -EAFNOSUPPORT;
145 150
146 cp = can_try_module_get(protocol); 151 cp = can_get_proto(protocol);
147 152
148#ifdef CONFIG_MODULES 153#ifdef CONFIG_MODULES
149 if (!cp) { 154 if (!cp) {
@@ -160,7 +165,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
160 printk(KERN_ERR "can: request_module " 165 printk(KERN_ERR "can: request_module "
161 "(can-proto-%d) failed.\n", protocol); 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#endif 170#endif
166 171
@@ -195,7 +200,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
195 } 200 }
196 201
197 errout: 202 errout:
198 module_put(cp->prot->owner); 203 can_put_proto(cp);
199 return err; 204 return err;
200} 205}
201 206