Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1268876
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Saurabh Sengar <saurabh.truth@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] NFC: added the sysfs entry for nfcsim workqueue delay |
| Date | Fri, 13 Nov 2015 12:20:01 +0100 |
| Message-ID | <qukyB-5Ge-9@gated-at.bofh.it> (permalink) |
| X-Original-To | lauro.venancio@openbossa.org, aloisio.almeida@openbossa.org, sameo@linux.intel.com, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=RBB16LqIQ5gMsLg3NAtdca1WRQs+ipxp1dbSp0xwnrU=; b=fOvbUZ9EOjsFqlqyF6qKCmGFJYOH1jTHMh7R3mY+pB3GRDVh8iUAp8D31XIRNldUnU kd6FZPKRYmNQb9ajhd61NSYEYqG/dY6iWOtgr2YQUa8VSAvBa92tfsoppNSfKdmqJp2B TSxjXrlXY1A6wzb+P3IV0MkkkoNC6/jtWoRQvVUqDFHlWFawNgxTeddBHGYDDvBUQrQx VrsKASJZctedbXsspX5GmNfiDCWVNKIKmkkWbn7yGYferZgCpXZ4B1/5/iHAUmQXLbA8 6XnF4UDPkr+K6NEgh7Wd2bIi+EBpKdNB/bK5x8AXmTvsdea4PQsjQUBGq78uVS5hj/rP 6Yaw== |
| X-Received | by 10.66.122.5 with SMTP id lo5mr17448762pab.22.1447413514034; Fri, 13 Nov 2015 03:18:34 -0800 (PST) |
| X-Mailer | git-send-email 1.9.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 93 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Saurabh Sengar <saurabh.truth@gmail.com> |
| X-Original-Date | Fri, 13 Nov 2015 16:48:19 +0530 |
| X-Original-Message-ID | <1447413499-25747-1-git-send-email-saurabh.truth@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1268876 |
Show key headers only | View raw
added the sysfs entry for nfcsim workqueue delay, as tx_delay
Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
implementing the TODO task
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] NFC: added the sysfs entry for nfcsim workqueue delay Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-13 12:20 +0100
csiph-web