drm/atomic-helper: document drm_atomic_helper_check() restrictions
[drm/drm-misc.git] / include / linux / can / core.h
blob5fb8d0e3f9c1d027a2d5cd7c4eec7f2fa0340ed4
1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
2 /*
3 * linux/can/core.h
5 * Prototypes and definitions for CAN protocol modules using the PF_CAN core
7 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
8 * Urs Thuermann <urs.thuermann@volkswagen.de>
9 * Copyright (c) 2002-2017 Volkswagen Group Electronic Research
10 * All rights reserved.
14 #ifndef _CAN_CORE_H
15 #define _CAN_CORE_H
17 #include <linux/can.h>
18 #include <linux/skbuff.h>
19 #include <linux/netdevice.h>
21 #define DNAME(dev) ((dev) ? (dev)->name : "any")
23 /**
24 * struct can_proto - CAN protocol structure
25 * @type: type argument in socket() syscall, e.g. SOCK_DGRAM.
26 * @protocol: protocol number in socket() syscall.
27 * @ops: pointer to struct proto_ops for sock->ops.
28 * @prot: pointer to struct proto structure.
30 struct can_proto {
31 int type;
32 int protocol;
33 const struct proto_ops *ops;
34 struct proto *prot;
37 /* required_size
38 * macro to find the minimum size of a struct
39 * that includes a requested member
41 #define CAN_REQUIRED_SIZE(struct_type, member) \
42 (offsetof(typeof(struct_type), member) + \
43 sizeof(((typeof(struct_type) *)(NULL))->member))
45 /* function prototypes for the CAN networklayer core (af_can.c) */
47 extern int can_proto_register(const struct can_proto *cp);
48 extern void can_proto_unregister(const struct can_proto *cp);
50 int can_rx_register(struct net *net, struct net_device *dev,
51 canid_t can_id, canid_t mask,
52 void (*func)(struct sk_buff *, void *),
53 void *data, char *ident, struct sock *sk);
55 extern void can_rx_unregister(struct net *net, struct net_device *dev,
56 canid_t can_id, canid_t mask,
57 void (*func)(struct sk_buff *, void *),
58 void *data);
60 extern int can_send(struct sk_buff *skb, int loop);
61 void can_sock_destruct(struct sock *sk);
63 #endif /* !_CAN_CORE_H */