mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 13:50:52 +07:00
NFC: Changed the HCI cmd execution callback prototype
Make it match the data_exchange_cb_t so that it can be used directly in the implementation of an asynchronous hci_transceive Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
c1be211727
commit
b5faa648fa
@ -28,10 +28,15 @@
|
||||
|
||||
#include "hci.h"
|
||||
|
||||
static void nfc_hci_execute_cb(struct nfc_hci_dev *hdev, int err,
|
||||
struct sk_buff *skb, void *cb_data)
|
||||
/*
|
||||
* HCI command execution completion callback.
|
||||
* err will be a standard linux error (may be converted from HCI response)
|
||||
* skb contains the response data and must be disposed, or may be NULL if
|
||||
* an error occured
|
||||
*/
|
||||
static void nfc_hci_execute_cb(void *context, struct sk_buff *skb, int err)
|
||||
{
|
||||
struct hcp_exec_waiter *hcp_ew = (struct hcp_exec_waiter *)cb_data;
|
||||
struct hcp_exec_waiter *hcp_ew = (struct hcp_exec_waiter *)context;
|
||||
|
||||
pr_debug("HCI Cmd completed with result=%d\n", err);
|
||||
|
||||
|
@ -57,12 +57,11 @@ static void nfc_hci_msg_tx_work(struct work_struct *work)
|
||||
if (hdev->cmd_pending_msg) {
|
||||
if (timer_pending(&hdev->cmd_timer) == 0) {
|
||||
if (hdev->cmd_pending_msg->cb)
|
||||
hdev->cmd_pending_msg->cb(hdev,
|
||||
-ETIME,
|
||||
NULL,
|
||||
hdev->
|
||||
hdev->cmd_pending_msg->cb(hdev->
|
||||
cmd_pending_msg->
|
||||
cb_context);
|
||||
cb_context,
|
||||
NULL,
|
||||
-ETIME);
|
||||
kfree(hdev->cmd_pending_msg);
|
||||
hdev->cmd_pending_msg = NULL;
|
||||
} else
|
||||
@ -83,7 +82,7 @@ static void nfc_hci_msg_tx_work(struct work_struct *work)
|
||||
kfree_skb(skb);
|
||||
skb_queue_purge(&msg->msg_frags);
|
||||
if (msg->cb)
|
||||
msg->cb(hdev, r, NULL, msg->cb_context);
|
||||
msg->cb(msg->cb_context, NULL, r);
|
||||
kfree(msg);
|
||||
break;
|
||||
}
|
||||
@ -133,8 +132,8 @@ static void __nfc_hci_cmd_completion(struct nfc_hci_dev *hdev, int err,
|
||||
del_timer_sync(&hdev->cmd_timer);
|
||||
|
||||
if (hdev->cmd_pending_msg->cb)
|
||||
hdev->cmd_pending_msg->cb(hdev, err, skb,
|
||||
hdev->cmd_pending_msg->cb_context);
|
||||
hdev->cmd_pending_msg->cb(hdev->cmd_pending_msg->cb_context,
|
||||
skb, err);
|
||||
else
|
||||
kfree_skb(skb);
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef __LOCAL_HCI_H
|
||||
#define __LOCAL_HCI_H
|
||||
|
||||
#include <net/nfc/hci.h>
|
||||
|
||||
struct gate_pipe_map {
|
||||
u8 gate;
|
||||
u8 pipe;
|
||||
@ -35,15 +37,6 @@ struct hcp_packet {
|
||||
struct hcp_message message;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* HCI command execution completion callback.
|
||||
* result will be a standard linux error (may be converted from HCI response)
|
||||
* skb contains the response data and must be disposed, or may be NULL if
|
||||
* an error occured
|
||||
*/
|
||||
typedef void (*hci_cmd_cb_t) (struct nfc_hci_dev *hdev, int result,
|
||||
struct sk_buff *skb, void *cb_data);
|
||||
|
||||
struct hcp_exec_waiter {
|
||||
wait_queue_head_t *wq;
|
||||
bool exec_complete;
|
||||
@ -55,7 +48,7 @@ struct hci_msg {
|
||||
struct list_head msg_l;
|
||||
struct sk_buff_head msg_frags;
|
||||
bool wait_response;
|
||||
hci_cmd_cb_t cb;
|
||||
data_exchange_cb_t cb;
|
||||
void *cb_context;
|
||||
unsigned long completion_delay;
|
||||
};
|
||||
@ -83,7 +76,7 @@ struct hci_create_pipe_resp {
|
||||
int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe,
|
||||
u8 type, u8 instruction,
|
||||
const u8 *payload, size_t payload_len,
|
||||
hci_cmd_cb_t cb, void *cb_data,
|
||||
data_exchange_cb_t cb, void *cb_context,
|
||||
unsigned long completion_delay);
|
||||
|
||||
u8 nfc_hci_pipe2gate(struct nfc_hci_dev *hdev, u8 pipe);
|
||||
|
@ -35,7 +35,7 @@
|
||||
int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe,
|
||||
u8 type, u8 instruction,
|
||||
const u8 *payload, size_t payload_len,
|
||||
hci_cmd_cb_t cb, void *cb_data,
|
||||
data_exchange_cb_t cb, void *cb_context,
|
||||
unsigned long completion_delay)
|
||||
{
|
||||
struct nfc_dev *ndev = hdev->ndev;
|
||||
@ -52,7 +52,7 @@ int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe,
|
||||
skb_queue_head_init(&cmd->msg_frags);
|
||||
cmd->wait_response = (type == NFC_HCI_HCP_COMMAND) ? true : false;
|
||||
cmd->cb = cb;
|
||||
cmd->cb_context = cb_data;
|
||||
cmd->cb_context = cb_context;
|
||||
cmd->completion_delay = completion_delay;
|
||||
|
||||
hci_len = payload_len + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user