linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@linux.intel.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: Lauro Ramos Venancio <lauro.venancio@openbossa.org>,
	Aloisio Almeida Jr <aloisio.almeida@openbossa.org>,
	Ilan Elias <ilane@ti.com>,
	linux-wireless@vger.kernel.org,
	Eric Lapuyade <eric.lapuyade@intel.com>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: [PATCH 05/20] NFC: Add HCI/SHDLC support to let driver check for tag presence
Date: Mon,  7 May 2012 12:31:16 +0200	[thread overview]
Message-ID: <1336386691-24840-6-git-send-email-sameo@linux.intel.com> (raw)
In-Reply-To: <1336386691-24840-1-git-send-email-sameo@linux.intel.com>

From: Eric Lapuyade <eric.lapuyade@intel.com>

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---
 include/net/nfc/hci.h   |    2 ++
 include/net/nfc/shdlc.h |    2 ++
 net/nfc/hci/core.c      |   12 ++++++++++++
 net/nfc/hci/shdlc.c     |   12 ++++++++++++
 4 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 95fc0c2..ae04200 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -39,6 +39,8 @@ struct nfc_hci_ops {
 	int (*data_exchange) (struct nfc_hci_dev *hdev,
 			      struct nfc_target *target,
 			      struct sk_buff *skb, struct sk_buff **res_skb);
+	int (*check_presence)(struct nfc_hci_dev *hdev,
+			      struct nfc_target *target);
 };
 
 #define NFC_HCI_MAX_CUSTOM_GATES	15
diff --git a/include/net/nfc/shdlc.h b/include/net/nfc/shdlc.h
index 1071987..ab06afd 100644
--- a/include/net/nfc/shdlc.h
+++ b/include/net/nfc/shdlc.h
@@ -35,6 +35,8 @@ struct nfc_shdlc_ops {
 	int (*data_exchange) (struct nfc_shdlc *shdlc,
 			      struct nfc_target *target,
 			      struct sk_buff *skb, struct sk_buff **res_skb);
+	int (*check_presence)(struct nfc_shdlc *shdlc,
+			      struct nfc_target *target);
 };
 
 enum shdlc_state {
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index ef5cd5c9..f7e4f5a 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -574,6 +574,17 @@ static int hci_data_exchange(struct nfc_dev *nfc_dev, struct nfc_target *target,
 	return 0;
 }
 
+static int hci_check_presence(struct nfc_dev *nfc_dev,
+			      struct nfc_target *target)
+{
+	struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
+
+	if (hdev->ops->check_presence)
+		return hdev->ops->check_presence(hdev, target);
+
+	return 0;
+}
+
 struct nfc_ops hci_nfc_ops = {
 	.dev_up = hci_dev_up,
 	.dev_down = hci_dev_down,
@@ -582,6 +593,7 @@ struct nfc_ops hci_nfc_ops = {
 	.activate_target = hci_activate_target,
 	.deactivate_target = hci_deactivate_target,
 	.data_exchange = hci_data_exchange,
+	.check_presence = hci_check_presence,
 };
 
 struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
diff --git a/net/nfc/hci/shdlc.c b/net/nfc/hci/shdlc.c
index 923bdf7..5665dc6 100644
--- a/net/nfc/hci/shdlc.c
+++ b/net/nfc/hci/shdlc.c
@@ -816,6 +816,17 @@ static int nfc_shdlc_data_exchange(struct nfc_hci_dev *hdev,
 	return -EPERM;
 }
 
+static int nfc_shdlc_check_presence(struct nfc_hci_dev *hdev,
+				    struct nfc_target *target)
+{
+	struct nfc_shdlc *shdlc = nfc_hci_get_clientdata(hdev);
+
+	if (shdlc->ops->check_presence)
+		return shdlc->ops->check_presence(shdlc, target);
+
+	return 0;
+}
+
 static struct nfc_hci_ops shdlc_ops = {
 	.open = nfc_shdlc_open,
 	.close = nfc_shdlc_close,
@@ -825,6 +836,7 @@ static struct nfc_hci_ops shdlc_ops = {
 	.target_from_gate = nfc_shdlc_target_from_gate,
 	.complete_target_discovered = nfc_shdlc_complete_target_discovered,
 	.data_exchange = nfc_shdlc_data_exchange,
+	.check_presence = nfc_shdlc_check_presence,
 };
 
 struct nfc_shdlc *nfc_shdlc_allocate(struct nfc_shdlc_ops *ops,
-- 
1.7.9.1


  parent reply	other threads:[~2012-05-07 10:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07 10:31 [PATCH 00/20] NFC updates for 3.5 Samuel Ortiz
2012-05-07 10:31 ` [PATCH 01/20] NFC: Fix up for NLA_PUT_ api changes Samuel Ortiz
2012-05-07 13:01   ` Stephen Rothwell
2012-05-07 10:31 ` [PATCH 02/20] NFC: Cache the core NFC active target pointer instead of its index Samuel Ortiz
2012-05-07 10:31 ` [PATCH 03/20] NFC: Remove useless HCI private nfc target table Samuel Ortiz
2012-05-07 10:31 ` [PATCH 04/20] NFC: Specify usage for targets found and target lost events Samuel Ortiz
2012-05-07 10:31 ` Samuel Ortiz [this message]
2012-05-07 10:31 ` [PATCH 06/20] NFC: Update Documentation/nfc-hci.txt Samuel Ortiz
2012-05-07 10:31 ` [PATCH 07/20] NFC: Remove unneeded pn533 dev NULL check Samuel Ortiz
2012-05-07 10:31 ` [PATCH 08/20] NFC: LLCP connect must wait for a CC frame Samuel Ortiz
2012-05-07 10:31 ` [PATCH 09/20] NFC: Update the LLCP poll mask Samuel Ortiz
2012-05-07 10:31 ` [PATCH 10/20] NFC: Return the amount of LLCP bytes queued to sock_sendmsg Samuel Ortiz
2012-05-07 10:31 ` [PATCH 11/20] NFC: Send device index instead of its name when target is lost Samuel Ortiz
2012-05-07 10:31 ` [PATCH 12/20] NFC: Fix LLCP compilation warning Samuel Ortiz
2012-05-07 10:31 ` [PATCH 13/20] NFC: Quiet nci/data.c sparse noise about plain integer as NULL pointer Samuel Ortiz
2012-05-07 10:31 ` [PATCH 14/20] NFC: Include nci_core.h to nci/lib.c Samuel Ortiz
2012-05-07 10:31 ` [PATCH 15/20] NFC: Quiet nci/ntf.c sparse noise about plain integer as NULL pointer Samuel Ortiz
2012-05-07 10:31 ` [PATCH 16/20] NFC: HCI ops should not be exposed globally Samuel Ortiz
2012-05-07 10:31 ` [PATCH 17/20] NFC: The NFC genl family structure " Samuel Ortiz
2012-05-07 10:31 ` [PATCH 18/20] NFC: HCI based pn544 driver Samuel Ortiz
2012-05-07 10:31 ` [PATCH 19/20] feature-removal: Remove pn544 raw driver Samuel Ortiz
2012-05-07 10:31 ` [PATCH 20/20] NFC: HCI drivers don't have to keep track of polling state Samuel Ortiz

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=1336386691-24840-6-git-send-email-sameo@linux.intel.com \
    --to=sameo@linux.intel.com \
    --cc=aloisio.almeida@openbossa.org \
    --cc=eric.lapuyade@intel.com \
    --cc=ilane@ti.com \
    --cc=lauro.venancio@openbossa.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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).