diff options
Diffstat (limited to 'include/net/nfc')
-rw-r--r-- | include/net/nfc/hci.h | 7 | ||||
-rw-r--r-- | include/net/nfc/nci_core.h | 7 | ||||
-rw-r--r-- | include/net/nfc/nfc.h | 22 |
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); | |||
179 | void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata); | 179 | void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata); |
180 | void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev); | 180 | void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev); |
181 | 181 | ||
182 | static 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 | |||
182 | void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err); | 189 | void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err); |
183 | 190 | ||
184 | int nfc_hci_result_to_errno(u8 result); | 191 | int 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 | ||
334 | static 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 | |||
334 | void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb); | 341 | void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb); |
335 | void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb); | 342 | void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb); |
336 | int nci_prop_rsp_packet(struct nci_dev *ndev, __u16 opcode, | 343 | int 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 | ||
168 | struct 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 | |||
168 | struct nfc_dev { | 174 | struct 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); | |||
296 | void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb, | 305 | void 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 | ||
308 | static 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 */ |