Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351905
b: refs/heads/master
c: 40d06d3
h: refs/heads/master
i:
  351903: ab90454
v: v3
  • Loading branch information
Eric Lapuyade authored and Samuel Ortiz committed Jan 9, 2013
1 parent e7b299e commit 3d4b469
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 27c31191b3d7ff32c266a5dbea344b9aa96ebf14
refs/heads/master: 40d06d3647ea872a7346be1f6859f18cd0fe08d3
16 changes: 11 additions & 5 deletions trunk/drivers/nfc/pn544/pn544.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,18 +714,23 @@ static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
return 0;
}

/*
* Returns:
* <= 0: driver handled the event, skb consumed
* 1: driver does not handle the event, please do standard processing
*/
static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
struct sk_buff *skb)
{
struct sk_buff *rgb_skb = NULL;
int r = 0;
int r;

pr_debug("hci event %d", event);
switch (event) {
case PN544_HCI_EVT_ACTIVATED:
if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE)
if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE) {
r = nfc_hci_target_discovered(hdev, gate);
else if (gate == PN544_RF_READER_NFCIP1_TARGET_GATE) {
} else if (gate == PN544_RF_READER_NFCIP1_TARGET_GATE) {
r = nfc_hci_get_param(hdev, gate, PN544_DEP_ATR_REQ,
&rgb_skb);
if (r < 0)
Expand All @@ -736,6 +741,8 @@ static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
rgb_skb->len);

kfree_skb(rgb_skb);
} else {
r = -EINVAL;
}
break;
case PN544_HCI_EVT_DEACTIVATED:
Expand All @@ -757,8 +764,7 @@ static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
skb_pull(skb, 2);
return nfc_tm_data_received(hdev->ndev, skb);
default:
pr_err("Discarded unknown event %x to gate %x\n", event, gate);
break;
return 1;
}

exit:
Expand Down
14 changes: 8 additions & 6 deletions trunk/net/nfc/hci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
goto exit;
}

if (hdev->ops->event_received) {
r = hdev->ops->event_received(hdev, gate, event, skb);
if (r <= 0)
goto exit_noskb;
}

switch (event) {
case NFC_HCI_EVT_TARGET_DISCOVERED:
if (skb->len < 1) { /* no status data? */
Expand All @@ -322,12 +328,8 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
r = nfc_hci_target_discovered(hdev, gate);
break;
default:
if (hdev->ops->event_received) {
r = hdev->ops->event_received(hdev, gate, event, skb);
goto exit_noskb;
} else {
r = -EINVAL;
}
pr_info("Discarded unknown event %x to gate %x\n", event, gate);
r = -EINVAL;
break;
}

Expand Down

0 comments on commit 3d4b469

Please sign in to comment.