aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2014-12-02 15:27:47 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2014-12-02 16:46:47 -0500
commit98ff416f97c53b727d6a52f4d2b29bdf4775ac69 (patch)
tree3ac6186c350a9868e2af63cf2877a2347cbac67e
parentaceb32d05aaf559758a29ffdefdda025a131c978 (diff)
NFC: nci: Add status byte management in case of error.
The nci status byte was ignored. In case of tag reading for example, if the tag is removed from the antenna there is no way for the upper layers (aka: stack) to get inform about such event. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--net/nfc/nci/data.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index 91f5d55bd04c..a2de2a8cb00e 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -185,11 +185,16 @@ exit:
185 185
186static void nci_add_rx_data_frag(struct nci_dev *ndev, 186static void nci_add_rx_data_frag(struct nci_dev *ndev,
187 struct sk_buff *skb, 187 struct sk_buff *skb,
188 __u8 pbf) 188 __u8 pbf, __u8 status)
189{ 189{
190 int reassembly_len; 190 int reassembly_len;
191 int err = 0; 191 int err = 0;
192 192
193 if (status) {
194 err = status;
195 goto exit;
196 }
197
193 if (ndev->rx_data_reassembly) { 198 if (ndev->rx_data_reassembly) {
194 reassembly_len = ndev->rx_data_reassembly->len; 199 reassembly_len = ndev->rx_data_reassembly->len;
195 200
@@ -241,6 +246,7 @@ exit:
241void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb) 246void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb)
242{ 247{
243 __u8 pbf = nci_pbf(skb->data); 248 __u8 pbf = nci_pbf(skb->data);
249 __u8 status = 0;
244 250
245 pr_debug("len %d\n", skb->len); 251 pr_debug("len %d\n", skb->len);
246 252
@@ -258,8 +264,9 @@ void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb)
258 ndev->target_active_prot == NFC_PROTO_ISO15693) { 264 ndev->target_active_prot == NFC_PROTO_ISO15693) {
259 /* frame I/F => remove the status byte */ 265 /* frame I/F => remove the status byte */
260 pr_debug("frame I/F => remove the status byte\n"); 266 pr_debug("frame I/F => remove the status byte\n");
267 status = skb->data[skb->len - 1];
261 skb_trim(skb, (skb->len - 1)); 268 skb_trim(skb, (skb->len - 1));
262 } 269 }
263 270
264 nci_add_rx_data_frag(ndev, skb, pbf); 271 nci_add_rx_data_frag(ndev, skb, pbf, nci_to_errno(status));
265} 272}