Author: hselasky
Date: Thu Aug 10 13:05:40 2017
New Revision: 322357
URL: https://svnweb.freebsd.org/changeset/base/322357

Log:
  Use integer type to pass around jiffies and/or ticks values in the
  LinuxKPI because in FreeBSD ticks are 32-bit.
  
  MFC after:    1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/completion.h
  head/sys/compat/linuxkpi/common/include/linux/jiffies.h
  head/sys/compat/linuxkpi/common/include/linux/timer.h
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/completion.h  Thu Aug 10 
13:01:19 2017        (r322356)
+++ head/sys/compat/linuxkpi/common/include/linux/completion.h  Thu Aug 10 
13:05:40 2017        (r322357)
@@ -61,8 +61,8 @@ struct completion {
        linux_completion_done(c)
 
 extern void linux_complete_common(struct completion *, int);
-extern long linux_wait_for_common(struct completion *, int);
-extern long linux_wait_for_timeout_common(struct completion *, long, int);
+extern int linux_wait_for_common(struct completion *, int);
+extern int linux_wait_for_timeout_common(struct completion *, int, int);
 extern int linux_try_wait_for_completion(struct completion *);
 extern int linux_completion_done(struct completion *);
 

Modified: head/sys/compat/linuxkpi/common/include/linux/jiffies.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/jiffies.h     Thu Aug 10 
13:01:19 2017        (r322356)
+++ head/sys/compat/linuxkpi/common/include/linux/jiffies.h     Thu Aug 10 
13:05:40 2017        (r322357)
@@ -141,7 +141,7 @@ get_jiffies_64(void)
 }
 
 static inline int
-linux_timer_jiffies_until(unsigned long expires)
+linux_timer_jiffies_until(int expires)
 {
        int delta = expires - jiffies;
        /* guard against already expired values */

Modified: head/sys/compat/linuxkpi/common/include/linux/timer.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/timer.h       Thu Aug 10 
13:01:19 2017        (r322356)
+++ head/sys/compat/linuxkpi/common/include/linux/timer.h       Thu Aug 10 
13:05:40 2017        (r322357)
@@ -41,7 +41,7 @@ struct timer_list {
        struct callout timer_callout;
        void    (*function) (unsigned long);
        unsigned long data;
-       unsigned long expires;
+       int expires;
 };
 
 extern unsigned long linux_timer_hz_mask;
@@ -65,7 +65,7 @@ extern unsigned long linux_timer_hz_mask;
        callout_init(&(timer)->timer_callout, 1);                       \
 } while (0)
 
-extern void mod_timer(struct timer_list *, unsigned long);
+extern void mod_timer(struct timer_list *, int);
 extern void add_timer(struct timer_list *);
 extern void add_timer_on(struct timer_list *, int cpu);
 
@@ -73,7 +73,7 @@ extern void add_timer_on(struct timer_list *, int cpu)
 #define        del_timer_sync(timer)   callout_drain(&(timer)->timer_callout)
 #define        timer_pending(timer)    callout_pending(&(timer)->timer_callout)
 #define        round_jiffies(j)        \
-       ((unsigned long)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask))
+       ((int)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask))
 #define        round_jiffies_relative(j) round_jiffies(j)
 #define        round_jiffies_up(j)     round_jiffies(j)
 #define        round_jiffies_up_relative(j) round_jiffies_up(j)

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Aug 10 13:01:19 
2017        (r322356)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Aug 10 13:05:40 
2017        (r322357)
@@ -1598,7 +1598,7 @@ linux_timer_callback_wrapper(void *context)
 }
 
 void
-mod_timer(struct timer_list *timer, unsigned long expires)
+mod_timer(struct timer_list *timer, int expires)
 {
 
        timer->expires = expires;
@@ -1660,10 +1660,10 @@ linux_complete_common(struct completion *c, int all)
 /*
  * Indefinite wait for done != 0 with or without signals.
  */
-long
+int
 linux_wait_for_common(struct completion *c, int flags)
 {
-       long error;
+       int error;
 
        if (SCHEDULER_STOPPED())
                return (0);
@@ -1700,10 +1700,11 @@ intr:
 /*
  * Time limited wait for done != 0 with or without signals.
  */
-long
-linux_wait_for_timeout_common(struct completion *c, long timeout, int flags)
+int
+linux_wait_for_timeout_common(struct completion *c, int timeout, int flags)
 {
-       long end = jiffies + timeout, error;
+       int end = jiffies + timeout;
+       int error;
        int ret;
 
        if (SCHEDULER_STOPPED())
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to