accel: Add .mmap to DRM_ACCEL_FOPS

Message ID 1673977558-7648-1-git-send-email-quic_jhugo@quicinc.com
State New
Headers
Series accel: Add .mmap to DRM_ACCEL_FOPS |

Commit Message

Jeffrey Hugo Jan. 17, 2023, 5:45 p.m. UTC
  In reviewing the ivpu driver, DEFINE_DRM_ACCEL_FOPS could have been used
if DRM_ACCEL_FOPS defined .mmap to be drm_gem_mmap.  Lets add that since
accel drivers are a variant of drm drivers, modern drm drivers are
expected to use GEM, and mmap() is a common operation that is expected
to be heavily used in accel drivers thus the common accel driver should
be able to just use DEFINE_DRM_ACCEL_FOPS() for convenience.

Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
---
 include/drm/drm_accel.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Oded Gabbay Jan. 18, 2023, 6:16 a.m. UTC | #1
On Tue, Jan 17, 2023 at 7:48 PM Jeffrey Hugo <quic_jhugo@quicinc.com> wrote:
>
> In reviewing the ivpu driver, DEFINE_DRM_ACCEL_FOPS could have been used
> if DRM_ACCEL_FOPS defined .mmap to be drm_gem_mmap.  Lets add that since
> accel drivers are a variant of drm drivers, modern drm drivers are
> expected to use GEM, and mmap() is a common operation that is expected
> to be heavily used in accel drivers thus the common accel driver should
> be able to just use DEFINE_DRM_ACCEL_FOPS() for convenience.
>
> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> ---
>  include/drm/drm_accel.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/drm/drm_accel.h b/include/drm/drm_accel.h
> index 65c0affb..d495506 100644
> --- a/include/drm/drm_accel.h
> +++ b/include/drm/drm_accel.h
> @@ -27,7 +27,8 @@
>         .compat_ioctl   = drm_compat_ioctl,\
>         .poll           = drm_poll,\
>         .read           = drm_read,\
> -       .llseek         = noop_llseek
> +       .llseek         = noop_llseek, \
> +       .mmap           = drm_gem_mmap
>
>  /**
>   * DEFINE_DRM_ACCEL_FOPS() - macro to generate file operations for accelerators drivers
> --
> 2.7.4
>

Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
I'll merge it through my tree.
Thanks,
Oded
  

Patch

diff --git a/include/drm/drm_accel.h b/include/drm/drm_accel.h
index 65c0affb..d495506 100644
--- a/include/drm/drm_accel.h
+++ b/include/drm/drm_accel.h
@@ -27,7 +27,8 @@ 
 	.compat_ioctl	= drm_compat_ioctl,\
 	.poll		= drm_poll,\
 	.read		= drm_read,\
-	.llseek		= noop_llseek
+	.llseek		= noop_llseek, \
+	.mmap		= drm_gem_mmap
 
 /**
  * DEFINE_DRM_ACCEL_FOPS() - macro to generate file operations for accelerators drivers