linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] nitro_enclaves: Fixup type and simplify logic of the poll mask setup
@ 2020-11-02 17:36 Andra Paraschiv
  2020-11-02 17:50 ` Alexander Graf
  0 siblings, 1 reply; 3+ messages in thread
From: Andra Paraschiv @ 2020-11-02 17:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Anthony Liguori, Benjamin Herrenschmidt, Colm MacCarthaigh,
	David Duncan, Bjoern Doebel, David Woodhouse,
	Frank van der Linden, Alexander Graf, Greg Kroah-Hartman,
	Karen Noel, Martin Pohlack, Matt Wilson, Paolo Bonzini,
	Stefano Garzarella, Stefan Hajnoczi, Stewart Smith,
	Uwe Dannowski, Vitaly Kuznetsov, kvm, ne-devel-upstream,
	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

v1 -> v2

* Simplify the mask setting logic from the poll function.

Signed-off-by: Andra Paraschiv <andraprs@amazon.com>
Reported-by: kernel test robot <lkp@intel.com>
---
 drivers/virt/nitro_enclaves/ne_misc_dev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c
index f06622b48d695..f1964ea4b8269 100644
--- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
+++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
@@ -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;
 }
-- 
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.


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

* Re: [PATCH v2] nitro_enclaves: Fixup type and simplify logic of the poll mask setup
  2020-11-02 17:36 [PATCH v2] nitro_enclaves: Fixup type and simplify logic of the poll mask setup Andra Paraschiv
@ 2020-11-02 17:50 ` Alexander Graf
  2020-11-02 18:29   ` Paraschiv, Andra-Irina
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2020-11-02 17:50 UTC (permalink / raw)
  To: Andra Paraschiv, linux-kernel
  Cc: Anthony Liguori, Benjamin Herrenschmidt, Colm MacCarthaigh,
	David Duncan, Bjoern Doebel, David Woodhouse,
	Frank van der Linden, Greg Kroah-Hartman, Karen Noel,
	Martin Pohlack, Matt Wilson, Paolo Bonzini, Stefano Garzarella,
	Stefan Hajnoczi, Stewart Smith, Uwe Dannowski, Vitaly Kuznetsov,
	kvm, ne-devel-upstream



On 02.11.20 18:36, Andra Paraschiv wrote:
> 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.
> 
> Signed-off-by: Andra Paraschiv <andraprs@amazon.com>
> Reported-by: kernel test robot <lkp@intel.com>

Reviewed-by: Alexander Graf <graf@amazon.com>


Alex

> ---
>   drivers/virt/nitro_enclaves/ne_misc_dev.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> index f06622b48d695..f1964ea4b8269 100644
> --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
> +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> @@ -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;
>   }
> 



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




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

* Re: [PATCH v2] nitro_enclaves: Fixup type and simplify logic of the poll mask setup
  2020-11-02 17:50 ` Alexander Graf
@ 2020-11-02 18:29   ` Paraschiv, Andra-Irina
  0 siblings, 0 replies; 3+ messages in thread
From: Paraschiv, Andra-Irina @ 2020-11-02 18:29 UTC (permalink / raw)
  To: Alexander Graf, linux-kernel, Greg Kroah-Hartman
  Cc: Anthony Liguori, Benjamin Herrenschmidt, Colm MacCarthaigh,
	David Duncan, Bjoern Doebel, David Woodhouse,
	Frank van der Linden, Karen Noel, Martin Pohlack, Matt Wilson,
	Paolo Bonzini, Stefano Garzarella, Stefan Hajnoczi,
	Stewart Smith, Uwe Dannowski, Vitaly Kuznetsov, kvm,
	ne-devel-upstream



On 02/11/2020 19:50, Alexander Graf wrote:
>
>
> On 02.11.20 18:36, Andra Paraschiv wrote:
>> 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.
>>
>> Signed-off-by: Andra Paraschiv <andraprs@amazon.com>
>> Reported-by: kernel test robot <lkp@intel.com>
>
> Reviewed-by: Alexander Graf <graf@amazon.com>
>
>

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

>
>> ---
>>   drivers/virt/nitro_enclaves/ne_misc_dev.c | 6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c 
>> b/drivers/virt/nitro_enclaves/ne_misc_dev.c
>> index f06622b48d695..f1964ea4b8269 100644
>> --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
>> +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
>> @@ -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;
>>   }
>>




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.


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

end of thread, other threads:[~2020-11-02 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02 17:36 [PATCH v2] nitro_enclaves: Fixup type and simplify logic of the poll mask setup Andra Paraschiv
2020-11-02 17:50 ` Alexander Graf
2020-11-02 18:29   ` Paraschiv, Andra-Irina

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).