From 86d99c9d455e5695a24cf8504f2ba0a0cde9ce28 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 30 Oct 2013 22:13:49 +0100 Subject: [PATCH] backports: replace netlink portid by semantic patch Introduce the infrastructure to apply semantic patches and make use of it for the (frequently breaking) portid patch for netlink. Unfortunately this is significantly slower: before: real 0m14.312s user 0m12.144s sys 0m1.784s after: real 0m25.932s user 0m21.768s sys 0m2.932s Signed-off-by: Johannes Berg Signed-off-by: Hauke Mehrtens --- gentree.py | 36 +++ .../0001-netlink-portid/ieee802154.patch | 40 --- .../network/0005-netlink-portid.cocci | 25 ++ .../network/0005-netlink-portid/INFO | 42 --- .../0005-netlink-portid/mac80211_hwsim.patch | 24 -- .../network/0005-netlink-portid/nl80211.patch | 267 ------------------ .../nfc/01-netlink-portid/INFO | 42 --- .../01-netlink-portid/net_nfc_netlink.patch | 80 ------ 8 files changed, 61 insertions(+), 495 deletions(-) delete mode 100644 patches/collateral-evolutions/ieee802154/0001-netlink-portid/ieee802154.patch create mode 100644 patches/collateral-evolutions/network/0005-netlink-portid.cocci delete mode 100644 patches/collateral-evolutions/network/0005-netlink-portid/INFO delete mode 100644 patches/collateral-evolutions/network/0005-netlink-portid/mac80211_hwsim.patch delete mode 100644 patches/collateral-evolutions/network/0005-netlink-portid/nl80211.patch delete mode 100644 patches/collateral-evolutions/nfc/01-netlink-portid/INFO delete mode 100644 patches/collateral-evolutions/nfc/01-netlink-portid/net_nfc_netlink.patch diff --git a/gentree.py b/gentree.py index 744f48da40df..e16e29767269 100755 --- a/gentree.py +++ b/gentree.py @@ -594,10 +594,13 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, logwrite('Apply patches ...') patches = [] + sempatches = [] for root, dirs, files in os.walk(os.path.join(source_dir, 'patches')): for f in files: if f.endswith('.patch'): patches.append(os.path.join(root, f)) + if f.endswith('.cocci'): + sempatches.append(os.path.join(root, f)) patches.sort() prefix_len = len(os.path.join(source_dir, 'patches')) + 1 for pfile in patches: @@ -675,6 +678,39 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, os.unlink(os.path.join(root, f)) git_debug_snapshot(args, "apply backport patch %s" % print_name) + sempatches.sort() + prefix_len = len(os.path.join(source_dir, 'patches')) + 1 + for cocci_file in sempatches: + print_name = cocci_file[prefix_len:] + if args.verbose: + logwrite("Applying patch %s" % print_name) + + process = subprocess.Popen(['spatch', '--sp-file', cocci_file, '--in-place', + '--backup-suffix', '.cocci_backup', '--dir', '.'], + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + close_fds=True, universal_newlines=True, + cwd=args.outdir) + output = process.communicate()[0] + output = output.split('\n') + if output[-1] == '': + output = output[:-1] + if args.verbose: + for line in output: + logwrite('> %s' % line) + if process.returncode != 0: + if not args.verbose: + logwrite("Failed to apply changes from %s" % print_name) + for line in output: + logwrite('> %s' % line) + return 2 + + # remove cocci_backup files + for root, dirs, files in os.walk(args.outdir): + for f in files: + if f.endswith('.cocci_backup'): + os.unlink(os.path.join(root, f)) + git_debug_snapshot(args, "apply backport patch %s" % print_name) + # some post-processing is required configtree = kconfig.ConfigTree(os.path.join(args.outdir, 'Kconfig')) logwrite('Modify Kconfig tree ...') diff --git a/patches/collateral-evolutions/ieee802154/0001-netlink-portid/ieee802154.patch b/patches/collateral-evolutions/ieee802154/0001-netlink-portid/ieee802154.patch deleted file mode 100644 index e1c12edff032..000000000000 --- a/patches/collateral-evolutions/ieee802154/0001-netlink-portid/ieee802154.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/net/ieee802154/nl-mac.c -+++ b/net/ieee802154/nl-mac.c -@@ -549,7 +549,7 @@ static int ieee802154_list_iface(struct - if (!msg) - goto out_dev; - -- rc = ieee802154_nl_fill_iface(msg, info->snd_portid, info->snd_seq, -+ rc = ieee802154_nl_fill_iface(msg, genl_info_snd_portid(info), info->snd_seq, - 0, dev); - if (rc < 0) - goto out_free; -@@ -580,7 +580,7 @@ static int ieee802154_dump_iface(struct - if (idx < s_idx || (dev->type != ARPHRD_IEEE802154)) - goto cont; - -- if (ieee802154_nl_fill_iface(skb, NETLINK_CB(cb->skb).portid, -+ if (ieee802154_nl_fill_iface(skb, NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, NLM_F_MULTI, dev) < 0) - break; - cont: ---- a/net/ieee802154/nl-phy.c -+++ b/net/ieee802154/nl-phy.c -@@ -105,7 +105,7 @@ static int ieee802154_list_phy(struct sk - if (!msg) - goto out_dev; - -- rc = ieee802154_nl_fill_phy(msg, info->snd_portid, info->snd_seq, -+ rc = ieee802154_nl_fill_phy(msg, genl_info_snd_portid(info), info->snd_seq, - 0, phy); - if (rc < 0) - goto out_free; -@@ -138,7 +138,7 @@ static int ieee802154_dump_phy_iter(stru - return 0; - - rc = ieee802154_nl_fill_phy(data->skb, -- NETLINK_CB(data->cb->skb).portid, -+ NETLINK_CB_PORTID(data->cb->skb), - data->cb->nlh->nlmsg_seq, - NLM_F_MULTI, - phy); diff --git a/patches/collateral-evolutions/network/0005-netlink-portid.cocci b/patches/collateral-evolutions/network/0005-netlink-portid.cocci new file mode 100644 index 000000000000..409e9262a9ab --- /dev/null +++ b/patches/collateral-evolutions/network/0005-netlink-portid.cocci @@ -0,0 +1,25 @@ +@nl1@ +identifier notify; +@@ +struct netlink_notify *notify; +@@ +identifier nl1.notify; +@@ +-notify->portid ++netlink_notify_portid(notify) + +// This works because no other struct in the kernel +// has an snd_portid member. +@@ +expression info; +@@ +-info->snd_portid ++genl_info_snd_portid(info) + +// skb is an expression since it could be something +// other than just an identifier, e.g. cb->skb +@@ +expression skb; +@@ +-NETLINK_CB(skb).portid ++NETLINK_CB_PORTID(skb) diff --git a/patches/collateral-evolutions/network/0005-netlink-portid/INFO b/patches/collateral-evolutions/network/0005-netlink-portid/INFO deleted file mode 100644 index e49ac3b625c1..000000000000 --- a/patches/collateral-evolutions/network/0005-netlink-portid/INFO +++ /dev/null @@ -1,42 +0,0 @@ -The patch: - -commit 15e473046cb6e5d18a4d0057e61d76315230382b -Author: Eric W. Biederman -Date: Fri Sep 7 20:12:54 2012 +0000 - - netlink: Rename pid to portid to avoid confusion - - It is a frequent mistake to confuse the netlink port identifier with a - process identifier. Try to reduce this confusion by renaming fields - that hold port identifiers portid instead of pid. - - I have carefully avoided changing the structures exported to - userspace to avoid changing the userspace API. - - I have successfully built an allyesconfig kernel with this change. - - Signed-off-by: "Eric W. Biederman" - Acked-by: Stephen Hemminger - Signed-off-by: David S. Miller - -Changed the struct members: - -struct netlink_notify->pid to -struct netlink_notify->portid - -struct genl_info->snd_pid to -struct genl_info->snd_portid - -To help backport this and not have to #ifdef around it against -kernel versions compat has introduced two helpers for us to -simply do the backport with two macro helpers: - -genl_info_snd_portid() -netlink_notify_portid() - -This takes care of the work for us requiring only one -single line change. If we get another patch thrown into -this file then I suspect we can extract SMPL out of it -and use it to backport further collateral evolutions like -this one should other drivers / subsystem need this change. - diff --git a/patches/collateral-evolutions/network/0005-netlink-portid/mac80211_hwsim.patch b/patches/collateral-evolutions/network/0005-netlink-portid/mac80211_hwsim.patch deleted file mode 100644 index 407de9bd5ab5..000000000000 --- a/patches/collateral-evolutions/network/0005-netlink-portid/mac80211_hwsim.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2064,10 +2064,10 @@ static int hwsim_register_received_nl(st - if (info == NULL) - goto out; - -- wmediumd_portid = info->snd_portid; -+ wmediumd_portid = genl_info_snd_portid(info); - - printk(KERN_DEBUG "mac80211_hwsim: received a REGISTER, " -- "switching to wmediumd mode with pid %d\n", info->snd_portid); -+ "switching to wmediumd mode with pid %d\n", genl_info_snd_portid(info)); - - return 0; - out: -@@ -2104,7 +2104,7 @@ static int mac80211_hwsim_netlink_notify - if (state != NETLINK_URELEASE) - return NOTIFY_DONE; - -- if (notify->portid == wmediumd_portid) { -+ if (netlink_notify_portid(notify) == wmediumd_portid) { - printk(KERN_INFO "mac80211_hwsim: wmediumd released netlink" - " socket, switching to perfect channel medium\n"); - wmediumd_portid = 0; diff --git a/patches/collateral-evolutions/network/0005-netlink-portid/nl80211.patch b/patches/collateral-evolutions/network/0005-netlink-portid/nl80211.patch deleted file mode 100644 index 622bedb648d3..000000000000 --- a/patches/collateral-evolutions/network/0005-netlink-portid/nl80211.patch +++ /dev/null @@ -1,267 +0,0 @@ ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -1637,7 +1637,7 @@ static int nl80211_dump_wiphy(struct sk_ - /* attempt to fit multiple wiphy data chunks into the skb */ - do { - ret = nl80211_send_wiphy(dev, skb, -- NETLINK_CB(cb->skb).portid, -+ NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, - NLM_F_MULTI, state); - if (ret < 0) { -@@ -1690,7 +1690,7 @@ static int nl80211_get_wiphy(struct sk_b - if (!msg) - return -ENOMEM; - -- if (nl80211_send_wiphy(dev, msg, info->snd_portid, info->snd_seq, 0, -+ if (nl80211_send_wiphy(dev, msg, genl_info_snd_portid(info), info->snd_seq, 0, - &state) < 0) { - nlmsg_free(msg); - return -ENOBUFS; -@@ -2265,7 +2265,7 @@ static int nl80211_dump_interface(struct - if_idx++; - continue; - } -- if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).portid, -+ if (nl80211_send_iface(skb, NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, NLM_F_MULTI, - rdev, wdev) < 0) { - goto out; -@@ -2294,7 +2294,7 @@ static int nl80211_get_interface(struct - if (!msg) - return -ENOMEM; - -- if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, -+ if (nl80211_send_iface(msg, genl_info_snd_portid(info), info->snd_seq, 0, - dev, wdev) < 0) { - nlmsg_free(msg); - return -ENOBUFS; -@@ -2527,7 +2527,7 @@ static int nl80211_new_interface(struct - break; - } - -- if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, -+ if (nl80211_send_iface(msg, genl_info_snd_portid(info), info->snd_seq, 0, - rdev, wdev) < 0) { - nlmsg_free(msg); - return -ENOBUFS; -@@ -2662,7 +2662,7 @@ static int nl80211_get_key(struct sk_buf - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_NEW_KEY); - if (!hdr) - return -ENOBUFS; -@@ -3631,7 +3631,7 @@ static int nl80211_dump_station(struct s - goto out_err; - - if (nl80211_send_station(skb, -- NETLINK_CB(cb->skb).portid, -+ NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, NLM_F_MULTI, - dev, wdev->netdev, mac_addr, - &sinfo) < 0) -@@ -3677,7 +3677,7 @@ static int nl80211_get_station(struct sk - if (!msg) - return -ENOMEM; - -- if (nl80211_send_station(msg, info->snd_portid, info->snd_seq, 0, -+ if (nl80211_send_station(msg, genl_info_snd_portid(info), info->snd_seq, 0, - rdev, dev, mac_addr, &sinfo) < 0) { - nlmsg_free(msg); - return -ENOBUFS; -@@ -4285,7 +4285,7 @@ static int nl80211_dump_mpath(struct sk_ - if (err) - goto out_err; - -- if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid, -+ if (nl80211_send_mpath(skb, NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, NLM_F_MULTI, - wdev->netdev, dst, next_hop, - &pinfo) < 0) -@@ -4334,7 +4334,7 @@ static int nl80211_get_mpath(struct sk_b - if (!msg) - return -ENOMEM; - -- if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0, -+ if (nl80211_send_mpath(msg, genl_info_snd_portid(info), info->snd_seq, 0, - dev, dst, next_hop, &pinfo) < 0) { - nlmsg_free(msg); - return -ENOBUFS; -@@ -4598,7 +4598,7 @@ static int nl80211_get_mesh_config(struc - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_GET_MESH_CONFIG); - if (!hdr) - goto out; -@@ -4957,7 +4957,7 @@ static int nl80211_get_reg(struct sk_buf - if (!msg) - return -ENOBUFS; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_GET_REG); - if (!hdr) - goto put_failure; -@@ -5762,7 +5762,7 @@ static int nl80211_send_bss(struct sk_bu - - ASSERT_WDEV_LOCK(wdev); - -- hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags, -+ hdr = nl80211hdr_put(msg, NETLINK_CB_PORTID(cb->skb), seq, flags, - NL80211_CMD_NEW_SCAN_RESULTS); - if (!hdr) - return -1; -@@ -5999,7 +5999,7 @@ static int nl80211_dump_survey(struct sk - } - - if (nl80211_send_survey(skb, -- NETLINK_CB(cb->skb).portid, -+ NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, NLM_F_MULTI, - wdev->netdev, &survey) < 0) - goto out; -@@ -6697,7 +6697,7 @@ static int nl80211_testmode_dump(struct - } - - while (1) { -- void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid, -+ void *hdr = nl80211hdr_put(skb, NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, NLM_F_MULTI, - NL80211_CMD_TESTMODE); - struct nlattr *tmdata; -@@ -6779,7 +6779,7 @@ struct sk_buff *cfg80211_testmode_alloc_ - return NULL; - - return __cfg80211_testmode_alloc_skb(rdev, approxlen, -- rdev->testmode_info->snd_portid, -+ genl_info_snd_portid(rdev->testmode_info), - rdev->testmode_info->snd_seq, - GFP_KERNEL); - } -@@ -7147,7 +7147,7 @@ static int nl80211_remain_on_channel(str - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_REMAIN_ON_CHANNEL); - if (!hdr) { - err = -ENOBUFS; -@@ -7365,7 +7365,7 @@ static int nl80211_register_mgmt(struct - if (!rdev->ops->mgmt_tx) - return -EOPNOTSUPP; - -- return cfg80211_mlme_register_mgmt(wdev, info->snd_portid, frame_type, -+ return cfg80211_mlme_register_mgmt(wdev, genl_info_snd_portid(info), frame_type, - nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]), - nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH])); - } -@@ -7446,7 +7446,7 @@ static int nl80211_tx_mgmt(struct sk_buf - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_FRAME); - if (!hdr) { - err = -ENOBUFS; -@@ -7560,7 +7560,7 @@ static int nl80211_get_power_save(struct - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_GET_POWER_SAVE); - if (!hdr) { - err = -ENOBUFS; -@@ -7867,7 +7867,7 @@ static int nl80211_get_wowlan(struct sk_ - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_GET_WOWLAN); - if (!hdr) - goto nla_put_failure; -@@ -8296,7 +8296,7 @@ static int nl80211_get_coalesce(struct s - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_GET_COALESCE); - if (!hdr) - goto nla_put_failure; -@@ -8549,7 +8549,7 @@ static int nl80211_register_unexpected_f - if (wdev->ap_unexpected_nlportid) - return -EBUSY; - -- wdev->ap_unexpected_nlportid = info->snd_portid; -+ wdev->ap_unexpected_nlportid = genl_info_snd_portid(info); - return 0; - } - -@@ -8579,7 +8579,7 @@ static int nl80211_probe_client(struct s - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_PROBE_CLIENT); - if (!hdr) { - err = -ENOBUFS; -@@ -8622,13 +8622,13 @@ static int nl80211_register_beacons(stru - /* First, check if already registered. */ - spin_lock_bh(&rdev->beacon_registrations_lock); - list_for_each_entry(reg, &rdev->beacon_registrations, list) { -- if (reg->nlportid == info->snd_portid) { -+ if (reg->nlportid == genl_info_snd_portid(info)) { - rv = -EALREADY; - goto out_err; - } - } - /* Add it to the list */ -- nreg->nlportid = info->snd_portid; -+ nreg->nlportid = genl_info_snd_portid(info); - list_add(&nreg->list, &rdev->beacon_registrations); - - spin_unlock_bh(&rdev->beacon_registrations_lock); -@@ -8695,7 +8695,7 @@ static int nl80211_get_protocol_features - if (!msg) - return -ENOMEM; - -- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, -+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0, - NL80211_CMD_GET_PROTOCOL_FEATURES); - if (!hdr) - goto nla_put_failure; -@@ -8770,7 +8770,7 @@ static int nl80211_crit_protocol_start(s - - ret = rdev_crit_proto_start(rdev, wdev, proto, duration); - if (!ret) -- rdev->crit_proto_nlportid = info->snd_portid; -+ rdev->crit_proto_nlportid = genl_info_snd_portid(info); - - return ret; - } -@@ -11172,12 +11172,12 @@ static int nl80211_netlink_notify(struct - - list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) { - list_for_each_entry_rcu(wdev, &rdev->wdev_list, list) -- cfg80211_mlme_unregister_socket(wdev, notify->portid); -+ cfg80211_mlme_unregister_socket(wdev, netlink_notify_portid(notify)); - - spin_lock_bh(&rdev->beacon_registrations_lock); - list_for_each_entry_safe(reg, tmp, &rdev->beacon_registrations, - list) { -- if (reg->nlportid == notify->portid) { -+ if (reg->nlportid == netlink_notify_portid(notify)) { - list_del(®->list); - kfree(reg); - break; diff --git a/patches/collateral-evolutions/nfc/01-netlink-portid/INFO b/patches/collateral-evolutions/nfc/01-netlink-portid/INFO deleted file mode 100644 index e49ac3b625c1..000000000000 --- a/patches/collateral-evolutions/nfc/01-netlink-portid/INFO +++ /dev/null @@ -1,42 +0,0 @@ -The patch: - -commit 15e473046cb6e5d18a4d0057e61d76315230382b -Author: Eric W. Biederman -Date: Fri Sep 7 20:12:54 2012 +0000 - - netlink: Rename pid to portid to avoid confusion - - It is a frequent mistake to confuse the netlink port identifier with a - process identifier. Try to reduce this confusion by renaming fields - that hold port identifiers portid instead of pid. - - I have carefully avoided changing the structures exported to - userspace to avoid changing the userspace API. - - I have successfully built an allyesconfig kernel with this change. - - Signed-off-by: "Eric W. Biederman" - Acked-by: Stephen Hemminger - Signed-off-by: David S. Miller - -Changed the struct members: - -struct netlink_notify->pid to -struct netlink_notify->portid - -struct genl_info->snd_pid to -struct genl_info->snd_portid - -To help backport this and not have to #ifdef around it against -kernel versions compat has introduced two helpers for us to -simply do the backport with two macro helpers: - -genl_info_snd_portid() -netlink_notify_portid() - -This takes care of the work for us requiring only one -single line change. If we get another patch thrown into -this file then I suspect we can extract SMPL out of it -and use it to backport further collateral evolutions like -this one should other drivers / subsystem need this change. - diff --git a/patches/collateral-evolutions/nfc/01-netlink-portid/net_nfc_netlink.patch b/patches/collateral-evolutions/nfc/01-netlink-portid/net_nfc_netlink.patch deleted file mode 100644 index e87ae9e581fe..000000000000 --- a/patches/collateral-evolutions/nfc/01-netlink-portid/net_nfc_netlink.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- a/net/nfc/netlink.c -+++ b/net/nfc/netlink.c -@@ -71,7 +71,7 @@ static int nfc_genl_send_target(struct s - { - void *hdr; - -- hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, -+ hdr = genlmsg_put(msg, NETLINK_CB_PORTID(cb->skb), cb->nlh->nlmsg_seq, - &nfc_genl_family, flags, NFC_CMD_GET_TARGET); - if (!hdr) - return -EMSGSIZE; -@@ -546,7 +546,7 @@ static int nfc_genl_dump_devices(struct - while (dev) { - int rc; - -- rc = nfc_genl_send_device(skb, dev, NETLINK_CB(cb->skb).portid, -+ rc = nfc_genl_send_device(skb, dev, NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, cb, NLM_F_MULTI); - if (rc < 0) - break; -@@ -665,7 +665,7 @@ static int nfc_genl_get_device(struct sk - goto out_putdev; - } - -- rc = nfc_genl_send_device(msg, dev, info->snd_portid, info->snd_seq, -+ rc = nfc_genl_send_device(msg, dev, genl_info_snd_portid(info), info->snd_seq, - NULL, 0); - if (rc < 0) - goto out_free; -@@ -756,7 +756,7 @@ static int nfc_genl_start_poll(struct sk - - rc = nfc_start_poll(dev, im_protocols, tm_protocols); - if (!rc) -- dev->genl_data.poll_req_portid = info->snd_portid; -+ dev->genl_data.poll_req_portid = genl_info_snd_portid(info); - - mutex_unlock(&dev->genl_data.genl_data_mutex); - -@@ -790,7 +790,7 @@ static int nfc_genl_stop_poll(struct sk_ - - mutex_lock(&dev->genl_data.genl_data_mutex); - -- if (dev->genl_data.poll_req_portid != info->snd_portid) { -+ if (dev->genl_data.poll_req_portid != genl_info_snd_portid(info)) { - rc = -EBUSY; - goto out; - } -@@ -916,7 +916,7 @@ static int nfc_genl_llc_get_params(struc - goto exit; - } - -- rc = nfc_genl_send_params(msg, local, info->snd_portid, info->snd_seq); -+ rc = nfc_genl_send_params(msg, local, genl_info_snd_portid(info), info->snd_seq); - - exit: - device_unlock(&dev->dev); -@@ -1254,7 +1254,7 @@ static int nfc_genl_dump_ses(struct sk_b - while (dev) { - int rc; - -- rc = nfc_genl_send_se(skb, dev, NETLINK_CB(cb->skb).portid, -+ rc = nfc_genl_send_se(skb, dev, NETLINK_CB_PORTID(cb->skb), - cb->nlh->nlmsg_seq, cb, NLM_F_MULTI); - if (rc < 0) - break; -@@ -1499,12 +1499,12 @@ static int nfc_genl_rcv_nl_event(struct - if (event != NETLINK_URELEASE || n->protocol != NETLINK_GENERIC) - goto out; - -- pr_debug("NETLINK_URELEASE event from id %d\n", n->portid); -+ pr_debug("NETLINK_URELEASE event from id %d\n", netlink_notify_portid(n)); - - w = kmalloc(sizeof(*w), GFP_ATOMIC); - if (w) { - INIT_WORK((struct work_struct *) w, nfc_urelease_event_work); -- w->portid = n->portid; -+ w->portid = netlink_notify_portid(n); - schedule_work((struct work_struct *) w); - } - -- 2.30.2