Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314188
b: refs/heads/master
c: f212ad5
h: refs/heads/master
v: v3
  • Loading branch information
Samuel Ortiz committed Jun 4, 2012
1 parent 66beb48 commit b6efe80
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 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: fc40a8c1a06ab7db45da790693dd9802612a055c
refs/heads/master: f212ad5e993e7efb996fc8ce94a5de8f0bd06d41
1 change: 1 addition & 0 deletions trunk/include/linux/nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ enum nfc_attrs {
/* NFC RF modes */
#define NFC_RF_INITIATOR 0
#define NFC_RF_TARGET 1
#define NFC_RF_NONE 2

/* NFC protocols masks used in bitsets */
#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/net/nfc/nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ struct nfc_dev {
int targets_generation;
struct device dev;
bool dev_up;
u8 rf_mode;
bool polling;
struct nfc_target *active_target;
bool dep_link_up;
u32 dep_rf_mode;
struct nfc_genl_data genl_data;
u32 supported_protocols;

Expand Down
14 changes: 10 additions & 4 deletions trunk/net/nfc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, u32 tm_protocols)
}

rc = dev->ops->start_poll(dev, im_protocols, tm_protocols);
if (!rc)
if (!rc) {
dev->polling = true;
dev->rf_mode = NFC_RF_NONE;
}

error:
device_unlock(&dev->dev);
Expand Down Expand Up @@ -235,8 +237,10 @@ int nfc_dep_link_up(struct nfc_dev *dev, int target_index, u8 comm_mode)
}

rc = dev->ops->dep_link_up(dev, target, comm_mode, gb, gb_len);
if (!rc)
if (!rc) {
dev->active_target = target;
dev->rf_mode = NFC_RF_INITIATOR;
}

error:
device_unlock(&dev->dev);
Expand Down Expand Up @@ -264,7 +268,7 @@ int nfc_dep_link_down(struct nfc_dev *dev)
goto error;
}

if (dev->dep_rf_mode == NFC_RF_TARGET) {
if (dev->rf_mode == NFC_RF_TARGET) {
rc = -EOPNOTSUPP;
goto error;
}
Expand All @@ -286,7 +290,6 @@ int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
u8 comm_mode, u8 rf_mode)
{
dev->dep_link_up = true;
dev->dep_rf_mode = rf_mode;

nfc_llcp_mac_is_up(dev, target_idx, comm_mode, rf_mode);

Expand Down Expand Up @@ -330,6 +333,7 @@ int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol)
rc = dev->ops->activate_target(dev, target, protocol);
if (!rc) {
dev->active_target = target;
dev->rf_mode = NFC_RF_INITIATOR;

if (dev->ops->check_presence)
mod_timer(&dev->check_pres_timer, jiffies +
Expand Down Expand Up @@ -470,6 +474,8 @@ int nfc_tm_activated(struct nfc_dev *dev, u32 protocol, u8 comm_mode,
goto out;
}

dev->rf_mode = NFC_RF_TARGET;

if (protocol == NFC_PROTO_NFC_DEP_MASK)
nfc_dep_link_is_up(dev, 0, comm_mode, NFC_RF_TARGET);

Expand Down

0 comments on commit b6efe80

Please sign in to comment.