Skip to contentSkip to conversation

nitro_enclaves: Fixup type and simplify logic of the poll mask setup

PATCH In review Andra Paraschiv 2 participants 3 messages Nov 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nitro_enclaves: Fixup type and simplify logic of the poll mask setup

Update the assigned value of the poll result to be EPOLLHUP instead of POLLHUP to match the __poll_t type.

While at it, simplify the logic of setting the mask result of the poll function.

Changelog

v1 -> v2

* Simplify the mask setting logic from the poll function.

---
 drivers/virt/nitro_enclaves/ne_misc_dev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/virt/nitro_enclaves/ne_misc_dev.c +2 -4
index f06622b48d695..f1964ea4b8269 100644
@@ -1505,10 +1505,8 @@ static __poll_t ne_enclave_poll(struct file *file, poll_table *wait)
 
 	poll_wait(file, &ne_enclave->eventq, wait);
 
-	if (!ne_enclave->has_event)
-		return mask;
-
-	mask = POLLHUP;
+	if (ne_enclave->has_event)
+		mask |= EPOLLHUP;
 
 	return mask;
 }
Signature · 6 lines
2.20.1 (Apple Git-117)




Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Andra Paraschiv

Update the assigned value of the poll result to be EPOLLHUP instead of POLLHUP to match the __poll_t type.

While at it, simplify the logic of setting the mask result of the poll function.

Quoted 8 lines

Changelog

v1 -> v2

* Simplify the mask setting logic from the poll function.

Alex

Quoted 12 lines
---
  drivers/virt/nitro_enclaves/ne_misc_dev.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/virt/nitro_enclaves/ne_misc_dev.c +0 -0
index f06622b48d695..f1964ea4b8269 100644
@@ -1505,10 +1505,8 @@ static __poll_t ne_enclave_poll(struct file *file, poll_table *wait)
 
  	poll_wait(file, &ne_enclave->eventq, wait);

drivers/virt/nitro_enclaves/ne_misc_dev.c static __poll_t ne_enclave_poll(struct file *file, poll_table *wait) · line 1512

Quoted 10 lines
drivers/virt/nitro_enclaves/ne_misc_dev.c +2 -4
 
-	if (!ne_enclave->has_event)
-		return mask;
-
-	mask = POLLHUP;
+	if (ne_enclave->has_event)
+		mask |= EPOLLHUP;
 
  	return mask;
  }

Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879

#2 lore raw
Quoted 11 lines · Alexander Graf
Quoted 8 lines · Andra Paraschiv

Update the assigned value of the poll result to be EPOLLHUP instead of POLLHUP to match the __poll_t type.

While at it, simplify the logic of setting the mask result of the poll function.

Changelog

Quoted 10 lines
Quoted 6 lines

v1 -> v2

* Simplify the mask setting logic from the poll function.

Greg, let me know if there is anything remaining to be done for this patch. Otherwise, can you please add the patch to the char-misc tree.

Thanks,
Andra

Quoted 5 lines
Quoted 5 lines

---
  drivers/virt/nitro_enclaves/ne_misc_dev.c | 6 ++----

  1 file changed, 2 insertions(+), 4 deletions(-)
Quoted 16 lines
Quoted 6 lines
drivers/virt/nitro_enclaves/ne_misc_dev.c +0 -0
index f06622b48d695..f1964ea4b8269 100644
@@ -1505,10 +1505,8 @@ static __poll_t ne_enclave_poll(struct file 
 *file, poll_table *wait)

drivers/virt/nitro_enclaves/ne_misc_dev.c static __poll_t ne_enclave_poll(struct file · line 1512

Quoted 10 lines
drivers/virt/nitro_enclaves/ne_misc_dev.c +2 -3
         poll_wait(file, &ne_enclave->eventq, wait);
   -    if (!ne_enclave->has_event)
-        return mask;
-
-    mask = POLLHUP;
+    if (ne_enclave->has_event)
+        mask |= EPOLLHUP;
         return mask;
   }
 

Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.