summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKurt Van Dijck <kurt.van.dijck@eia.be>2011-05-03 18:42:04 +0000
committerDavid S. Miller <davem@davemloft.net>2011-05-04 14:08:37 -0700
commitc8d55a9d9e257e67d02a6f673a943dd77e6bf24e (patch)
tree99bf837975a0ee0d20945bc2c3d3ba2f630a9cd5 /net
parent1650629d1800bf05ad775f974e931ca2fa03b0ff (diff)
downloadlinux-c8d55a9d9e257e67d02a6f673a943dd77e6bf24e.tar.bz2
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')
-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)
skb_queue_purge(&sk->sk_receive_queue);
}
-static const struct can_proto *can_try_module_get(int protocol)
+static const struct can_proto *can_get_proto(int protocol)
{
const struct can_proto *cp;
@@ -128,6 +128,11 @@ static const struct can_proto *can_try_module_get(int protocol)
return cp;
}
+static inline void can_put_proto(const struct can_proto *cp)
+{
+ module_put(cp->prot->owner);
+}
+
static int can_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
@@ -143,7 +148,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
- cp = can_try_module_get(protocol);
+ cp = can_get_proto(protocol);
#ifdef CONFIG_MODULES
if (!cp) {
@@ -160,7 +165,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
printk(KERN_ERR "can: request_module "
"(can-proto-%d) failed.\n", protocol);
- cp = can_try_module_get(protocol);
+ cp = can_get_proto(protocol);
}
#endif
@@ -195,7 +200,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
}
errout:
- module_put(cp->prot->owner);
+ can_put_proto(cp);
return err;
}