Skip to content

Commit

Permalink
gdm72xx: replace obsolete NLMSG_* with type safe nlmsg_*
Browse files Browse the repository at this point in the history
Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hong zhi guo authored and David S. Miller committed Mar 28, 2013
1 parent 7795498 commit b96dc46
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/staging/gdm72xx/netlink_k.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <linux/module.h>
#include <linux/etherdevice.h>
#include <linux/netlink.h>
#include <net/netlink.h>
#include <asm/byteorder.h>
#include <net/sock.h>

Expand All @@ -25,12 +25,12 @@

#define ND_MAX_GROUP 30
#define ND_IFINDEX_LEN sizeof(int)
#define ND_NLMSG_SPACE(len) (NLMSG_SPACE(len) + ND_IFINDEX_LEN)
#define ND_NLMSG_SPACE(len) (nlmsg_total_size(len) + ND_IFINDEX_LEN)
#define ND_NLMSG_DATA(nlh) \
((void *)((char *)NLMSG_DATA(nlh) + ND_IFINDEX_LEN))
((void *)((char *)nlmsg_data(nlh) + ND_IFINDEX_LEN))
#define ND_NLMSG_S_LEN(len) (len+ND_IFINDEX_LEN)
#define ND_NLMSG_R_LEN(nlh) (nlh->nlmsg_len-ND_IFINDEX_LEN)
#define ND_NLMSG_IFIDX(nlh) NLMSG_DATA(nlh)
#define ND_NLMSG_IFIDX(nlh) nlmsg_data(nlh)
#define ND_MAX_MSG_LEN 8096

#if defined(DEFINE_MUTEX)
Expand All @@ -51,7 +51,7 @@ static void netlink_rcv_cb(struct sk_buff *skb)
void *msg;
int ifindex;

if (skb->len >= NLMSG_SPACE(0)) {
if (skb->len >= NLMSG_HDRLEN) {
nlh = (struct nlmsghdr *)skb->data;

if (skb->len < nlh->nlmsg_len ||
Expand Down Expand Up @@ -124,7 +124,7 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len)
return -EINVAL;
}

skb = alloc_skb(NLMSG_SPACE(len), GFP_ATOMIC);
skb = nlmsg_new(len, GFP_ATOMIC);
if (!skb) {
pr_err("netlink_broadcast ret=%d\n", ret);
return -ENOMEM;
Expand Down

0 comments on commit b96dc46

Please sign in to comment.