mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nfc: nxp-nci: use msleep for long delays
@ 2017-01-22 12:28 Nicholas Mc Guire
  2017-04-01 22:30 ` Samuel Ortiz
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2017-01-22 12:28 UTC (permalink / raw)
  To: Clement Perrochaud
  Cc: Charles Gorand, Lauro Ramos Venancio, Aloisio Almeida Jr,
	Samuel Ortiz, linux-nfc, linux-wireless, linux-kernel,
	Nicholas Mc Guire, Nicholas Mc Guire

ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. For this large delay msleep() is preferable.

Fixes: commit 6be88670fc59 ("NFC: nxp-nci_i2c: Add I2C support to NXP NCI driver")
Link: http://lkml.org/lkml/2017/1/11/377
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Problem was found by cocinelle script.

nxp_nci_i2c_write takes the negative return code as indicator that the
NFC device was probably in stand-by mode, the first transaction attempt
woke it up and that after 110ms latest it would be ready to receive.
Overrunning this time by a few milliseconds will not hurt though so
msleep() should be fine here.

Patch was compile tested with: x86_64_defconfig + CONFIG_NFC=m,
CONFIG_NFC_NCI=m, CONFIG_NFC_NXP_NCI=m, CONFIG_NFC_NXP_NCI_I2C=m

Patch is against 4.10-rc4 (localversion-next is next-20170120)

 drivers/nfc/nxp-nci/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 36099e5..ceb815c 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -86,7 +86,7 @@ static int nxp_nci_i2c_write(void *phy_id, struct sk_buff *skb)
 	r = i2c_master_send(client, skb->data, skb->len);
 	if (r < 0) {
 		/* Retry, chip was in standby */
-		usleep_range(110000, 120000);
+		msleep(110);
 		r = i2c_master_send(client, skb->data, skb->len);
 	}
 
-- 
2.1.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-01 22:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-22 12:28 [PATCH] nfc: nxp-nci: use msleep for long delays Nicholas Mc Guire
2017-04-01 22:30 ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®