Skip to contentSkip to conversation

nfc: st95hf: switch to using sleeping variants of gpiod API

PATCH In review Dmitry Torokhov 2 participants 2 messages Jul 24 – Aug 3 NFC

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nfc: st95hf: switch to using sleeping variants of gpiod API

The driver does not use gpiod API calls in an atomic context. Switch to gpiod_set_value_cansleep() calls to allow using the driver with GPIO controllers that might need process context to operate.

---

v2: - dropped extra "not" from commit description (Przemek Kitszel)
- link to v1: https://lore.kernel.org/r/[email protected]

FTR I am not using this driver but I'm helping clean up legacy gpio APIs and stumbled on this. Using "cansleep" where we can is simply a good practice.

 drivers/nfc/st95hf/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nfc/st95hf/core.c +3 -3
index 321fbe8aeca8..4d772a308bff 100644
@@ -450,19 +450,19 @@ static int st95hf_select_protocol(struct st95hf_context *stcontext, int type)
 static void st95hf_send_st95enable_negativepulse(struct st95hf_context *st95con)
 {
 	/* First make irq_in pin high */
-	gpiod_set_value(st95con->enable_gpiod, HIGH);
+	gpiod_set_value_cansleep(st95con->enable_gpiod, HIGH);
 
 	/* wait for 1 milisecond */
 	usleep_range(1000, 2000);
 
 	/* Make irq_in pin low */
-	gpiod_set_value(st95con->enable_gpiod, LOW);
+	gpiod_set_value_cansleep(st95con->enable_gpiod, LOW);
 
 	/* wait for minimum interrupt pulse to make st95 active */
 	usleep_range(1000, 2000);
 
 	/* At end make it high */
-	gpiod_set_value(st95con->enable_gpiod, HIGH);
+	gpiod_set_value_cansleep(st95con->enable_gpiod, HIGH);
 }
 
 /*
Signature · 5 lines
2.55.0.229.g6434b31f56-goog


-- 
Dmitry
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Dmitry Torokhov

The driver does not use gpiod API calls in an atomic context. Switch to gpiod_set_value_cansleep() calls to allow using the driver with GPIO controllers that might need process context to operate.

Quoted 39 lines

---

v2: - dropped extra "not" from commit description (Przemek Kitszel)
- link to v1: https://lore.kernel.org/r/[email protected]

FTR I am not using this driver but I'm helping clean up legacy gpio APIs and stumbled on this. Using "cansleep" where we can is simply a good practice.

  drivers/nfc/st95hf/core.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nfc/st95hf/core.c +3 -3
index 321fbe8aeca8..4d772a308bff 100644
@@ -450,19 +450,19 @@ static int st95hf_select_protocol(struct st95hf_context *stcontext, int type)
  static void st95hf_send_st95enable_negativepulse(struct st95hf_context *st95con)
  {
  	/* First make irq_in pin high */
-	gpiod_set_value(st95con->enable_gpiod, HIGH);
+	gpiod_set_value_cansleep(st95con->enable_gpiod, HIGH);
 
  	/* wait for 1 milisecond */
  	usleep_range(1000, 2000);
 
  	/* Make irq_in pin low */
-	gpiod_set_value(st95con->enable_gpiod, LOW);
+	gpiod_set_value_cansleep(st95con->enable_gpiod, LOW);
 
  	/* wait for minimum interrupt pulse to make st95 active */
  	usleep_range(1000, 2000);
 
  	/* At end make it high */
-	gpiod_set_value(st95con->enable_gpiod, HIGH);
+	gpiod_set_value_cansleep(st95con->enable_gpiod, HIGH);
  }
 
  /*