Skip to contentSkip to conversation

drm/amdkfd: sparse: fix incorrect type in assignment

PATCH In review Felix Kuehling 2 participants 3 messages Jun 26, 2020 – Jul 14, 2020

Subsystems (3)
lore
Share & tools
lore

Felix Kuehling

author maintainer
#0 lore raw

PATCH 1/1 drm/amdkfd: sparse: fix incorrect type in assignment

The correct way to implement the fops->poll callback uses EPOLL* macros.

For reference see also:
commit a9a08845e9ac ("vfs: do bulk POLL* -> EPOLL* replacement") commit 7a163b2195cd ("unify {de,}mangle_poll(), get rid of kernel-side POLL...")

Fixes 73b753a11ae9 ("drm/amdkfd: Provide SMI events watch")
---
 drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +3 -2
index f3782627407f..7b348bf9df21 100644
@@ -59,13 +59,14 @@ static const struct file_operations kfd_smi_ev_fops = {
 static __poll_t kfd_smi_ev_poll(struct file *filep,
 				struct poll_table_struct *wait)
 {
-	__poll_t mask;
 	struct kfd_smi_client *client = filep->private_data;
+	__poll_t mask = 0;
 
 	poll_wait(filep, &client->wait_queue, wait);
 
 	spin_lock(&client->lock);
-	mask = kfifo_is_empty(&client->fifo) ? 0 : POLLIN | POLLRDNORM;
+	if (!kfifo_is_empty(&client->fifo))
+		mask = EPOLLIN | EPOLLRDNORM;
 	spin_unlock(&client->lock);
 
 	return mask;
Signature · 6 lines
2.27.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author maintainer
#1 lore raw

Ping.

Am 2020-06-26 um 7:39 p.m. schrieb Felix Kuehling:

Quoted 24 lines

The correct way to implement the fops->poll callback uses EPOLL* macros.

For reference see also:
commit a9a08845e9ac ("vfs: do bulk POLL* -> EPOLL* replacement") commit 7a163b2195cd ("unify {de,}mangle_poll(), get rid of kernel-side POLL...")

Fixes 73b753a11ae9 ("drm/amdkfd: Provide SMI events watch")
---
 drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +1 -1
index f3782627407f..7b348bf9df21 100644
@@ -59,13 +59,14 @@ static const struct file_operations kfd_smi_ev_fops = {
 static __poll_t kfd_smi_ev_poll(struct file *filep,
 				struct poll_table_struct *wait)
 {
-	__poll_t mask;
 	struct kfd_smi_client *client = filep->private_data;
+	__poll_t mask = 0;

drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c static const struct file_operations kfd_smi_ev_fops = { · line 72

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +2 -1
 
 	poll_wait(filep, &client->wait_queue, wait);
 
 	spin_lock(&client->lock);
-	mask = kfifo_is_empty(&client->fifo) ? 0 : POLLIN | POLLRDNORM;
+	if (!kfifo_is_empty(&client->fifo))
+		mask = EPOLLIN | EPOLLRDNORM;
 	spin_unlock(&client->lock);
 
 	return mask;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#2 lore raw
Quoted 36 lines · Felix Kuehling

Ping.

Am 2020-06-26 um 7:39 p.m. schrieb Felix Kuehling:

Quoted 33 lines

The correct way to implement the fops->poll callback uses EPOLL* macros.

For reference see also:
commit a9a08845e9ac ("vfs: do bulk POLL* -> EPOLL* replacement") commit 7a163b2195cd ("unify {de,}mangle_poll(), get rid of kernel-side POLL...")

Fixes 73b753a11ae9 ("drm/amdkfd: Provide SMI events watch")
---
  drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +3 -2
index f3782627407f..7b348bf9df21 100644
@@ -59,13 +59,14 @@ static const struct file_operations kfd_smi_ev_fops = {
  static __poll_t kfd_smi_ev_poll(struct file *filep,
  				struct poll_table_struct *wait)
  {
-	__poll_t mask;
  	struct kfd_smi_client *client = filep->private_data;
+	__poll_t mask = 0;
 
  	poll_wait(filep, &client->wait_queue, wait);
 
  	spin_lock(&client->lock);
-	mask = kfifo_is_empty(&client->fifo) ? 0 : POLLIN | POLLRDNORM;
+	if (!kfifo_is_empty(&client->fifo))
+		mask = EPOLLIN | EPOLLRDNORM;
  	spin_unlock(&client->lock);
 
Quoted 5 lines

drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c static const struct file_operations kfd_smi_ev_fops = { · line 72

Quoted 1 line
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +0 -0
  	return mask;

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cphilip.yang%40amd.com%7C1359cbce5ac84b5dd02608d821d46a48%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637296543503819875&sdata=Q1KlOB%2FlF1GdUHTMD8a5NycjBDGhSDxo7qlIT8kyXeE%3D&reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx