diff mbox

[libdrm,1/8] Add static qualifier to local functions

Message ID 1425060448-5315-2-git-send-email-jan.vesely@rutgers.edu (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Vesely Feb. 27, 2015, 6:07 p.m. UTC
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
---
 tests/drmstat.c             |  8 ++++----
 tests/kmstest/main.c        |  2 +-
 tests/modeprint/modeprint.c | 18 +++++++++---------
 tests/proptest/proptest.c   |  2 +-
 tests/radeon/radeon_ttm.c   |  4 ++--
 xf86drm.c                   |  2 +-
 xf86drmMode.c               |  2 +-
 7 files changed, 19 insertions(+), 19 deletions(-)

Comments

Emil Velikov March 13, 2015, 11:07 p.m. UTC | #1
On 27 February 2015 at 18:07, Jan Vesely <jan.vesely@rutgers.edu> wrote:
> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
> ---
>  tests/drmstat.c             |  8 ++++----
>  tests/kmstest/main.c        |  2 +-
>  tests/modeprint/modeprint.c | 18 +++++++++---------
>  tests/proptest/proptest.c   |  2 +-
>  tests/radeon/radeon_ttm.c   |  4 ++--
>  xf86drm.c                   |  2 +-
>  xf86drmMode.c               |  2 +-
>  7 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/tests/drmstat.c b/tests/drmstat.c
> index 5935d07..36cc70d 100644
> --- a/tests/drmstat.c
> +++ b/tests/drmstat.c
> @@ -81,13 +81,13 @@ static void getversion(int fd)
>         printf( "No driver available\n" );
>      }
>  }
> -
> -void handler(int fd, void *oldctx, void *newctx)
> +
> +static void handler(int fd, void *oldctx, void *newctx)
>  {
>      printf("Got fd %d\n", fd);
>  }
>
It's only "user" was commented out as a transition to libdrm2 afaict.
Should be safe to nuke alongside the commented out caller.

> -void process_sigio(char *device)
> +static void process_sigio(char *device)
>  {
>      int              fd;
>
> @@ -427,7 +427,7 @@ int main(int argc, char **argv)
>      return r;
>  }
>
> -void DRM_PRINTFLIKE(4, 0)
> +static void DRM_PRINTFLIKE(4, 0)
>  xf86VDrvMsgVerb(int scrnIndex, int type, int verb, const char *format,
>                  va_list args)
Think don't need to bother making this static and just nuke it. It
seems like it was added by mistake (commit c3092ead642) and never
used.

...
> diff --git a/xf86drm.c b/xf86drm.c
> index e117bc6..016247f 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -131,7 +131,7 @@ drmMsg(const char *format, ...)
>      }
>  }
>
> -void
> +static void
>  drmSetDebugMsgFunction(debug_msg_func_t debug_msg_ptr)
>  {
>      drm_debug_print = debug_msg_ptr;
> diff --git a/xf86drmMode.c b/xf86drmMode.c
> index 9ea8fe7..1c06a19 100644
> --- a/xf86drmMode.c
> +++ b/xf86drmMode.c
> @@ -76,7 +76,7 @@ static inline int DRM_IOCTL(int fd, unsigned long cmd, void *arg)
>   * Util functions
>   */
>
> -void* drmAllocCpy(void *array, int count, int entry_size)
> +static void* drmAllocCpy(void *array, int count, int entry_size)
Strictly speaking these could still be used, despite never being part
of the API. Although my vote (fwiw) would be to that we're safe.

Cheers,
Emil
Jan Vesely March 14, 2015, 12:08 a.m. UTC | #2
On Fri, 2015-03-13 at 23:07 +0000, Emil Velikov wrote:
> On 27 February 2015 at 18:07, Jan Vesely <jan.vesely@rutgers.edu> wrote:
> > Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
> > ---
> >  tests/drmstat.c             |  8 ++++----
> >  tests/kmstest/main.c        |  2 +-
> >  tests/modeprint/modeprint.c | 18 +++++++++---------
> >  tests/proptest/proptest.c   |  2 +-
> >  tests/radeon/radeon_ttm.c   |  4 ++--
> >  xf86drm.c                   |  2 +-
> >  xf86drmMode.c               |  2 +-
> >  7 files changed, 19 insertions(+), 19 deletions(-)
> >
> > diff --git a/tests/drmstat.c b/tests/drmstat.c
> > index 5935d07..36cc70d 100644
> > --- a/tests/drmstat.c
> > +++ b/tests/drmstat.c
> > @@ -81,13 +81,13 @@ static void getversion(int fd)
> >         printf( "No driver available\n" );
> >      }
> >  }
> > -
> > -void handler(int fd, void *oldctx, void *newctx)
> > +
> > +static void handler(int fd, void *oldctx, void *newctx)
> >  {
> >      printf("Got fd %d\n", fd);
> >  }
> >
> It's only "user" was commented out as a transition to libdrm2 afaict.
> Should be safe to nuke alongside the commented out caller.

