aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-03-04 19:03:50 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 15:16:23 -0500
commit47807d3dbb62e93850cbcb797db1a9ee1806f986 (patch)
treef8e1970083547290e35830e5bedb4a4ce7237f97 /drivers/nfc
parent9dda50f4c98f84e32a5f6dc4d9dd7af6085add43 (diff)
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 <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/pn533.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index ef33f64143b5..cb6204f78300 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -1340,21 +1340,15 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
1340} 1340}
1341 1341
1342static int pn533_dep_link_up(struct nfc_dev *nfc_dev, int target_idx, 1342static int pn533_dep_link_up(struct nfc_dev *nfc_dev, int target_idx,
1343 u8 comm_mode, u8 rf_mode) 1343 u8 comm_mode, u8* gb, size_t gb_len)
1344{ 1344{
1345 struct pn533 *dev = nfc_get_drvdata(nfc_dev); 1345 struct pn533 *dev = nfc_get_drvdata(nfc_dev);
1346 struct pn533_cmd_jump_dep *cmd; 1346 struct pn533_cmd_jump_dep *cmd;
1347 u8 cmd_len, local_gt_len, *local_gt; 1347 u8 cmd_len;
1348 int rc; 1348 int rc;
1349 1349
1350 nfc_dev_dbg(&dev->interface->dev, "%s", __func__); 1350 nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
1351 1351
1352 if (rf_mode == NFC_RF_TARGET) {
1353 nfc_dev_err(&dev->interface->dev, "Target mode not supported");
1354 return -EOPNOTSUPP;
1355 }
1356
1357
1358 if (dev->poll_mod_count) { 1352 if (dev->poll_mod_count) {
1359 nfc_dev_err(&dev->interface->dev, 1353 nfc_dev_err(&dev->interface->dev,
1360 "Cannot bring the DEP link up while polling"); 1354 "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,
1367 return -EBUSY; 1361 return -EBUSY;
1368 } 1362 }
1369 1363
1370 local_gt = nfc_get_local_general_bytes(dev->nfc_dev, &local_gt_len); 1364 cmd_len = sizeof(struct pn533_cmd_jump_dep) + gb_len;
1371 if (local_gt_len > NFC_MAX_GT_LEN)
1372 return -EINVAL;
1373
1374 cmd_len = sizeof(struct pn533_cmd_jump_dep) + local_gt_len;
1375 cmd = kzalloc(cmd_len, GFP_KERNEL); 1365 cmd = kzalloc(cmd_len, GFP_KERNEL);
1376 if (cmd == NULL) 1366 if (cmd == NULL)
1377 return -ENOMEM; 1367 return -ENOMEM;
@@ -1380,9 +1370,9 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, int target_idx,
1380 1370
1381 cmd->active = !comm_mode; 1371 cmd->active = !comm_mode;
1382 cmd->baud = 0; 1372 cmd->baud = 0;
1383 if (local_gt != NULL) { 1373 if (gb != NULL && gb_len > 0) {
1384 cmd->next = 4; /* We have some Gi */ 1374 cmd->next = 4; /* We have some Gi */
1385 memcpy(cmd->gt, local_gt, local_gt_len); 1375 memcpy(cmd->gt, gb, gb_len);
1386 } else { 1376 } else {
1387 cmd->next = 0; 1377 cmd->next = 0;
1388 } 1378 }