diff mbox series

[5/5] drm: Fix return type of crc .poll()

Message ID 20190710125143.9965-5-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/fb-helper: Include prototype for drm_fb_helper_modinit() | expand

Commit Message

Ville Syrjälä July 10, 2019, 12:51 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Sparse compains:
../drivers/gpu/drm/drm_debugfs_crc.c:350:17: warning: incorrect type in initializer (different base types)
../drivers/gpu/drm/drm_debugfs_crc.c:350:17:    expected restricted __poll_t ( *poll )( ... )
../drivers/gpu/drm/drm_debugfs_crc.c:350:17:    got unsigned int ( * )( ... )

Change the .poll() return type to __poll_t to silence it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_debugfs_crc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Sean Paul July 11, 2019, 3:40 p.m. UTC | #1
On Wed, Jul 10, 2019 at 03:51:43PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Sparse compains:
> ../drivers/gpu/drm/drm_debugfs_crc.c:350:17: warning: incorrect type in initializer (different base types)
> ../drivers/gpu/drm/drm_debugfs_crc.c:350:17:    expected restricted __poll_t ( *poll )( ... )
> ../drivers/gpu/drm/drm_debugfs_crc.c:350:17:    got unsigned int ( * )( ... )
> 
> Change the .poll() return type to __poll_t to silence it.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Sean Paul <sean@poorly.run>

> ---
>  drivers/gpu/drm/drm_debugfs_crc.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
> index 7ca486d750e9..284d615ed08b 100644
> --- a/drivers/gpu/drm/drm_debugfs_crc.c
> +++ b/drivers/gpu/drm/drm_debugfs_crc.c
> @@ -325,19 +325,17 @@ static ssize_t crtc_crc_read(struct file *filep, char __user *user_buf,
>  	return LINE_LEN(crc->values_cnt);
>  }
>  
> -static unsigned int crtc_crc_poll(struct file *file, poll_table *wait)
> +static __poll_t crtc_crc_poll(struct file *file, poll_table *wait)
>  {
>  	struct drm_crtc *crtc = file->f_inode->i_private;
>  	struct drm_crtc_crc *crc = &crtc->crc;
> -	unsigned ret;
> +	__poll_t ret = 0;
>  
>  	poll_wait(file, &crc->wq, wait);
>  
>  	spin_lock_irq(&crc->lock);
>  	if (crc->source && crtc_crc_data_count(crc))
> -		ret = POLLIN | POLLRDNORM;
> -	else
> -		ret = 0;
> +		ret |= EPOLLIN | EPOLLRDNORM;
>  	spin_unlock_irq(&crc->lock);
>  
>  	return ret;
> -- 
> 2.21.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index 7ca486d750e9..284d615ed08b 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -325,19 +325,17 @@  static ssize_t crtc_crc_read(struct file *filep, char __user *user_buf,
 	return LINE_LEN(crc->values_cnt);
 }
 
-static unsigned int crtc_crc_poll(struct file *file, poll_table *wait)
+static __poll_t crtc_crc_poll(struct file *file, poll_table *wait)
 {
 	struct drm_crtc *crtc = file->f_inode->i_private;
 	struct drm_crtc_crc *crc = &crtc->crc;
-	unsigned ret;
+	__poll_t ret = 0;
 
 	poll_wait(file, &crc->wq, wait);
 
 	spin_lock_irq(&crc->lock);
 	if (crc->source && crtc_crc_data_count(crc))
-		ret = POLLIN | POLLRDNORM;
-	else
-		ret = 0;
+		ret |= EPOLLIN | EPOLLRDNORM;
 	spin_unlock_irq(&crc->lock);
 
 	return ret;