This one got commented out in 8/8 if you prefer I can nuke it, and apply
8/8 before this one.

> 
> > -void process_sigio(char *device)
> > +static void process_sigio(char *device)
> >  {
> >      int              fd;
> >
> > @@ -427,7 +427,7 @@ int main(int argc, char **argv)
> >      return r;
> >  }
> >
> > -void DRM_PRINTFLIKE(4, 0)
> > +static void DRM_PRINTFLIKE(4, 0)
> >  xf86VDrvMsgVerb(int scrnIndex, int type, int verb, const char *format,
> >                  va_list args)
> Think don't need to bother making this static and just nuke it. It
> seems like it was added by mistake (commit c3092ead642) and never
> used.

same here. it is removed in 8/8 I can reorder the patches tog et rid of
this artifact

> 
> ...
> > diff --git a/xf86drm.c b/xf86drm.c
> > index e117bc6..016247f 100644
> > --- a/xf86drm.c
> > +++ b/xf86drm.c
> > @@ -131,7 +131,7 @@ drmMsg(const char *format, ...)
> >      }
> >  }
> >
> > -void
> > +static void
> >  drmSetDebugMsgFunction(debug_msg_func_t debug_msg_ptr)
> >  {
> >      drm_debug_print = debug_msg_ptr;
> > diff --git a/xf86drmMode.c b/xf86drmMode.c
> > index 9ea8fe7..1c06a19 100644
> > --- a/xf86drmMode.c
> > +++ b/xf86drmMode.c
> > @@ -76,7 +76,7 @@ static inline int DRM_IOCTL(int fd, unsigned long cmd, void *arg)
> >   * Util functions
> >   */
> >
> > -void* drmAllocCpy(void *array, int count, int entry_size)
> > +static void* drmAllocCpy(void *array, int count, int entry_size)
> Strictly speaking these could still be used, despite never being part
> of the API. Although my vote (fwiw) would be to that we're safe.

This one is heavily used in the same file.

> 
> Cheers,
> Emil
Emil Velikov March 14, 2015, 1:12 p.m. UTC | #3
On 14/03/15 00:08, Jan Vesely wrote:
> On Fri, 2015-03-13 at 23:07 +0000, Emil Velikov wrote:
>> On 27 February 2015 at 18:07, Jan Vesely <jan.vesely@rutgers.edu> wrote:
>>> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
>>> ---
>>>  tests/drmstat.c             |  8 ++++----
>>>  tests/kmstest/main.c        |  2 +-
>>>  tests/modeprint/modeprint.c | 18 +++++++++---------
>>>  tests/proptest/proptest.c   |  2 +-
>>>  tests/radeon/radeon_ttm.c   |  4 ++--
>>>  xf86drm.c                   |  2 +-
>>>  xf86drmMode.c               |  2 +-
>>>  7 files changed, 19 insertions(+), 19 deletions(-)
>>>
>>> diff --git a/tests/drmstat.c b/tests/drmstat.c
>>> index 5935d07..36cc70d 100644
>>> --- a/tests/drmstat.c
>>> +++ b/tests/drmstat.c
>>> @@ -81,13 +81,13 @@ static void getversion(int fd)
>>>         printf( "No driver available\n" );
>>>      }
>>>  }
>>> -
>>> -void handler(int fd, void *oldctx, void *newctx)
>>> +
>>> +static void handler(int fd, void *oldctx, void *newctx)
>>>  {
>>>      printf("Got fd %d\n", fd);
>>>  }
>>>
>> It's only "user" was commented out as a transition to libdrm2 afaict.
>> Should be safe to nuke alongside the commented out caller.
> 
> This one got commented out in 8/8 if you prefer I can nuke it, and apply
> 8/8 before this one.
> 
>>
>>> -void process_sigio(char *device)
>>> +static void process_sigio(char *device)
>>>  {
>>>      int              fd;
>>>
>>> @@ -427,7 +427,7 @@ int main(int argc, char **argv)
>>>      return r;
>>>  }
>>>
>>> -void DRM_PRINTFLIKE(4, 0)
>>> +static void DRM_PRINTFLIKE(4, 0)
>>>  xf86VDrvMsgVerb(int scrnIndex, int type, int verb, const char *format,
>>>                  va_list args)
>> Think don't need to bother making this static and just nuke it. It
>> seems like it was added by mistake (commit c3092ead642) and never
>> used.
> 
> same here. it is removed in 8/8 I can reorder the patches tog et rid of
> this artifact
> 
That's exactly I was thinking. They seems toe be unused for 4+ years so
might as well kill them off in a single blow.

