xref: /openbmc/linux/include/net/nfc/nfc.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
11ccea77eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
255eb94f9SIlan Elias /*
355eb94f9SIlan Elias  * Copyright (C) 2011 Instituto Nokia de Tecnologia
4a99903ecSJulien Lefrique  * Copyright (C) 2014 Marvell International Ltd.
555eb94f9SIlan Elias  *
655eb94f9SIlan Elias  * Authors:
755eb94f9SIlan Elias  *    Lauro Ramos Venancio <lauro.venancio@openbossa.org>
855eb94f9SIlan Elias  *    Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
955eb94f9SIlan Elias  */
1055eb94f9SIlan Elias 
1155eb94f9SIlan Elias #ifndef __NET_NFC_H
1255eb94f9SIlan Elias #define __NET_NFC_H
1355eb94f9SIlan Elias 
14d5a2ca60SIlan Elias #include <linux/nfc.h>
1555eb94f9SIlan Elias #include <linux/device.h>
1655eb94f9SIlan Elias #include <linux/skbuff.h>
1755eb94f9SIlan Elias 
182891f2d5SAndy Shevchenko #define nfc_dbg(dev, fmt, ...) dev_dbg((dev), "NFC: " fmt, ##__VA_ARGS__)
19073a625fSJoe Perches #define nfc_info(dev, fmt, ...) dev_info((dev), "NFC: " fmt, ##__VA_ARGS__)
20073a625fSJoe Perches #define nfc_err(dev, fmt, ...) dev_err((dev), "NFC: " fmt, ##__VA_ARGS__)
2155eb94f9SIlan Elias 
2208f13acfSEric Lapuyade struct nfc_phy_ops {
2308f13acfSEric Lapuyade 	int (*write)(void *dev_id, struct sk_buff *skb);
2408f13acfSEric Lapuyade 	int (*enable)(void *dev_id);
2508f13acfSEric Lapuyade 	void (*disable)(void *dev_id);
2608f13acfSEric Lapuyade };
2708f13acfSEric Lapuyade 
2855eb94f9SIlan Elias struct nfc_dev;
2955eb94f9SIlan Elias 
3055eb94f9SIlan Elias /**
3155eb94f9SIlan Elias  * data_exchange_cb_t - Definition of nfc_data_exchange callback
3255eb94f9SIlan Elias  *
3355eb94f9SIlan Elias  * @context: nfc_data_exchange cb_context parameter
3455eb94f9SIlan Elias  * @skb: response data
3555eb94f9SIlan Elias  * @err: If an error has occurred during data exchange, it is the
3655eb94f9SIlan Elias  *	error number. Zero means no error.
3755eb94f9SIlan Elias  *
3855eb94f9SIlan Elias  * When a rx or tx package is lost or corrupted or the target gets out
3955eb94f9SIlan Elias  * of the operating field, err is -EIO.
4055eb94f9SIlan Elias  */
4155eb94f9SIlan Elias typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
4255eb94f9SIlan Elias 								int err);
4355eb94f9SIlan Elias 
4472b70b6eSSamuel Ortiz typedef void (*se_io_cb_t)(void *context, u8 *apdu, size_t apdu_len, int err);
4572b70b6eSSamuel Ortiz 
4690099433SEric Lapuyade struct nfc_target;
4790099433SEric Lapuyade 
4855eb94f9SIlan Elias struct nfc_ops {
4955eb94f9SIlan Elias 	int (*dev_up)(struct nfc_dev *dev);
5055eb94f9SIlan Elias 	int (*dev_down)(struct nfc_dev *dev);
51fe7c5800SSamuel Ortiz 	int (*start_poll)(struct nfc_dev *dev,
52fe7c5800SSamuel Ortiz 			  u32 im_protocols, u32 tm_protocols);
5355eb94f9SIlan Elias 	void (*stop_poll)(struct nfc_dev *dev);
5490099433SEric Lapuyade 	int (*dep_link_up)(struct nfc_dev *dev, struct nfc_target *target,
5590099433SEric Lapuyade 			   u8 comm_mode, u8 *gb, size_t gb_len);
561ed28f61SSamuel Ortiz 	int (*dep_link_down)(struct nfc_dev *dev);
5790099433SEric Lapuyade 	int (*activate_target)(struct nfc_dev *dev, struct nfc_target *target,
5855eb94f9SIlan Elias 			       u32 protocol);
5990099433SEric Lapuyade 	void (*deactivate_target)(struct nfc_dev *dev,
6096d4581fSChristophe Ricard 				  struct nfc_target *target, u8 mode);
61be9ae4ceSSamuel Ortiz 	int (*im_transceive)(struct nfc_dev *dev, struct nfc_target *target,
6255eb94f9SIlan Elias 			     struct sk_buff *skb, data_exchange_cb_t cb,
6355eb94f9SIlan Elias 			     void *cb_context);
64be9ae4ceSSamuel Ortiz 	int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb);
6590099433SEric Lapuyade 	int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
669ea7187cSSamuel Ortiz 	int (*fw_download)(struct nfc_dev *dev, const char *firmware_name);
670a946301SSamuel Ortiz 
680a946301SSamuel Ortiz 	/* Secure Element API */
690a946301SSamuel Ortiz 	int (*discover_se)(struct nfc_dev *dev);
700a946301SSamuel Ortiz 	int (*enable_se)(struct nfc_dev *dev, u32 se_idx);
710a946301SSamuel Ortiz 	int (*disable_se)(struct nfc_dev *dev, u32 se_idx);
7272b70b6eSSamuel Ortiz 	int (*se_io) (struct nfc_dev *dev, u32 se_idx,
7372b70b6eSSamuel Ortiz 		      u8 *apdu, size_t apdu_length,
7472b70b6eSSamuel Ortiz 		      se_io_cb_t cb, void *cb_context);
7555eb94f9SIlan Elias };
7655eb94f9SIlan Elias 
771ed28f61SSamuel Ortiz #define NFC_TARGET_IDX_ANY -1
781ed28f61SSamuel Ortiz #define NFC_MAX_GT_LEN 48
79767f19aeSIlan Elias #define NFC_ATR_RES_GT_OFFSET 15
80a99903ecSJulien Lefrique #define NFC_ATR_REQ_GT_OFFSET 14
811ed28f61SSamuel Ortiz 
82b9c0c678SSamuel Ortiz /**
83b9c0c678SSamuel Ortiz  * struct nfc_target - NFC target descriptiom
84b9c0c678SSamuel Ortiz  *
85b9c0c678SSamuel Ortiz  * @sens_res: 2 bytes describing the target SENS_RES response, if the target
86b9c0c678SSamuel Ortiz  *	is a type A one. The %sens_res most significant byte must be byte 2
87b9c0c678SSamuel Ortiz  *	as described by the NFC Forum digital specification (i.e. the platform
88b9c0c678SSamuel Ortiz  *	configuration one) while %sens_res least significant byte is byte 1.
89b9c0c678SSamuel Ortiz  */
9055eb94f9SIlan Elias struct nfc_target {
9155eb94f9SIlan Elias 	u32 idx;
9255eb94f9SIlan Elias 	u32 supported_protocols;
9355eb94f9SIlan Elias 	u16 sens_res;
9455eb94f9SIlan Elias 	u8 sel_res;
95288e0713SIlan Elias 	u8 nfcid1_len;
96d5a2ca60SIlan Elias 	u8 nfcid1[NFC_NFCID1_MAXSIZE];
97322bce95SSamuel Ortiz 	u8 nfcid2_len;
98322bce95SSamuel Ortiz 	u8 nfcid2[NFC_NFCID2_MAXSIZE];
99d5a2ca60SIlan Elias 	u8 sensb_res_len;
100d5a2ca60SIlan Elias 	u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
101d5a2ca60SIlan Elias 	u8 sensf_res_len;
102d5a2ca60SIlan Elias 	u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
1038b8d2e08SEric Lapuyade 	u8 hci_reader_gate;
104c4fbb651SSamuel Ortiz 	u8 logical_idx;
105e487e4dcSMark A. Greer 	u8 is_iso15693;
106e487e4dcSMark A. Greer 	u8 iso15693_dsfid;
107e487e4dcSMark A. Greer 	u8 iso15693_uid[NFC_ISO15693_UID_MAXSIZE];
10855eb94f9SIlan Elias };
10955eb94f9SIlan Elias 
110fed7c25eSSamuel Ortiz /**
111fed7c25eSSamuel Ortiz  * nfc_se - A structure for NFC accessible secure elements.
112fed7c25eSSamuel Ortiz  *
113fed7c25eSSamuel Ortiz  * @idx: The secure element index. User space will enable or
114fed7c25eSSamuel Ortiz  *       disable a secure element by its index.
115fed7c25eSSamuel Ortiz  * @type: The secure element type. It can be SE_UICC or
116fed7c25eSSamuel Ortiz  *        SE_EMBEDDED.
117fed7c25eSSamuel Ortiz  * @state: The secure element state, either enabled or disabled.
118fed7c25eSSamuel Ortiz  *
119fed7c25eSSamuel Ortiz  */
120fed7c25eSSamuel Ortiz struct nfc_se {
121fed7c25eSSamuel Ortiz 	struct list_head list;
122fed7c25eSSamuel Ortiz 	u32 idx;
123fed7c25eSSamuel Ortiz 	u16 type;
124fed7c25eSSamuel Ortiz 	u16 state;
125fed7c25eSSamuel Ortiz };
126fed7c25eSSamuel Ortiz 
127447b27c4SChristophe Ricard /**
128447b27c4SChristophe Ricard  * nfc_evt_transaction - A struct for NFC secure element event transaction.
129447b27c4SChristophe Ricard  *
130447b27c4SChristophe Ricard  * @aid: The application identifier triggering the event
131447b27c4SChristophe Ricard  *
132447b27c4SChristophe Ricard  * @aid_len: The application identifier length [5:16]
133447b27c4SChristophe Ricard  *
134447b27c4SChristophe Ricard  * @params: The application parameters transmitted during the transaction
135447b27c4SChristophe Ricard  *
136447b27c4SChristophe Ricard  * @params_len: The applications parameters length [0:255]
137447b27c4SChristophe Ricard  *
138447b27c4SChristophe Ricard  */
139447b27c4SChristophe Ricard #define NFC_MIN_AID_LENGTH	5
140447b27c4SChristophe Ricard #define	NFC_MAX_AID_LENGTH	16
141447b27c4SChristophe Ricard #define NFC_MAX_PARAMS_LENGTH	255
142447b27c4SChristophe Ricard 
143447b27c4SChristophe Ricard #define NFC_EVT_TRANSACTION_AID_TAG	0x81
144447b27c4SChristophe Ricard #define NFC_EVT_TRANSACTION_PARAMS_TAG	0x82
145447b27c4SChristophe Ricard struct nfc_evt_transaction {
146447b27c4SChristophe Ricard 	u32 aid_len;
147447b27c4SChristophe Ricard 	u8 aid[NFC_MAX_AID_LENGTH];
148447b27c4SChristophe Ricard 	u8 params_len;
149da60fbe7SGustavo A. R. Silva 	u8 params[];
150447b27c4SChristophe Ricard } __packed;
151447b27c4SChristophe Ricard 
15255eb94f9SIlan Elias struct nfc_genl_data {
15315e47304SEric W. Biederman 	u32 poll_req_portid;
15455eb94f9SIlan Elias 	struct mutex genl_data_mutex;
15555eb94f9SIlan Elias };
15655eb94f9SIlan Elias 
1578115dd59SSamuel Ortiz struct nfc_vendor_cmd {
1588115dd59SSamuel Ortiz 	__u32 vendor_id;
1598115dd59SSamuel Ortiz 	__u32 subcmd;
1608115dd59SSamuel Ortiz 	int (*doit)(struct nfc_dev *dev, void *data, size_t data_len);
1618115dd59SSamuel Ortiz };
1628115dd59SSamuel Ortiz 
16355eb94f9SIlan Elias struct nfc_dev {
1647eda8b8eSSamuel Ortiz 	int idx;
16501ae0eeaSEric Lapuyade 	u32 target_next_idx;
16655eb94f9SIlan Elias 	struct nfc_target *targets;
16755eb94f9SIlan Elias 	int n_targets;
16855eb94f9SIlan Elias 	int targets_generation;
16955eb94f9SIlan Elias 	struct device dev;
17055eb94f9SIlan Elias 	bool dev_up;
1719ea7187cSSamuel Ortiz 	bool fw_download_in_progress;
172f212ad5eSSamuel Ortiz 	u8 rf_mode;
17355eb94f9SIlan Elias 	bool polling;
17490099433SEric Lapuyade 	struct nfc_target *active_target;
1751ed28f61SSamuel Ortiz 	bool dep_link_up;
17655eb94f9SIlan Elias 	struct nfc_genl_data genl_data;
17755eb94f9SIlan Elias 	u32 supported_protocols;
17855eb94f9SIlan Elias 
179fed7c25eSSamuel Ortiz 	struct list_head secure_elements;
180390a1bd8SSamuel Ortiz 
18155eb94f9SIlan Elias 	int tx_headroom;
18255eb94f9SIlan Elias 	int tx_tailroom;
18355eb94f9SIlan Elias 
184c8d56ae7SEric Lapuyade 	struct timer_list check_pres_timer;
185c8d56ae7SEric Lapuyade 	struct work_struct check_pres_work;
186c8d56ae7SEric Lapuyade 
187f0c91038SEric Lapuyade 	bool shutting_down;
188f0c91038SEric Lapuyade 
189be055b2fSSamuel Ortiz 	struct rfkill *rfkill;
190be055b2fSSamuel Ortiz 
19115944ad2SKrzysztof Kozlowski 	const struct nfc_vendor_cmd *vendor_cmds;
1928115dd59SSamuel Ortiz 	int n_vendor_cmds;
1938115dd59SSamuel Ortiz 
194f6c802a7SKrzysztof Kozlowski 	const struct nfc_ops *ops;
19529e76924SChristophe Ricard 	struct genl_info *cur_cmd_info;
19655eb94f9SIlan Elias };
19755eb94f9SIlan Elias #define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
19855eb94f9SIlan Elias 
19955eb94f9SIlan Elias extern struct class nfc_class;
20055eb94f9SIlan Elias 
201f6c802a7SKrzysztof Kozlowski struct nfc_dev *nfc_allocate_device(const struct nfc_ops *ops,
20255eb94f9SIlan Elias 				    u32 supported_protocols,
20355eb94f9SIlan Elias 				    int tx_headroom,
20455eb94f9SIlan Elias 				    int tx_tailroom);
20555eb94f9SIlan Elias 
20655eb94f9SIlan Elias /**
20755eb94f9SIlan Elias  * nfc_free_device - free nfc device
20855eb94f9SIlan Elias  *
20955eb94f9SIlan Elias  * @dev: The nfc device to free
21055eb94f9SIlan Elias  */
nfc_free_device(struct nfc_dev * dev)21155eb94f9SIlan Elias static inline void nfc_free_device(struct nfc_dev *dev)
21255eb94f9SIlan Elias {
21355eb94f9SIlan Elias 	put_device(&dev->dev);
21455eb94f9SIlan Elias }
21555eb94f9SIlan Elias 
21655eb94f9SIlan Elias int nfc_register_device(struct nfc_dev *dev);
21755eb94f9SIlan Elias 
21855eb94f9SIlan Elias void nfc_unregister_device(struct nfc_dev *dev);
21955eb94f9SIlan Elias 
22055eb94f9SIlan Elias /**
22155eb94f9SIlan Elias  * nfc_set_parent_dev - set the parent device
22255eb94f9SIlan Elias  *
22355eb94f9SIlan Elias  * @nfc_dev: The nfc device whose parent is being set
22455eb94f9SIlan Elias  * @dev: The parent device
22555eb94f9SIlan Elias  */
nfc_set_parent_dev(struct nfc_dev * nfc_dev,struct device * dev)22655eb94f9SIlan Elias static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev,
22755eb94f9SIlan Elias 				      struct device *dev)
22855eb94f9SIlan Elias {
22955eb94f9SIlan Elias 	nfc_dev->dev.parent = dev;
23055eb94f9SIlan Elias }
23155eb94f9SIlan Elias 
23255eb94f9SIlan Elias /**
23355eb94f9SIlan Elias  * nfc_set_drvdata - set driver specifc data
23455eb94f9SIlan Elias  *
23555eb94f9SIlan Elias  * @dev: The nfc device
23655eb94f9SIlan Elias  * @data: Pointer to driver specifc data
23755eb94f9SIlan Elias  */
nfc_set_drvdata(struct nfc_dev * dev,void * data)23855eb94f9SIlan Elias static inline void nfc_set_drvdata(struct nfc_dev *dev, void *data)
23955eb94f9SIlan Elias {
24055eb94f9SIlan Elias 	dev_set_drvdata(&dev->dev, data);
24155eb94f9SIlan Elias }
24255eb94f9SIlan Elias 
24355eb94f9SIlan Elias /**
24455eb94f9SIlan Elias  * nfc_get_drvdata - get driver specifc data
24555eb94f9SIlan Elias  *
24655eb94f9SIlan Elias  * @dev: The nfc device
24755eb94f9SIlan Elias  */
nfc_get_drvdata(const struct nfc_dev * dev)248dd8987a3SKrzysztof Kozlowski static inline void *nfc_get_drvdata(const struct nfc_dev *dev)
24955eb94f9SIlan Elias {
25055eb94f9SIlan Elias 	return dev_get_drvdata(&dev->dev);
25155eb94f9SIlan Elias }
25255eb94f9SIlan Elias 
25355eb94f9SIlan Elias /**
25455eb94f9SIlan Elias  * nfc_device_name - get the nfc device name
25555eb94f9SIlan Elias  *
25655eb94f9SIlan Elias  * @dev: The nfc device whose name to return
25755eb94f9SIlan Elias  */
nfc_device_name(const struct nfc_dev * dev)258dd8987a3SKrzysztof Kozlowski static inline const char *nfc_device_name(const struct nfc_dev *dev)
25955eb94f9SIlan Elias {
26055eb94f9SIlan Elias 	return dev_name(&dev->dev);
26155eb94f9SIlan Elias }
26255eb94f9SIlan Elias 
2637c7cd3bfSSamuel Ortiz struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk,
2647c7cd3bfSSamuel Ortiz 				   unsigned int flags, unsigned int size,
2657c7cd3bfSSamuel Ortiz 				   unsigned int *err);
2667c7cd3bfSSamuel Ortiz struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp);
26755eb94f9SIlan Elias 
268541d920bSSamuel Ortiz int nfc_set_remote_general_bytes(struct nfc_dev *dev,
269*3df40eb3SKrzysztof Kozlowski 				 const u8 *gt, u8 gt_len);
270ab73b751SSamuel Ortiz u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, size_t *gb_len);
271541d920bSSamuel Ortiz 
272352a5f5fSEric Lapuyade int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name,
273352a5f5fSEric Lapuyade 			 u32 result);
274ef04158eSEric Lapuyade 
2750a40acb2SSamuel Ortiz int nfc_targets_found(struct nfc_dev *dev,
2760a40acb2SSamuel Ortiz 		      struct nfc_target *targets, int ntargets);
277e1da0efaSEric Lapuyade int nfc_target_lost(struct nfc_dev *dev, u32 target_idx);
27855eb94f9SIlan Elias 
2791ed28f61SSamuel Ortiz int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
2801ed28f61SSamuel Ortiz 		       u8 comm_mode, u8 rf_mode);
2811ed28f61SSamuel Ortiz 
282fc40a8c1SSamuel Ortiz int nfc_tm_activated(struct nfc_dev *dev, u32 protocol, u8 comm_mode,
283*3df40eb3SKrzysztof Kozlowski 		     const u8 *gb, size_t gb_len);
284fc40a8c1SSamuel Ortiz int nfc_tm_deactivated(struct nfc_dev *dev);
28573167cedSSamuel Ortiz int nfc_tm_data_received(struct nfc_dev *dev, struct sk_buff *skb);
286fc40a8c1SSamuel Ortiz 
287456411caSEric Lapuyade void nfc_driver_failure(struct nfc_dev *dev, int err);
288456411caSEric Lapuyade 
289447b27c4SChristophe Ricard int nfc_se_transaction(struct nfc_dev *dev, u8 se_idx,
290447b27c4SChristophe Ricard 		       struct nfc_evt_transaction *evt_transaction);
2919afec6d3SChristophe Ricard int nfc_se_connectivity(struct nfc_dev *dev, u8 se_idx);
292fed7c25eSSamuel Ortiz int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
293fed7c25eSSamuel Ortiz int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
294d8eb18eeSArron Wang struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx);
295fed7c25eSSamuel Ortiz 
29657be1f3fSHiren Tandel void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb,
29757be1f3fSHiren Tandel 			  u8 payload_type, u8 direction);
29857be1f3fSHiren Tandel 
nfc_set_vendor_cmds(struct nfc_dev * dev,const struct nfc_vendor_cmd * cmds,int n_cmds)2998115dd59SSamuel Ortiz static inline int nfc_set_vendor_cmds(struct nfc_dev *dev,
30015944ad2SKrzysztof Kozlowski 				      const struct nfc_vendor_cmd *cmds,
3018115dd59SSamuel Ortiz 				      int n_cmds)
3028115dd59SSamuel Ortiz {
3038115dd59SSamuel Ortiz 	if (dev->vendor_cmds || dev->n_vendor_cmds)
3048115dd59SSamuel Ortiz 		return -EINVAL;
3058115dd59SSamuel Ortiz 
3068115dd59SSamuel Ortiz 	dev->vendor_cmds = cmds;
3078115dd59SSamuel Ortiz 	dev->n_vendor_cmds = n_cmds;
3088115dd59SSamuel Ortiz 
3098115dd59SSamuel Ortiz 	return 0;
3108115dd59SSamuel Ortiz }
3118115dd59SSamuel Ortiz 
31229e76924SChristophe Ricard struct sk_buff *__nfc_alloc_vendor_cmd_reply_skb(struct nfc_dev *dev,
31329e76924SChristophe Ricard 						 enum nfc_attrs attr,
31429e76924SChristophe Ricard 						 u32 oui, u32 subcmd,
31529e76924SChristophe Ricard 						 int approxlen);
31629e76924SChristophe Ricard int nfc_vendor_cmd_reply(struct sk_buff *skb);
31729e76924SChristophe Ricard 
31829e76924SChristophe Ricard /**
31929e76924SChristophe Ricard  * nfc_vendor_cmd_alloc_reply_skb - allocate vendor command reply
32029e76924SChristophe Ricard  * @dev: nfc device
32129e76924SChristophe Ricard  * @oui: vendor oui
32229e76924SChristophe Ricard  * @approxlen: an upper bound of the length of the data that will
32329e76924SChristophe Ricard  *      be put into the skb
32429e76924SChristophe Ricard  *
32529e76924SChristophe Ricard  * This function allocates and pre-fills an skb for a reply to
32629e76924SChristophe Ricard  * a vendor command. Since it is intended for a reply, calling
32729e76924SChristophe Ricard  * it outside of a vendor command's doit() operation is invalid.
32829e76924SChristophe Ricard  *
32929e76924SChristophe Ricard  * The returned skb is pre-filled with some identifying data in
33029e76924SChristophe Ricard  * a way that any data that is put into the skb (with skb_put(),
33129e76924SChristophe Ricard  * nla_put() or similar) will end up being within the
33229e76924SChristophe Ricard  * %NFC_ATTR_VENDOR_DATA attribute, so all that needs to be done
33329e76924SChristophe Ricard  * with the skb is adding data for the corresponding userspace tool
33429e76924SChristophe Ricard  * which can then read that data out of the vendor data attribute.
33529e76924SChristophe Ricard  * You must not modify the skb in any other way.
33629e76924SChristophe Ricard  *
33729e76924SChristophe Ricard  * When done, call nfc_vendor_cmd_reply() with the skb and return
33829e76924SChristophe Ricard  * its error code as the result of the doit() operation.
33929e76924SChristophe Ricard  *
34029e76924SChristophe Ricard  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
34129e76924SChristophe Ricard  */
34229e76924SChristophe Ricard static inline struct sk_buff *
nfc_vendor_cmd_alloc_reply_skb(struct nfc_dev * dev,u32 oui,u32 subcmd,int approxlen)34329e76924SChristophe Ricard nfc_vendor_cmd_alloc_reply_skb(struct nfc_dev *dev,
34429e76924SChristophe Ricard 				u32 oui, u32 subcmd, int approxlen)
34529e76924SChristophe Ricard {
34629e76924SChristophe Ricard 	return __nfc_alloc_vendor_cmd_reply_skb(dev,
34729e76924SChristophe Ricard 						NFC_ATTR_VENDOR_DATA,
34829e76924SChristophe Ricard 						oui,
34929e76924SChristophe Ricard 						subcmd, approxlen);
35029e76924SChristophe Ricard }
35129e76924SChristophe Ricard 
35255eb94f9SIlan Elias #endif /* __NET_NFC_H */
353