Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314207
b: refs/heads/master
c: 51ad304
h: refs/heads/master
i:
  314205: d2bef66
  314203: 73bbe60
  314199: 3b1bb57
  314191: ee4b8d5
  314175: 301f791
v: v3
  • Loading branch information
Samuel Ortiz committed Jun 4, 2012
1 parent c5e1cb9 commit 1c57096
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 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: 0201ed0349a71cec12ced7e142e6df78504f38fb
refs/heads/master: 51ad304cc8db5589d1e7b0a9df3858381753d788
23 changes: 22 additions & 1 deletion trunk/drivers/nfc/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ struct pn533 {

u8 tgt_available_prots;
u8 tgt_active_prot;
u8 tgt_mode;
};

struct pn533_frame {
Expand Down Expand Up @@ -1158,6 +1159,8 @@ static int pn533_tm_get_data_complete(struct pn533 *dev, void *arg,
if (params_len > 0 && params[0] != 0) {
nfc_tm_deactivated(dev->nfc_dev);

dev->tgt_mode = 0;

kfree_skb(skb_resp);
return 0;
}
Expand Down Expand Up @@ -1245,6 +1248,8 @@ static int pn533_init_target_complete(struct pn533 *dev, void *arg,
return rc;
}

dev->tgt_mode = 1;

queue_work(dev->wq, &dev->tg_work);

return 0;
Expand Down Expand Up @@ -1397,6 +1402,12 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev,
return -EBUSY;
}

if (dev->tgt_mode) {
nfc_dev_err(&dev->interface->dev,
"Cannot poll while already being activated");
return -EBUSY;
}

if (tm_protocols) {
dev->gb = nfc_get_local_general_bytes(nfc_dev, &dev->gb_len);
if (dev->gb == NULL)
Expand Down Expand Up @@ -1725,7 +1736,15 @@ static int pn533_dep_link_down(struct nfc_dev *nfc_dev)

pn533_poll_reset_mod_list(dev);

pn533_deactivate_target(nfc_dev, 0);
if (dev->tgt_mode || dev->tgt_active_prot) {
pn533_send_ack(dev, GFP_KERNEL);
usb_kill_urb(dev->in_urb);
}

dev->tgt_active_prot = 0;
dev->tgt_mode = 0;

skb_queue_purge(&dev->resp_q);

return 0;
}
Expand Down Expand Up @@ -1956,6 +1975,8 @@ static int pn533_tm_send_complete(struct pn533 *dev, void *arg,
if (params_len > 0 && params[0] != 0) {
nfc_tm_deactivated(dev->nfc_dev);

dev->tgt_mode = 0;

return 0;
}

Expand Down

0 comments on commit 1c57096

Please sign in to comment.