aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/nfc
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/nfc')
-rw-r--r--include/net/nfc/hci.h7
-rw-r--r--include/net/nfc/nci_core.h7
-rw-r--r--include/net/nfc/nfc.h22
3 files changed, 36 insertions, 0 deletions
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 020a814bc8ed..316694dafa5b 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -179,6 +179,13 @@ void nfc_hci_unregister_device(struct nfc_hci_dev *hdev);
179void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata); 179void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata);
180void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev); 180void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
181 181
182static inline int nfc_hci_set_vendor_cmds(struct nfc_hci_dev *hdev,
183 struct nfc_vendor_cmd *cmds,
184 int n_cmds)
185{
186 return nfc_set_vendor_cmds(hdev->ndev, cmds, n_cmds);
187}
188
182void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err); 189void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err);
183 190
184int nfc_hci_result_to_errno(u8 result); 191int nfc_hci_result_to_errno(u8 result);
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 98f18a20dc77..9d77ed556b78 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -331,6 +331,13 @@ static inline void *nci_get_drvdata(struct nci_dev *ndev)
331 return ndev->driver_data; 331 return ndev->driver_data;
332} 332}
333 333
334static inline int nci_set_vendor_cmds(struct nci_dev *ndev,
335 struct nfc_vendor_cmd *cmds,
336 int n_cmds)
337{
338 return nfc_set_vendor_cmds(ndev->nfc_dev, cmds, n_cmds);
339}
340
334void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb); 341void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb);
335void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb); 342void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb);
336int nci_prop_rsp_packet(struct nci_dev *ndev, __u16 opcode, 343int nci_prop_rsp_packet(struct nci_dev *ndev, __u16 opcode,
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 7ac029c07546..f9e58ae45f9c 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -165,6 +165,12 @@ struct nfc_genl_data {
165 struct mutex genl_data_mutex; 165 struct mutex genl_data_mutex;
166}; 166};
167 167
168struct nfc_vendor_cmd {
169 __u32 vendor_id;
170 __u32 subcmd;
171 int (*doit)(struct nfc_dev *dev, void *data, size_t data_len);
172};
173
168struct nfc_dev { 174struct nfc_dev {
169 int idx; 175 int idx;
170 u32 target_next_idx; 176 u32 target_next_idx;
@@ -193,6 +199,9 @@ struct nfc_dev {
193 199
194 struct rfkill *rfkill; 200 struct rfkill *rfkill;
195 201
202 struct nfc_vendor_cmd *vendor_cmds;
203 int n_vendor_cmds;
204
196 struct nfc_ops *ops; 205 struct nfc_ops *ops;
197}; 206};
198#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) 207#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
@@ -296,4 +305,17 @@ struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx);
296void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb, 305void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb,
297 u8 payload_type, u8 direction); 306 u8 payload_type, u8 direction);
298 307
308static inline int nfc_set_vendor_cmds(struct nfc_dev *dev,
309 struct nfc_vendor_cmd *cmds,
310 int n_cmds)
311{
312 if (dev->vendor_cmds || dev->n_vendor_cmds)
313 return -EINVAL;
314
315 dev->vendor_cmds = cmds;
316 dev->n_vendor_cmds = n_cmds;
317
318 return 0;
319}
320
299#endif /* __NET_NFC_H */ 321#endif /* __NET_NFC_H */