>>
>> ...
>>> diff --git a/xf86drm.c b/xf86drm.c
>>> index e117bc6..016247f 100644
>>> --- a/xf86drm.c
>>> +++ b/xf86drm.c
>>> @@ -131,7 +131,7 @@ drmMsg(const char *format, ...)
>>>      }
>>>  }
>>>
>>> -void
>>> +static void
>>>  drmSetDebugMsgFunction(debug_msg_func_t debug_msg_ptr)
>>>  {
>>>      drm_debug_print = debug_msg_ptr;
>>> diff --git a/xf86drmMode.c b/xf86drmMode.c
>>> index 9ea8fe7..1c06a19 100644
>>> --- a/xf86drmMode.c
>>> +++ b/xf86drmMode.c
>>> @@ -76,7 +76,7 @@ static inline int DRM_IOCTL(int fd, unsigned long cmd, void *arg)
>>>   * Util functions
>>>   */
>>>
>>> -void* drmAllocCpy(void *array, int count, int entry_size)
>>> +static void* drmAllocCpy(void *array, int count, int entry_size)
>> Strictly speaking these could still be used, despite never being part
>> of the API. Although my vote (fwiw) would be to that we're safe.
> 
> This one is heavily used in the same file.
> 
I might have been a bit vague there. I'm not saying a word against any
of it, just pointing out that there is a very small chance it may break
some unusual apps.


-Emil
diff mbox

Patch

diff --git a/tests/drmstat.c b/tests/drmstat.c
index 5935d07..36cc70d 100644
--- a/tests/drmstat.c
+++ b/tests/drmstat.c
@@ -81,13 +81,13 @@  static void getversion(int fd)
 	printf( "No driver available\n" );
     }
 }
-	
-void handler(int fd, void *oldctx, void *newctx)
+
+static void handler(int fd, void *oldctx, void *newctx)
 {
     printf("Got fd %d\n", fd);
 }
 
-void process_sigio(char *device)
+static void process_sigio(char *device)
 {
     int              fd;
 
@@ -427,7 +427,7 @@  int main(int argc, char **argv)
     return r; 
 }
 
-void DRM_PRINTFLIKE(4, 0)
+static void DRM_PRINTFLIKE(4, 0)
 xf86VDrvMsgVerb(int scrnIndex, int type, int verb, const char *format,
                 va_list args)
 {
diff --git a/tests/kmstest/main.c b/tests/kmstest/main.c
index 2c87b1c..d8c6c1f 100644
--- a/tests/kmstest/main.c
+++ b/tests/kmstest/main.c
@@ -37,7 +37,7 @@ 
 		return ret; \
 	}
 
