linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] NFC: st95hf: use msleep for long delay
@ 2019-04-09  3:48 Nicholas Mc Guire
  2019-04-09  3:48 ` [PATCH 2/2] NFC: st95hf: fix timing factor error Nicholas Mc Guire
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2019-04-09  3:48 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: Daniel Mack, linux-wireless, linux-kernel, Nicholas Mc Guire

usleep_ranges is backed by hrtimers - for a delay of 50ms
notably in a loop using a hrtimer is of no benefit and
msleep() should be fine  here (see
Documentation/timers/timers-howto.txt).

Signed-off-by: Nicholas Mc Guire <hofrat@opentech.at>
---

Problem located with an experimental coccinelle script

Patch was compile tested with: x86_64_defconfig + SPI=y,
NFC=y, NFC_DIGITAL=y, NFC_ST95HF=m

Patch is against 5.1-rc3 (localversion-next is -next-20190408)

 drivers/nfc/st95hf/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index a50a95c..34bf1d7 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -535,7 +535,7 @@ static int st95hf_por_sequence(struct st95hf_context *st95context)
 			st95hf_send_spi_reset_sequence(st95context);
 
 		/* delay of 50 milisecond */
-		usleep_range(50000, 51000);
+		msleep(50);
 	} while (nth_attempt++ < 3);
 
 	return -ETIMEDOUT;
-- 
2.1.4


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

* [PATCH 2/2] NFC: st95hf: fix timing factor error
  2019-04-09  3:48 [PATCH 1/2] NFC: st95hf: use msleep for long delay Nicholas Mc Guire
@ 2019-04-09  3:48 ` Nicholas Mc Guire
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Mc Guire @ 2019-04-09  3:48 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: Daniel Mack, linux-wireless, linux-kernel, Nicholas Mc Guire

The comment suggests that per ISO standard 5-6ms are required
but the code is 50-60ms delay - look like a simple typo - so
set the delay to 5000 to 6000.

Signed-off-by: Nicholas Mc Guire <hofrat@opentech.at>
Fixes: cab47333f0f7 ("NFC: Add STMicroelectronics ST95HF driver")
---

Problem located with an experimental coccinelle script

Note that as I do not have the standard - it could of course
also be a typo in the comment - in which case it should
then probably be using msleep(60) not usleep_ranges(). 

Patch was compile tested with: x86_64_defconfig + SPI=y,
NFC=y, NFC_DIGITAL=y, NFC_ST95HF=m

Patch is against 5.1-rc3 (localversion-next is -next-20190408)

 drivers/nfc/st95hf/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index 34bf1d7..89e6160 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -430,7 +430,7 @@ static int st95hf_select_protocol(struct st95hf_context *stcontext, int type)
 		 * delay of 5-6 ms is required after select protocol
 		 * command in case of ISO14443 Type B
 		 */
-		usleep_range(50000, 60000);
+		usleep_range(5000, 6000);
 
 		/* secondary config. for 14443Type 4B after protocol select */
 		result = secondary_configuration_type4b(stcontext);
-- 
2.1.4


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

end of thread, other threads:[~2019-04-09  3:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09  3:48 [PATCH 1/2] NFC: st95hf: use msleep for long delay Nicholas Mc Guire
2019-04-09  3:48 ` [PATCH 2/2] NFC: st95hf: fix timing factor error Nicholas Mc Guire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).