devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Ricard <christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
Cc: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
	christophe-h.ricard-qxv4g6HH51o@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: [RFC v1 03/14] nfc: nci: Add handle to manage nci notification from nci proprietary command
Date: Fri,  1 May 2015 22:19:26 +0200	[thread overview]
Message-ID: <1430511577-19678-4-git-send-email-christophe-h.ricard@st.com> (raw)
In-Reply-To: <1430511577-19678-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>

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

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
---
 include/net/nfc/nci_core.h | 2 ++
 net/nfc/nci/ntf.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 419cda4..c0dc55c 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -86,6 +86,8 @@ struct nci_ops {
 				  struct sk_buff *skb);
 	int   (*prop_rsp_packet)(struct nci_dev *ndev, __u16 rsp_opcode,
 				 struct sk_buff *skb);
+	int   (*prop_ntf_packet)(struct nci_dev *ndev, __u16 ntf_opcode,
+				 struct sk_buff *skb);
 };
 
 #define NCI_MAX_SUPPORTED_RF_INTERFACES		4
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 3218071..a2ac40b 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -748,6 +748,7 @@ static void nci_nfcee_action_ntf_packet(struct nci_dev *ndev,
 void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
 {
 	__u16 ntf_opcode = nci_opcode(skb->data);
+	int ret;
 
 	pr_debug("NCI RX: MT=ntf, PBF=%d, GID=0x%x, OID=0x%x, plen=%d\n",
 		 nci_pbf(skb->data),
@@ -792,7 +793,13 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
 		break;
 
 	default:
-		pr_err("unknown ntf opcode 0x%x\n", ntf_opcode);
+		if (ndev->ops->prop_ntf_packet)
+			ret = ndev->ops->prop_ntf_packet(ndev, ntf_opcode, skb);
+		else
+			ret = -EPROTO;
+
+		if (ret < 0)
+			pr_err("unknown ntf opcode 0x%x\n", ntf_opcode);
 		break;
 	}
 
-- 
2.1.4

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

  parent reply	other threads:[~2015-05-01 20:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 20:19 [RFC v1 00/14] Few fixes, add hibernate and ST21NFCC support Christophe Ricard
2015-05-01 20:19 ` [RFC v1 01/14] NFC: st21nfcb: Remove inappropriate kfree on a devm_kzalloc pointer Christophe Ricard
2015-05-01 20:19 ` [RFC v1 04/14] nfc: st21nfcb: Do not remove header once the payload is sent Christophe Ricard
     [not found] ` <1430511577-19678-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2015-05-01 20:19   ` [RFC v1 02/14] nfc: nci: Add handle to manage nci response from nci proprietary command Christophe Ricard
     [not found]     ` <1430511577-19678-3-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2015-05-30  1:29       ` Samuel Ortiz
2015-05-01 20:19   ` Christophe Ricard [this message]
2015-05-01 20:19   ` [RFC v1 05/14] nfc: nci: Move close ops call in nci_close_device Christophe Ricard
2015-05-01 20:19   ` [RFC v1 06/14] nfc: nci: Remove code style warning Christophe Ricard
2015-05-01 20:19   ` [RFC v1 07/14] nfc: st21nfcb: Move st21nfcb_nci_remove in ndlc_remove Christophe Ricard
2015-05-01 20:19   ` [RFC v1 08/14] nfc: st21nfcb: remove st21nfcb_nci_i2c_disable in st21nfcb_nci_i2c_remove Christophe Ricard
2015-05-01 20:19   ` [RFC v1 09/14] nfc: st21nfcb: Move powered flag from phy to ndlc layer Christophe Ricard
2015-05-01 20:19   ` [RFC v1 10/14] nfc: st21nfcb: Add ndlc_close in st21nfcb_nci_remove Christophe Ricard
2015-05-01 20:19   ` [RFC v1 11/14] nfc: st21nfcb: Add support for nci set mode proprietary command Christophe Ricard
     [not found]     ` <1430511577-19678-12-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2015-05-30  1:30       ` Samuel Ortiz
2015-05-01 20:19   ` [RFC v1 12/14] nfc: st21nfcb: disable irq when st21nfcb is disabled Christophe Ricard
2015-05-01 20:19   ` [RFC v1 13/14] nfc: st21nfcb: Use hibernate nci command in ndlc_open and ndlc_close Christophe Ricard
2015-05-01 20:19   ` [RFC v1 14/14] nfc: st-nci: Rename st21nfcb to st-nci to support ST NCI NFC controllers Christophe Ricard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430511577-19678-4-git-send-email-christophe-h.ricard@st.com \
    --to=christophe.ricard-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=christophe-h.ricard-qxv4g6HH51o@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfc-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).