diff options
author | Alexander Usyskin <alexander.usyskin@intel.com> | 2016-11-16 21:51:29 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-17 16:37:49 +0100 |
commit | 7c7a6077f5c7a35fc03a7f452875d8440dd1bc8d (patch) | |
tree | e495b143494b3a7b98ce1841d8cc3c2a5f97c2cf /drivers/nfc | |
parent | mei: bus: make a client pointer always available (diff) | |
download | linux-7c7a6077f5c7a35fc03a7f452875d8440dd1bc8d.tar.xz linux-7c7a6077f5c7a35fc03a7f452875d8440dd1bc8d.zip |
mei: bus: split RX and async notification callbacks
Split callbacks for RX and async notification events on mei bus to
eliminate synchronization problems and to open way for RX optimizations.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/mei_phy.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c index 03139c5a05e4..8a04c5e02999 100644 --- a/drivers/nfc/mei_phy.c +++ b/drivers/nfc/mei_phy.c @@ -297,9 +297,11 @@ static int mei_nfc_recv(struct nfc_mei_phy *phy, u8 *buf, size_t length) } -static void nfc_mei_event_cb(struct mei_cl_device *cldev, u32 events) +static void nfc_mei_rx_cb(struct mei_cl_device *cldev) { struct nfc_mei_phy *phy = mei_cldev_get_drvdata(cldev); + struct sk_buff *skb; + int reply_size; if (!phy) return; @@ -307,27 +309,22 @@ static void nfc_mei_event_cb(struct mei_cl_device *cldev, u32 events) if (phy->hard_fault != 0) return; - if (events & BIT(MEI_CL_EVENT_RX)) { - struct sk_buff *skb; - int reply_size; - - skb = alloc_skb(MEI_NFC_MAX_READ, GFP_KERNEL); - if (!skb) - return; + skb = alloc_skb(MEI_NFC_MAX_READ, GFP_KERNEL); + if (!skb) + return; - reply_size = mei_nfc_recv(phy, skb->data, MEI_NFC_MAX_READ); - if (reply_size < MEI_NFC_HEADER_SIZE) { - kfree_skb(skb); - return; - } + reply_size = mei_nfc_recv(phy, skb->data, MEI_NFC_MAX_READ); + if (reply_size < MEI_NFC_HEADER_SIZE) { + kfree_skb(skb); + return; + } - skb_put(skb, reply_size); - skb_pull(skb, MEI_NFC_HEADER_SIZE); + skb_put(skb, reply_size); + skb_pull(skb, MEI_NFC_HEADER_SIZE); - MEI_DUMP_SKB_IN("mei frame read", skb); + MEI_DUMP_SKB_IN("mei frame read", skb); - nfc_hci_recv_frame(phy->hdev, skb); - } + nfc_hci_recv_frame(phy->hdev, skb); } static int nfc_mei_phy_enable(void *phy_id) @@ -358,8 +355,7 @@ static int nfc_mei_phy_enable(void *phy_id) goto err; } - r = mei_cldev_register_event_cb(phy->cldev, BIT(MEI_CL_EVENT_RX), - nfc_mei_event_cb); + r = mei_cldev_register_rx_cb(phy->cldev, nfc_mei_rx_cb); if (r) { pr_err("Event cb registration failed %d\n", r); goto err; |