Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 300870
b: refs/heads/master
c: 8112a5c
h: refs/heads/master
v: v3
  • Loading branch information
Samuel Ortiz authored and John W. Linville committed Apr 12, 2012
1 parent 014f6a3 commit e234792
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 997002785e3f932fd26a0f9c3cd91d4b4861ed29
refs/heads/master: 8112a5c91d781a22d2b631f3295386b0b70de7c8
1 change: 1 addition & 0 deletions trunk/include/linux/nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ enum nfc_commands {
NFC_EVENT_TARGETS_FOUND,
NFC_EVENT_DEVICE_ADDED,
NFC_EVENT_DEVICE_REMOVED,
NFC_EVENT_TARGET_LOST,
/* private: internal use only */
__NFC_CMD_AFTER_LAST
};
Expand Down
30 changes: 30 additions & 0 deletions trunk/net/nfc/netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,36 @@ int nfc_genl_targets_found(struct nfc_dev *dev)
return -EMSGSIZE;
}

int nfc_genl_target_lost(struct nfc_dev *dev, u32 target_idx)
{
struct sk_buff *msg;
void *hdr;

msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
if (!msg)
return -ENOMEM;

hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0,
NFC_EVENT_TARGET_LOST);
if (!hdr)
goto free_msg;

NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev));
NLA_PUT_U32(msg, NFC_ATTR_TARGET_INDEX, target_idx);

genlmsg_end(msg, hdr);

genlmsg_multicast(msg, 0, nfc_genl_event_mcgrp.id, GFP_KERNEL);

return 0;

nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg:
nlmsg_free(msg);
return -EMSGSIZE;
}

int nfc_genl_device_added(struct nfc_dev *dev)
{
struct sk_buff *msg;
Expand Down
1 change: 1 addition & 0 deletions trunk/net/nfc/nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ void nfc_genl_data_init(struct nfc_genl_data *genl_data);
void nfc_genl_data_exit(struct nfc_genl_data *genl_data);

int nfc_genl_targets_found(struct nfc_dev *dev);
int nfc_genl_target_lost(struct nfc_dev *dev, u32 target_idx);

int nfc_genl_device_added(struct nfc_dev *dev);
int nfc_genl_device_removed(struct nfc_dev *dev);
Expand Down

0 comments on commit e234792

Please sign in to comment.