diff options
author | Robert Dolca <robert.dolca@intel.com> | 2015-10-22 05:11:37 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-10-25 14:12:13 -0400 |
commit | 7bc4824ed5cf9feb0173b90a6bec28f694a5f7ce (patch) | |
tree | f11f16914518152b0b8f50029a0bb2e6499890ba /net/nfc | |
parent | e4dbd62528931951aa9d3b313ee7d536df5069fc (diff) |
NFC: nci: Introduce nci_core_cmd
This allows sending core commands from the driver. The driver
should be able to send NCI core commands like CORE_GET_CONFIG_CMD.
Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/nci/core.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 5362d8f543e7..5b4f48a827d9 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -325,32 +325,46 @@ static void nci_rf_deactivate_req(struct nci_dev *ndev, unsigned long opt) | |||
325 | sizeof(struct nci_rf_deactivate_cmd), &cmd); | 325 | sizeof(struct nci_rf_deactivate_cmd), &cmd); |
326 | } | 326 | } |
327 | 327 | ||
328 | struct nci_prop_cmd_param { | 328 | struct nci_cmd_param { |
329 | __u16 opcode; | 329 | __u16 opcode; |
330 | size_t len; | 330 | size_t len; |
331 | __u8 *payload; | 331 | __u8 *payload; |
332 | }; | 332 | }; |
333 | 333 | ||
334 | static void nci_prop_cmd_req(struct nci_dev *ndev, unsigned long opt) | 334 | static void nci_generic_req(struct nci_dev *ndev, unsigned long opt) |
335 | { | 335 | { |
336 | struct nci_prop_cmd_param *param = (struct nci_prop_cmd_param *)opt; | 336 | struct nci_cmd_param *param = |
337 | (struct nci_cmd_param *)opt; | ||
337 | 338 | ||
338 | nci_send_cmd(ndev, param->opcode, param->len, param->payload); | 339 | nci_send_cmd(ndev, param->opcode, param->len, param->payload); |
339 | } | 340 | } |
340 | 341 | ||
341 | int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload) | 342 | int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload) |
342 | { | 343 | { |
343 | struct nci_prop_cmd_param param; | 344 | struct nci_cmd_param param; |
344 | 345 | ||
345 | param.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY, oid); | 346 | param.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY, oid); |
346 | param.len = len; | 347 | param.len = len; |
347 | param.payload = payload; | 348 | param.payload = payload; |
348 | 349 | ||
349 | return __nci_request(ndev, nci_prop_cmd_req, (unsigned long)¶m, | 350 | return __nci_request(ndev, nci_generic_req, (unsigned long)¶m, |
350 | msecs_to_jiffies(NCI_CMD_TIMEOUT)); | 351 | msecs_to_jiffies(NCI_CMD_TIMEOUT)); |
351 | } | 352 | } |
352 | EXPORT_SYMBOL(nci_prop_cmd); | 353 | EXPORT_SYMBOL(nci_prop_cmd); |
353 | 354 | ||
355 | int nci_core_cmd(struct nci_dev *ndev, __u16 opcode, size_t len, __u8 *payload) | ||
356 | { | ||
357 | struct nci_cmd_param param; | ||
358 | |||
359 | param.opcode = opcode; | ||
360 | param.len = len; | ||
361 | param.payload = payload; | ||
362 | |||
363 | return __nci_request(ndev, nci_generic_req, (unsigned long)¶m, | ||
364 | msecs_to_jiffies(NCI_CMD_TIMEOUT)); | ||
365 | } | ||
366 | EXPORT_SYMBOL(nci_core_cmd); | ||
367 | |||
354 | int nci_core_reset(struct nci_dev *ndev) | 368 | int nci_core_reset(struct nci_dev *ndev) |
355 | { | 369 | { |
356 | return __nci_request(ndev, nci_reset_req, 0, | 370 | return __nci_request(ndev, nci_reset_req, 0, |