diff mbox

[i-g-t,v7,1/5] lib: Make signal helper definitions reusable

Message ID 1479720311-1840-2-git-send-email-abdiel.janulgue@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Abdiel Janulgue Nov. 21, 2016, 9:25 a.m. UTC
More and more test-cases are using this.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
 lib/igt_aux.c       | 11 -----------
 lib/igt_aux.h       | 10 ++++++++++
 lib/igt_core.c      |  3 ---
 tests/drv_hangman.c |  1 -
 4 files changed, 10 insertions(+), 15 deletions(-)

Comments

Tomeu Vizoso Nov. 21, 2016, 2:51 p.m. UTC | #1
On 21 November 2016 at 10:25, Abdiel Janulgue
<abdiel.janulgue@linux.intel.com> wrote:
> More and more test-cases are using this.
>
> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> ---
>  lib/igt_aux.c       | 11 -----------
>  lib/igt_aux.h       | 10 ++++++++++
>  lib/igt_core.c      |  3 ---
>  tests/drv_hangman.c |  1 -
>  4 files changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 421f6d4..b5ae854 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -75,17 +75,6 @@
>   * fit into any other topic.
>   */
>
> -
> -/* signal interrupt helpers */
> -
> -#define MSEC_PER_SEC (1000)
> -#define USEC_PER_SEC (1000*MSEC_PER_SEC)
> -#define NSEC_PER_SEC (1000*USEC_PER_SEC)
> -
> -/* signal interrupt helpers */
> -#define gettid() syscall(__NR_gettid)
> -#define sigev_notify_thread_id _sigev_un._tid

I see a few more instances of these in other files. Could those be removed now?

Otherwise it looks good to me.

Regards,

Tomeu

> -
>  static struct __igt_sigiter_global {
>         pid_t tid;
>         timer_t timer;
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index d30196b..d4da499 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -35,6 +35,16 @@
>  extern drm_intel_bo **trash_bos;
>  extern int num_trash_bos;
>
> +/* signal interrupt helpers */
> +
> +#define MSEC_PER_SEC (1000)
> +#define USEC_PER_SEC (1000*MSEC_PER_SEC)
> +#define NSEC_PER_SEC (1000*USEC_PER_SEC)
> +
> +/* signal interrupt helpers */
> +#define gettid() syscall(__NR_gettid)
> +#define sigev_notify_thread_id _sigev_un._tid
> +
>  /* auxialiary igt helpers from igt_aux.c */
>  /* generally useful helpers */
>  void igt_fork_signal_helper(void);
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 9cd5f98..f64c809 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -398,9 +398,6 @@ error:
>         return -errno;
>  }
>
> -#define MSEC_PER_SEC (1000)
> -#define USEC_PER_SEC (1000*MSEC_PER_SEC)
> -#define NSEC_PER_SEC (1000*USEC_PER_SEC)
>  uint64_t igt_nsec_elapsed(struct timespec *start)
>  {
>         struct timespec now;
> diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c
> index f80d65d..db0a077 100644
> --- a/tests/drv_hangman.c
> +++ b/tests/drv_hangman.c
> @@ -293,7 +293,6 @@ static void test_error_state_capture(unsigned ring_id,
>   * case and it takes a lot more time to wrap, so the acthd can potentially keep
>   * increasing for a long time
>   */
> -#define NSEC_PER_SEC   1000000000LL
>  static void hangcheck_unterminated(void)
>  {
>         int fd;
> --
> 2.7.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 421f6d4..b5ae854 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -75,17 +75,6 @@ 
  * fit into any other topic.
  */
 
-
-/* signal interrupt helpers */
-
-#define MSEC_PER_SEC (1000)
-#define USEC_PER_SEC (1000*MSEC_PER_SEC)
-#define NSEC_PER_SEC (1000*USEC_PER_SEC)
-
-/* signal interrupt helpers */
-#define gettid() syscall(__NR_gettid)
-#define sigev_notify_thread_id _sigev_un._tid
-
 static struct __igt_sigiter_global {
 	pid_t tid;
 	timer_t timer;
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index d30196b..d4da499 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -35,6 +35,16 @@ 
 extern drm_intel_bo **trash_bos;
 extern int num_trash_bos;
 
+/* signal interrupt helpers */
+
+#define MSEC_PER_SEC (1000)
+#define USEC_PER_SEC (1000*MSEC_PER_SEC)
+#define NSEC_PER_SEC (1000*USEC_PER_SEC)
+
+/* signal interrupt helpers */
+#define gettid() syscall(__NR_gettid)
+#define sigev_notify_thread_id _sigev_un._tid
+
 /* auxialiary igt helpers from igt_aux.c */
 /* generally useful helpers */
 void igt_fork_signal_helper(void);
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 9cd5f98..f64c809 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -398,9 +398,6 @@  error:
 	return -errno;
 }
 
-#define MSEC_PER_SEC (1000)
-#define USEC_PER_SEC (1000*MSEC_PER_SEC)
-#define NSEC_PER_SEC (1000*USEC_PER_SEC)
 uint64_t igt_nsec_elapsed(struct timespec *start)
 {
 	struct timespec now;
diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c
index f80d65d..db0a077 100644
--- a/tests/drv_hangman.c
+++ b/tests/drv_hangman.c
@@ -293,7 +293,6 @@  static void test_error_state_capture(unsigned ring_id,
  * case and it takes a lot more time to wrap, so the acthd can potentially keep
  * increasing for a long time
  */
-#define NSEC_PER_SEC	1000000000LL
 static void hangcheck_unterminated(void)
 {
 	int fd;