NFC: Remove the rf mode parameter from the DEP link up routine

When calling nfc_dep_link_up, we implicitely are in initiator mode.
Which means we also can provide the general bytes as a function argument,
as all drivers will eventually request them.

Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
This commit is contained in:
Samuel Ortiz 2012-03-05 01:03:50 +01:00 • committed by John W. Linville
commit 47807d3dbb
6 changed files with 24 additions and 42 deletions

View file

@ -1340,21 +1340,15 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
}
static int pn533_dep_link_up(struct nfc_dev *nfc_dev, int target_idx,
u8 comm_mode, u8 rf_mode)
u8 comm_mode, u8* gb, size_t gb_len)
{
struct pn533 *dev = nfc_get_drvdata(nfc_dev);
struct pn533_cmd_jump_dep *cmd;
u8 cmd_len, local_gt_len, *local_gt;
u8 cmd_len;
int rc;
nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
if (rf_mode == NFC_RF_TARGET) {
nfc_dev_err(&dev->interface->dev, "Target mode not supported");
return -EOPNOTSUPP;
}
if (dev->poll_mod_count) {
nfc_dev_err(&dev->interface->dev,
"Cannot bring the DEP link up while polling");
@ -1367,11 +1361,7 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, int target_idx,
return -EBUSY;
}
local_gt = nfc_get_local_general_bytes(dev->nfc_dev, &local_gt_len);
if (local_gt_len > NFC_MAX_GT_LEN)
return -EINVAL;
cmd_len = sizeof(struct pn533_cmd_jump_dep) + local_gt_len;
cmd_len = sizeof(struct pn533_cmd_jump_dep) + gb_len;
cmd = kzalloc(cmd_len, GFP_KERNEL);
if (cmd == NULL)
return -ENOMEM;
@ -1380,9 +1370,9 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, int target_idx,
cmd->active = !comm_mode;
cmd->baud = 0;
if (local_gt != NULL) {
if (gb != NULL && gb_len > 0) {
cmd->next = 4; /* We have some Gi */
memcpy(cmd->gt, local_gt, local_gt_len);
memcpy(cmd->gt, gb, gb_len);
} else {
cmd->next = 0;
}