diff mbox

[libdrm] Add const qualifier to arguments of drmModeAddFB2()

Message ID 20171010101252.26824-1-tjakobi@math.uni-bielefeld.de (mailing list archive)
State New, archived
Headers show

Commit Message

Tobias Jakobi Oct. 10, 2017, 10:12 a.m. UTC
Both drmModeAddFB2() and drmModeAddFB2WithModifiers() have some
arguments that are just pointers to uint32_t in disguise. These
are not modified (just copied) in the function, so we can add a
const qualifier here.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
 xf86drmMode.c | 10 +++++-----
 xf86drmMode.h | 11 ++++++-----
 2 files changed, 11 insertions(+), 10 deletions(-)

Comments

Eric Engestrom Oct. 10, 2017, 10:33 a.m. UTC | #1
On Tuesday, 2017-10-10 10:12:52 +0000, Tobias Jakobi wrote:
> Both drmModeAddFB2() and drmModeAddFB2WithModifiers() have some
> arguments that are just pointers to uint32_t in disguise. These
> are not modified (just copied) in the function, so we can add a
> const qualifier here.
> 
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

> ---
>  xf86drmMode.c | 10 +++++-----
>  xf86drmMode.h | 11 ++++++-----
>  2 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/xf86drmMode.c b/xf86drmMode.c
> index d3bc20ea..2b3887b3 100644
> --- a/xf86drmMode.c
> +++ b/xf86drmMode.c
> @@ -271,9 +271,9 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
>  }
>  
>  int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
> -                               uint32_t pixel_format, uint32_t bo_handles[4],
> -                               uint32_t pitches[4], uint32_t offsets[4],
> -                               uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
> +                               uint32_t pixel_format, const uint32_t bo_handles[4],
> +                               const uint32_t pitches[4], const uint32_t offsets[4],
> +                               const uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
>  {
>  	struct drm_mode_fb_cmd2 f;
>  	int ret;
> @@ -297,8 +297,8 @@ int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
>  }
>  
>  int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
> -                  uint32_t pixel_format, uint32_t bo_handles[4],
> -                  uint32_t pitches[4], uint32_t offsets[4],
> +                  uint32_t pixel_format, const uint32_t bo_handles[4],
> +                  const uint32_t pitches[4], const uint32_t offsets[4],
>                    uint32_t *buf_id, uint32_t flags)
>  {
>  	return drmModeAddFB2WithModifiers(fd, width, height,
> diff --git a/xf86drmMode.h b/xf86drmMode.h
> index 5b390d9f..6dbe3353 100644
> --- a/xf86drmMode.h
> +++ b/xf86drmMode.h
> @@ -369,15 +369,16 @@ extern int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
>  			uint32_t *buf_id);
>  /* ...with a specific pixel format */
>  extern int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
> -			 uint32_t pixel_format, uint32_t bo_handles[4],
> -			 uint32_t pitches[4], uint32_t offsets[4],
> +			 uint32_t pixel_format, const uint32_t bo_handles[4],
> +			 const uint32_t pitches[4], const uint32_t offsets[4],
>  			 uint32_t *buf_id, uint32_t flags);
>  
>  /* ...with format modifiers */
>  int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
> -			       uint32_t pixel_format, uint32_t bo_handles[4],
> -			       uint32_t pitches[4], uint32_t offsets[4],
> -			       uint64_t modifier[4], uint32_t *buf_id, uint32_t flags);
> +			       uint32_t pixel_format, const uint32_t bo_handles[4],
> +			       const uint32_t pitches[4], const uint32_t offsets[4],
> +			       const uint64_t modifier[4], uint32_t *buf_id,
> +				   uint32_t flags);
>  
>  /**
>   * Destroies the given framebuffer.
> -- 
> 2.13.5
>
diff mbox

Patch

diff --git a/xf86drmMode.c b/xf86drmMode.c
index d3bc20ea..2b3887b3 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -271,9 +271,9 @@  int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
 }
 
 int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
-                               uint32_t pixel_format, uint32_t bo_handles[4],
-                               uint32_t pitches[4], uint32_t offsets[4],
-                               uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
+                               uint32_t pixel_format, const uint32_t bo_handles[4],
+                               const uint32_t pitches[4], const uint32_t offsets[4],
+                               const uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
 {
 	struct drm_mode_fb_cmd2 f;
 	int ret;
@@ -297,8 +297,8 @@  int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
 }
 
 int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
-                  uint32_t pixel_format, uint32_t bo_handles[4],
-                  uint32_t pitches[4], uint32_t offsets[4],
+                  uint32_t pixel_format, const uint32_t bo_handles[4],
+                  const uint32_t pitches[4], const uint32_t offsets[4],
                   uint32_t *buf_id, uint32_t flags)
 {
 	return drmModeAddFB2WithModifiers(fd, width, height,
diff --git a/xf86drmMode.h b/xf86drmMode.h
index 5b390d9f..6dbe3353 100644
--- a/xf86drmMode.h
+++ b/xf86drmMode.h
@@ -369,15 +369,16 @@  extern int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
 			uint32_t *buf_id);
 /* ...with a specific pixel format */
 extern int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
-			 uint32_t pixel_format, uint32_t bo_handles[4],
-			 uint32_t pitches[4], uint32_t offsets[4],
+			 uint32_t pixel_format, const uint32_t bo_handles[4],
+			 const uint32_t pitches[4], const uint32_t offsets[4],
 			 uint32_t *buf_id, uint32_t flags);
 
 /* ...with format modifiers */
 int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
-			       uint32_t pixel_format, uint32_t bo_handles[4],
-			       uint32_t pitches[4], uint32_t offsets[4],
-			       uint64_t modifier[4], uint32_t *buf_id, uint32_t flags);
+			       uint32_t pixel_format, const uint32_t bo_handles[4],
+			       const uint32_t pitches[4], const uint32_t offsets[4],
+			       const uint64_t modifier[4], uint32_t *buf_id,
+				   uint32_t flags);
 
 /**
  * Destroies the given framebuffer.