Skip to content

Commit

Permalink
NFC: pn533: Add MI/TG bits only when in Initiator mode
Browse files Browse the repository at this point in the history
The fragmentation routine (used to split big frames) could be used in
target or initiator mode (TgSetMetaData vs InDataExchange), but the
MI/TG bytes are not needed in target mode (TgSetMetaData), so we
add a check on the mode

Signed-off-by: Olivier Guiter <olivier.guiter@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Olivier Guiter authored and Samuel Ortiz committed Sep 25, 2013
1 parent 2bed278 commit 22953f9
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions drivers/nfc/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -2504,14 +2504,17 @@ static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb)
break;
}

/* Reserve the TG/MI byte */
skb_reserve(frag, 1);

/* MI + TG */
if (frag_size == PN533_CMD_DATAFRAME_MAXLEN)
*skb_push(frag, sizeof(u8)) = (PN533_CMD_MI_MASK | 1);
else
*skb_push(frag, sizeof(u8)) = 1; /* TG */
if (!dev->tgt_mode) {
/* Reserve the TG/MI byte */
skb_reserve(frag, 1);

/* MI + TG */
if (frag_size == PN533_CMD_DATAFRAME_MAXLEN)
*skb_push(frag, sizeof(u8)) =
(PN533_CMD_MI_MASK | 1);
else
*skb_push(frag, sizeof(u8)) = 1; /* TG */
}

memcpy(skb_put(frag, frag_size), skb->data, frag_size);

Expand Down

0 comments on commit 22953f9

Please sign in to comment.