Skip to content

Commit a440f1a

Browse files
saurabh-sengarSamuel Ortiz
authored andcommitted
NFC: add rx delay sysfs parameter for nfcsim workqueue
added the rx delay parameter as a device tunable parameter. Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1 parent c6b5df0 commit a440f1a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/nfc/nfcsim.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#define NFCSIM_POLL_TARGET 2
3333
#define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET)
3434

35+
#define RX_DEFAULT_DELAY 5
36+
3537
struct nfcsim {
3638
struct nfc_dev *nfc_dev;
3739

@@ -51,6 +53,8 @@ struct nfcsim {
5153

5254
u8 initiator;
5355

56+
u32 rx_delay;
57+
5458
data_exchange_cb_t cb;
5559
void *cb_context;
5660

@@ -320,10 +324,9 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target,
320324
* If packet transmission occurs immediately between them, we have a
321325
* non-stop flow of several tens of thousands SYMM packets per second
322326
* and a burning cpu.
323-
*
324-
* TODO: Add support for a sysfs entry to control this delay.
325327
*/
326-
queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5));
328+
queue_delayed_work(wq, &peer->recv_work,
329+
msecs_to_jiffies(dev->rx_delay));
327330

328331
mutex_unlock(&peer->lock);
329332

@@ -461,6 +464,7 @@ static struct nfcsim *nfcsim_init_dev(void)
461464
if (rc)
462465
goto free_nfc_dev;
463466

467+
dev->rx_delay = RX_DEFAULT_DELAY;
464468
return dev;
465469

466470
free_nfc_dev:

0 commit comments

Comments
 (0)