Subject: Re: [PATCH 4/7] CAN: Add broadcast manager (bcm) protocol

From: Arnaldo Carvalho de Melo <[email-masked]>
Date: Tue, 25 Sep 2007 09:51:22 -0300

Em Tue, Sep 25, 2007 at 02:20:33PM +0200, Urs Thuermann escreveu:
> This patch adds the CAN broadcast manager (bcm) protocol.
> 
> +static void bcm_can_tx(struct bcm_op *op)
> +{
> +	skb = alloc_skb(CFSIZ,
> +			in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);

We have gfp_any() for this:

[acme@filo net-2.6.24]$ grep gfp_any net/*/*.[ch]
net/ipv4/tcp.c:         tcp_send_active_reset(sk, gfp_any());
net/ipv6/route.c:       skb = nlmsg_new(rt6_nlmsg_size(), gfp_any());
net/ipv6/route.c:       err = rtnl_notify(skb, pid, RTNLGRP_IPV6_ROUTE,
nlh, gfp_any());
net/netfilter/nfnetlink.c:      netlink_broadcast(nfnl, skb, pid, group,
gfp_any());
net/netlink/af_netlink.c:       skb = netlink_trim(skb, gfp_any());

[acme@filo net-2.6.24]$ grep in_interrupt net/*/*.[ch]
net/decnet/dn_route.c:  int user_mode = !in_interrupt();
net/decnet/dn_table.c:  if (in_interrupt() && net_ratelimit()) {
[acme@filo net-2.6.24]$

> +static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
> +			     struct can_frame *frames, int has_timestamp)
> +{
> +	struct sk_buff *skb;
> +	struct can_frame *firstframe;
> +	struct sockaddr_can *addr;
> +	struct sock *sk = op->sk;
> +	int datalen = head->nframes * CFSIZ;
> +	int err;
> +
> +	skb = alloc_skb(sizeof(*head) + datalen,
> +			in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);

ditto