Lines Matching refs:cp
98 const struct can_proto *cp; in can_get_proto() local
101 cp = rcu_dereference(proto_tab[protocol]); in can_get_proto()
102 if (cp && !try_module_get(cp->prot->owner)) in can_get_proto()
103 cp = NULL; in can_get_proto()
106 return cp; in can_get_proto()
109 static inline void can_put_proto(const struct can_proto *cp) in can_put_proto() argument
111 module_put(cp->prot->owner); in can_put_proto()
118 const struct can_proto *cp; in can_create() local
126 cp = can_get_proto(protocol); in can_create()
129 if (!cp) { in can_create()
142 cp = can_get_proto(protocol); in can_create()
148 if (!cp) in can_create()
151 if (cp->type != sock->type) { in can_create()
156 sock->ops = cp->ops; in can_create()
158 sk = sk_alloc(net, PF_CAN, GFP_KERNEL, cp->prot, kern); in can_create()
177 can_put_proto(cp); in can_create()
740 int can_proto_register(const struct can_proto *cp) in can_proto_register() argument
742 int proto = cp->protocol; in can_proto_register()
750 err = proto_register(cp->prot, 0); in can_proto_register()
760 RCU_INIT_POINTER(proto_tab[proto], cp); in can_proto_register()
766 proto_unregister(cp->prot); in can_proto_register()
776 void can_proto_unregister(const struct can_proto *cp) in can_proto_unregister() argument
778 int proto = cp->protocol; in can_proto_unregister()
781 BUG_ON(rcu_access_pointer(proto_tab[proto]) != cp); in can_proto_unregister()
787 proto_unregister(cp->prot); in can_proto_unregister()