-int test_bo(struct kms_driver *kms)
+static int test_bo(struct kms_driver *kms)
 {
 	struct kms_bo *bo;
 	int ret;
diff --git a/tests/modeprint/modeprint.c b/tests/modeprint/modeprint.c
index 6f0d039..de59cbd 100644
--- a/tests/modeprint/modeprint.c
+++ b/tests/modeprint/modeprint.c
@@ -53,7 +53,7 @@  int crtcs;
 int fbs;
 char *module_name;
 
-const char* getConnectionText(drmModeConnection conn)
+static const char* getConnectionText(drmModeConnection conn)
 {
 	switch (conn) {
 	case DRM_MODE_CONNECTED:
@@ -66,7 +66,7 @@  const char* getConnectionText(drmModeConnection conn)
 
 }
 
-int printMode(struct drm_mode_modeinfo *mode)
+static int printMode(struct drm_mode_modeinfo *mode)
 {
 	if (full_modes) {
 		printf("Mode: %s\n", mode->name);
@@ -90,7 +90,7 @@  int printMode(struct drm_mode_modeinfo *mode)
 	return 0;
 }
 
-int printProperty(int fd, drmModeResPtr res, drmModePropertyPtr props, uint64_t value)
+static int printProperty(int fd, drmModeResPtr res, drmModePropertyPtr props, uint64_t value)
 {
 	const char *name = NULL;
 	int j;
@@ -161,7 +161,7 @@  static const char * const output_names[] = { "None",
 					     "DSI",
 };
 
-int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connector, uint32_t id)
+static int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connector, uint32_t id)
 {
 	int i = 0;
 	struct drm_mode_modeinfo *mode = NULL;
@@ -214,7 +214,7 @@  int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connector, uin
 	return 0;
 }
 
-int printEncoder(int fd, drmModeResPtr res, drmModeEncoderPtr encoder, uint32_t id)
+static int printEncoder(int fd, drmModeResPtr res, drmModeEncoderPtr encoder, uint32_t id)
 {
 	printf("Encoder\n");
 	printf("\tid     :%i\n", id);
@@ -225,7 +225,7 @@  int printEncoder(int fd, drmModeResPtr res, drmModeEncoderPtr encoder, uint32_t
 	return 0;
 }
 
-int printCrtc(int fd, drmModeResPtr res, drmModeCrtcPtr crtc, uint32_t id)
+static int printCrtc(int fd, drmModeResPtr res, drmModeCrtcPtr crtc, uint32_t id)
 {
 	printf("Crtc\n");
 	printf("\tid             : %i\n", id);
@@ -239,7 +239,7 @@  int printCrtc(int fd, drmModeResPtr res, drmModeCrtcPtr crtc, uint32_t id)
 	return 0;
 }
 
-int printFrameBuffer(int fd, drmModeResPtr res, drmModeFBPtr fb)
+static int printFrameBuffer(int fd, drmModeResPtr res, drmModeFBPtr fb)
 {
 	printf("Framebuffer\n");
 	printf("\thandle    : %i\n", fb->handle);
@@ -253,7 +253,7 @@  int printFrameBuffer(int fd, drmModeResPtr res, drmModeFBPtr fb)
 	return 0;
 }
 
-int printRes(int fd, drmModeResPtr res)
+static int printRes(int fd, drmModeResPtr res)
 {
 	int i;
 	drmModeFBPtr fb;
@@ -329,7 +329,7 @@  int printRes(int fd, drmModeResPtr res)
 	return 0;
 }
 
-void args(int argc, char **argv)
+static void args(int argc, char **argv)
 {
 	int i;
 
diff --git a/tests/proptest/proptest.c b/tests/proptest/proptest.c
index 7618f63..3496065 100644
--- a/tests/proptest/proptest.c
+++ b/tests/proptest/proptest.c
@@ -44,7 +44,7 @@  static inline int64_t U642I64(uint64_t val)
 int fd;
 drmModeResPtr res = NULL;
 
-const char *connector_type_str(uint32_t type)
+static const char *connector_type_str(uint32_t type)
 {
 	switch (type) {
 	case DRM_MODE_CONNECTOR_Unknown:
diff --git a/tests/radeon/radeon_ttm.c b/tests/radeon/radeon_ttm.c
index ac3297a..8346e85 100644
--- a/tests/radeon/radeon_ttm.c
+++ b/tests/radeon/radeon_ttm.c
@@ -32,7 +32,7 @@ 
 /* allocate as many single page bo to try to starve the kernel
  * memory zone (below highmem)
  */
-void ttm_starve_kernel_private_memory(int fd)
+static void ttm_starve_kernel_private_memory(int fd)
 {
     struct list_head list;
     struct rbo *bo, *tmp;
@@ -55,7 +55,7 @@  void ttm_starve_kernel_private_memory(int fd)
     }
 }
 
-int radeon_open_fd(void)
+static int radeon_open_fd(void)
 {
     return drmOpen("radeon", NULL);
 }
diff --git a/xf86drm.c b/xf86drm.c
index e117bc6..016247f 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -131,7 +131,7 @@  drmMsg(const char *format, ...)
     }
 }
 
-void
+static void
 drmSetDebugMsgFunction(debug_msg_func_t debug_msg_ptr)
 {
     drm_debug_print = debug_msg_ptr;
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 9ea8fe7..1c06a19 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -76,7 +76,7 @@  static inline int DRM_IOCTL(int fd, unsigned long cmd, void *arg)
  * Util functions
  */
 
-void* drmAllocCpy(void *array, int count, int entry_size)
+static void* drmAllocCpy(void *array, int count, int entry_size)
 {
 	char *r;
 	int i;