[RFC v1 02/14] nfc: nci: Add handle to manage nci response from nci proprietary command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




In order to manage nci response from proprietary nci command, add a
specific handle.

Signed-off-by: Christophe Ricard <christophe-h.ricard@xxxxxx>
---
 include/net/nfc/nci_core.h | 2 ++
 net/nfc/nci/rsp.c          | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index d4dcc71..419cda4 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -84,6 +84,8 @@ struct nci_ops {
 				    struct sk_buff *skb);
 	void  (*hci_cmd_received)(struct nci_dev *ndev, u8 pipe, u8 cmd,
 				  struct sk_buff *skb);
+	int   (*prop_rsp_packet)(struct nci_dev *ndev, __u16 rsp_opcode,
+				 struct sk_buff *skb);
 };
 
 #define NCI_MAX_SUPPORTED_RF_INTERFACES		4
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 02486bc..00478b3 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -283,6 +283,7 @@ static void nci_core_conn_close_rsp_packet(struct nci_dev *ndev,
 void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 {
 	__u16 rsp_opcode = nci_opcode(skb->data);
+	int ret;
 
 	/* we got a rsp, stop the cmd timer */
 	del_timer(&ndev->cmd_timer);
@@ -342,7 +343,13 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		break;
 
 	default:
-		pr_err("unknown rsp opcode 0x%x\n", rsp_opcode);
+		if (ndev->ops->prop_rsp_packet)
+			ret = ndev->ops->prop_rsp_packet(ndev, rsp_opcode, skb);
+		else
+			ret = -EPROTO;
+
+		if (ret < 0)
+			pr_err("unknown rsp opcode 0x%x\n", rsp_opcode);
 		break;
 	}
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux