aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/nfc/nfc.h
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@intel.com>2012-05-07 06:31:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-15 17:27:59 -0400
commit900994332675f84a9fbbb33ff089474614c7f2fe (patch)
tree6b9b6f7b50217a30e72848466865e521ee64d048 /include/net/nfc/nfc.h
parent536acc085c641ff8ba46c2c0e97b5e137cbc22d6 (diff)
NFC: Cache the core NFC active target pointer instead of its index
The NFC Core now caches the active nfc target pointer, thereby avoiding the need to lookup the target table for each invocation of a driver ops. Consequently, pn533, HCI and NCI now directly receive an nfc_target pointer instead of a target index. Cc: Ilan Elias <ilane@ti.com> Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net/nfc/nfc.h')
-rw-r--r--include/net/nfc/nfc.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 9a2505a5b8de..0fcf4a54776b 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -48,26 +48,28 @@ struct nfc_dev;
48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb, 48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
49 int err); 49 int err);
50 50
51struct nfc_target;
52
51struct nfc_ops { 53struct nfc_ops {
52 int (*dev_up)(struct nfc_dev *dev); 54 int (*dev_up)(struct nfc_dev *dev);
53 int (*dev_down)(struct nfc_dev *dev); 55 int (*dev_down)(struct nfc_dev *dev);
54 int (*start_poll)(struct nfc_dev *dev, u32 protocols); 56 int (*start_poll)(struct nfc_dev *dev, u32 protocols);
55 void (*stop_poll)(struct nfc_dev *dev); 57 void (*stop_poll)(struct nfc_dev *dev);
56 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, u8 comm_mode, 58 int (*dep_link_up)(struct nfc_dev *dev, struct nfc_target *target,
57 u8 *gb, size_t gb_len); 59 u8 comm_mode, u8 *gb, size_t gb_len);
58 int (*dep_link_down)(struct nfc_dev *dev); 60 int (*dep_link_down)(struct nfc_dev *dev);
59 int (*activate_target)(struct nfc_dev *dev, u32 target_idx, 61 int (*activate_target)(struct nfc_dev *dev, struct nfc_target *target,
60 u32 protocol); 62 u32 protocol);
61 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); 63 void (*deactivate_target)(struct nfc_dev *dev,
62 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, 64 struct nfc_target *target);
65 int (*data_exchange)(struct nfc_dev *dev, struct nfc_target *target,
63 struct sk_buff *skb, data_exchange_cb_t cb, 66 struct sk_buff *skb, data_exchange_cb_t cb,
64 void *cb_context); 67 void *cb_context);
65 int (*check_presence)(struct nfc_dev *dev, u32 target_idx); 68 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
66}; 69};
67 70
68#define NFC_TARGET_IDX_ANY -1 71#define NFC_TARGET_IDX_ANY -1
69#define NFC_MAX_GT_LEN 48 72#define NFC_MAX_GT_LEN 48
70#define NFC_TARGET_IDX_NONE 0xffffffff
71 73
72struct nfc_target { 74struct nfc_target {
73 u32 idx; 75 u32 idx;
@@ -99,7 +101,7 @@ struct nfc_dev {
99 struct device dev; 101 struct device dev;
100 bool dev_up; 102 bool dev_up;
101 bool polling; 103 bool polling;
102 u32 activated_target_idx; 104 struct nfc_target *active_target;
103 bool dep_link_up; 105 bool dep_link_up;
104 u32 dep_rf_mode; 106 u32 dep_rf_mode;
105 struct nfc_genl_data genl_data; 107 struct nfc_genl_data genl_data;