From: Saurabh Sengar <saurabh.truth@gmail.com>
To: lauro.venancio@openbossa.org, aloisio.almeida@openbossa.org,
sameo@linux.intel.com, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Saurabh Sengar <saurabh.truth@gmail.com>
Subject: [RESEND PATCH] NFC: added the sysfs entry for nfcsim workqueue delay
Date: Sun, 13 Dec 2015 13:34:35 +0530 [thread overview]
Message-ID: <1449993875-3872-1-git-send-email-saurabh.truth@gmail.com> (raw)
added the sysfs entry for nfcsim workqueue delay, as tx_delay
Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
In case this TODO is not expected to be done, please let me know.
I wonder after my repeated attempts since last 50 days, I am not able to get a single response.
Resending this patch in hope to get some response this time.
drivers/nfc/nfcsim.c | 38 +++++++++++++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 3 deletions(-)
diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c
index 26ac9e5..e77be35 100644
--- a/drivers/nfc/nfcsim.c
+++ b/drivers/nfc/nfcsim.c
@@ -32,6 +32,8 @@
#define NFCSIM_POLL_TARGET 2
#define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET)
+#define TX_DEFAULT_DELAY 5
+
struct nfcsim {
struct nfc_dev *nfc_dev;
@@ -62,12 +64,41 @@ static struct nfcsim *dev1;
static struct workqueue_struct *wq;
+
+static int tx_delay = TX_DEFAULT_DELAY;
+
+static ssize_t show_tx_delay(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ int n;
+
+ n = scnprintf(buf, PAGE_SIZE, "%d\n", tx_delay);
+ return n;
+}
+
+static ssize_t store_tx_delay(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ if (kstrtouint(buf, 0, &tx_delay) < 0)
+ return -EINVAL;
+
+ if (tx_delay < 0)
+ return -EINVAL;
+
+ return count;
+}
+
+static DEVICE_ATTR(tx_delay, 0644, show_tx_delay, store_tx_delay);
+
static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown)
{
DEV_DBG(dev, "shutdown=%d\n", shutdown);
mutex_lock(&dev->lock);
+ device_remove_file(&dev->nfc_dev->dev, &dev_attr_tx_delay);
dev->polling_mode = NFCSIM_POLL_NONE;
dev->shutting_down = shutdown;
dev->cb = NULL;
@@ -320,10 +351,8 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target,
* If packet transmission occurs immediately between them, we have a
* non-stop flow of several tens of thousands SYMM packets per second
* and a burning cpu.
- *
- * TODO: Add support for a sysfs entry to control this delay.
*/
- queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5));
+ queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(tx_delay));
mutex_unlock(&peer->lock);
@@ -461,6 +490,9 @@ static struct nfcsim *nfcsim_init_dev(void)
if (rc)
goto free_nfc_dev;
+ rc = device_create_file(&dev->nfc_dev->dev, &dev_attr_tx_delay);
+ if (rc)
+ pr_err("error creating sysfs entry\n");
return dev;
free_nfc_dev:
--
1.9.1
next reply other threads:[~2015-12-13 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-13 8:04 Saurabh Sengar [this message]
2015-12-20 17:50 ` [RESEND PATCH] NFC: added the sysfs entry for nfcsim workqueue delay Samuel Ortiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449993875-3872-1-git-send-email-saurabh.truth@gmail.com \
--to=saurabh.truth@gmail.com \
--cc=aloisio.almeida@openbossa.org \
--cc=lauro.venancio@openbossa.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox