diff options
Diffstat (limited to 'net/nfc/netlink.c')
-rw-r--r-- | net/nfc/netlink.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index ccdff7953f7d..03f8818e1f16 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -367,6 +367,52 @@ out_putdev: | |||
367 | return rc; | 367 | return rc; |
368 | } | 368 | } |
369 | 369 | ||
370 | static int nfc_genl_dev_up(struct sk_buff *skb, struct genl_info *info) | ||
371 | { | ||
372 | struct nfc_dev *dev; | ||
373 | int rc; | ||
374 | u32 idx; | ||
375 | |||
376 | nfc_dbg("entry"); | ||
377 | |||
378 | if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) | ||
379 | return -EINVAL; | ||
380 | |||
381 | idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); | ||
382 | |||
383 | dev = nfc_get_device(idx); | ||
384 | if (!dev) | ||
385 | return -ENODEV; | ||
386 | |||
387 | rc = nfc_dev_up(dev); | ||
388 | |||
389 | nfc_put_device(dev); | ||
390 | return rc; | ||
391 | } | ||
392 | |||
393 | static int nfc_genl_dev_down(struct sk_buff *skb, struct genl_info *info) | ||
394 | { | ||
395 | struct nfc_dev *dev; | ||
396 | int rc; | ||
397 | u32 idx; | ||
398 | |||
399 | nfc_dbg("entry"); | ||
400 | |||
401 | if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) | ||
402 | return -EINVAL; | ||
403 | |||
404 | idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); | ||
405 | |||
406 | dev = nfc_get_device(idx); | ||
407 | if (!dev) | ||
408 | return -ENODEV; | ||
409 | |||
410 | rc = nfc_dev_down(dev); | ||
411 | |||
412 | nfc_put_device(dev); | ||
413 | return rc; | ||
414 | } | ||
415 | |||
370 | static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info) | 416 | static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info) |
371 | { | 417 | { |
372 | struct nfc_dev *dev; | 418 | struct nfc_dev *dev; |
@@ -441,6 +487,16 @@ static struct genl_ops nfc_genl_ops[] = { | |||
441 | .policy = nfc_genl_policy, | 487 | .policy = nfc_genl_policy, |
442 | }, | 488 | }, |
443 | { | 489 | { |
490 | .cmd = NFC_CMD_DEV_UP, | ||
491 | .doit = nfc_genl_dev_up, | ||
492 | .policy = nfc_genl_policy, | ||
493 | }, | ||
494 | { | ||
495 | .cmd = NFC_CMD_DEV_DOWN, | ||
496 | .doit = nfc_genl_dev_down, | ||
497 | .policy = nfc_genl_policy, | ||
498 | }, | ||
499 | { | ||
444 | .cmd = NFC_CMD_START_POLL, | 500 | .cmd = NFC_CMD_START_POLL, |
445 | .doit = nfc_genl_start_poll, | 501 | .doit = nfc_genl_start_poll, |
446 | .policy = nfc_genl_policy, | 502 | .policy = nfc_genl_policy, |