Re: [PATCH v5] isdn: Use ktime_t instead of 'struct timeval'
From: kbuild test robot
Date: Thu Oct 29 2015 - 03:44:50 EST
Hi Tina,
[auto build test ERROR on asm-generic/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Tina-Ruchandani/isdn-Use-ktime_t-instead-of-struct-timeval/20151029-151936
config: x86_64-randconfig-x018-201543 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
>> drivers/isdn/mISDN/clock.c:143:1: error: conflicting types for 'mISDN_clock_update'
mISDN_clock_update(struct mISDNclock *iclock, int samples, struct timeval *tv)
^
In file included from drivers/isdn/mISDN/clock.c:41:0:
include/linux/mISDNif.h:599:13: note: previous declaration of 'mISDN_clock_update' was here
extern void mISDN_clock_update(struct mISDNclock *, int, ktime_t *);
^
drivers/isdn/mISDN/clock.c: In function 'mISDN_clock_update':
>> drivers/isdn/mISDN/clock.c:163:14: error: incompatible types when assigning to type 'ktime_t {aka union ktime}' from type 'struct timeval'
iclock_tv = *tv;
^
drivers/isdn/mISDN/clock.c:169:11: error: incompatible types when assigning to type 'ktime_t {aka union ktime}' from type 'struct timeval'
tv_now = *tv;
^
>> drivers/isdn/mISDN/clock.c:175:13: error: invalid operands to binary + (have 'ktime_t {aka union ktime}' and 'int')
iclock_tv += delta;
^
In file included from include/linux/linkage.h:6:0,
from include/linux/preempt.h:9,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from drivers/isdn/mISDN/clock.c:36:
drivers/isdn/mISDN/clock.c: At top level:
drivers/isdn/mISDN/clock.c:184:15: error: conflicting types for 'mISDN_clock_update'
EXPORT_SYMBOL(mISDN_clock_update);
^
include/linux/export.h:57:21: note: in definition of macro '__EXPORT_SYMBOL'
extern typeof(sym) sym; \
^
>> drivers/isdn/mISDN/clock.c:184:1: note: in expansion of macro 'EXPORT_SYMBOL'
EXPORT_SYMBOL(mISDN_clock_update);
^
In file included from drivers/isdn/mISDN/clock.c:41:0:
include/linux/mISDNif.h:599:13: note: previous declaration of 'mISDN_clock_update' was here
extern void mISDN_clock_update(struct mISDNclock *, int, ktime_t *);
^
vim +/mISDN_clock_update +143 drivers/isdn/mISDN/clock.c
3bd69ad1 Andreas Eversberg 2008-09-06 30 *
3bd69ad1 Andreas Eversberg 2008-09-06 31 * To get current clock, call mISDN_clock_get. The signed short value
3bd69ad1 Andreas Eversberg 2008-09-06 32 * counts the number of samples since. Time since last clock event is added.
3bd69ad1 Andreas Eversberg 2008-09-06 33 *
3bd69ad1 Andreas Eversberg 2008-09-06 34 */
3bd69ad1 Andreas Eversberg 2008-09-06 35
5a0e3ad6 Tejun Heo 2010-03-24 @36 #include <linux/slab.h>
3bd69ad1 Andreas Eversberg 2008-09-06 37 #include <linux/types.h>
3bd69ad1 Andreas Eversberg 2008-09-06 38 #include <linux/stddef.h>
3bd69ad1 Andreas Eversberg 2008-09-06 39 #include <linux/spinlock.h>
d207c231 Tina Ruchandani 2015-10-29 40 #include <linux/ktime.h>
3bd69ad1 Andreas Eversberg 2008-09-06 41 #include <linux/mISDNif.h>
5d76fc21 Paul Gortmaker 2011-07-10 42 #include <linux/export.h>
3bd69ad1 Andreas Eversberg 2008-09-06 43 #include "core.h"
3bd69ad1 Andreas Eversberg 2008-09-06 44
3bd69ad1 Andreas Eversberg 2008-09-06 45 static u_int *debug;
3bd69ad1 Andreas Eversberg 2008-09-06 46 static LIST_HEAD(iclock_list);
f8532fde Hannes Eder 2009-02-12 47 static DEFINE_RWLOCK(iclock_lock);
f8532fde Hannes Eder 2009-02-12 48 static u16 iclock_count; /* counter of last clock */
d207c231 Tina Ruchandani 2015-10-29 49 static ktime_t iclock_tv; /* time stamp of last clock */
f8532fde Hannes Eder 2009-02-12 50 static int iclock_tv_valid; /* already received one timestamp */
f8532fde Hannes Eder 2009-02-12 51 static struct mISDNclock *iclock_current;
3bd69ad1 Andreas Eversberg 2008-09-06 52
3bd69ad1 Andreas Eversberg 2008-09-06 53 void
3bd69ad1 Andreas Eversberg 2008-09-06 54 mISDN_init_clock(u_int *dp)
3bd69ad1 Andreas Eversberg 2008-09-06 55 {
3bd69ad1 Andreas Eversberg 2008-09-06 56 debug = dp;
d207c231 Tina Ruchandani 2015-10-29 57 iclock_tv = ktime_get();
3bd69ad1 Andreas Eversberg 2008-09-06 58 }
3bd69ad1 Andreas Eversberg 2008-09-06 59
3bd69ad1 Andreas Eversberg 2008-09-06 60 static void
3bd69ad1 Andreas Eversberg 2008-09-06 61 select_iclock(void)
3bd69ad1 Andreas Eversberg 2008-09-06 62 {
3bd69ad1 Andreas Eversberg 2008-09-06 63 struct mISDNclock *iclock, *bestclock = NULL, *lastclock = NULL;
3bd69ad1 Andreas Eversberg 2008-09-06 64 int pri = -128;
3bd69ad1 Andreas Eversberg 2008-09-06 65
3bd69ad1 Andreas Eversberg 2008-09-06 66 list_for_each_entry(iclock, &iclock_list, list) {
3bd69ad1 Andreas Eversberg 2008-09-06 67 if (iclock->pri > pri) {
3bd69ad1 Andreas Eversberg 2008-09-06 68 pri = iclock->pri;
3bd69ad1 Andreas Eversberg 2008-09-06 69 bestclock = iclock;
3bd69ad1 Andreas Eversberg 2008-09-06 70 }
3bd69ad1 Andreas Eversberg 2008-09-06 71 if (iclock_current == iclock)
3bd69ad1 Andreas Eversberg 2008-09-06 72 lastclock = iclock;
3bd69ad1 Andreas Eversberg 2008-09-06 73 }
3bd69ad1 Andreas Eversberg 2008-09-06 74 if (lastclock && bestclock != lastclock) {
3bd69ad1 Andreas Eversberg 2008-09-06 75 /* last used clock source still exists but changes, disable */
3bd69ad1 Andreas Eversberg 2008-09-06 76 if (*debug & DEBUG_CLOCK)
3bd69ad1 Andreas Eversberg 2008-09-06 77 printk(KERN_DEBUG "Old clock source '%s' disable.\n",
3bd69ad1 Andreas Eversberg 2008-09-06 78 lastclock->name);
3bd69ad1 Andreas Eversberg 2008-09-06 79 lastclock->ctl(lastclock->priv, 0);
3bd69ad1 Andreas Eversberg 2008-09-06 80 }
3bd69ad1 Andreas Eversberg 2008-09-06 81 if (bestclock && bestclock != iclock_current) {
3bd69ad1 Andreas Eversberg 2008-09-06 82 /* new clock source selected, enable */
3bd69ad1 Andreas Eversberg 2008-09-06 83 if (*debug & DEBUG_CLOCK)
3bd69ad1 Andreas Eversberg 2008-09-06 84 printk(KERN_DEBUG "New clock source '%s' enable.\n",
3bd69ad1 Andreas Eversberg 2008-09-06 85 bestclock->name);
3bd69ad1 Andreas Eversberg 2008-09-06 86 bestclock->ctl(bestclock->priv, 1);
3bd69ad1 Andreas Eversberg 2008-09-06 87 }
3bd69ad1 Andreas Eversberg 2008-09-06 88 if (bestclock != iclock_current) {
3bd69ad1 Andreas Eversberg 2008-09-06 89 /* no clock received yet */
3bd69ad1 Andreas Eversberg 2008-09-06 90 iclock_tv_valid = 0;
3bd69ad1 Andreas Eversberg 2008-09-06 91 }
3bd69ad1 Andreas Eversberg 2008-09-06 92 iclock_current = bestclock;
3bd69ad1 Andreas Eversberg 2008-09-06 93 }
3bd69ad1 Andreas Eversberg 2008-09-06 94
3bd69ad1 Andreas Eversberg 2008-09-06 95 struct mISDNclock
3bd69ad1 Andreas Eversberg 2008-09-06 96 *mISDN_register_clock(char *name, int pri, clockctl_func_t *ctl, void *priv)
3bd69ad1 Andreas Eversberg 2008-09-06 97 {
3bd69ad1 Andreas Eversberg 2008-09-06 98 u_long flags;
3bd69ad1 Andreas Eversberg 2008-09-06 99 struct mISDNclock *iclock;
3bd69ad1 Andreas Eversberg 2008-09-06 100
3bd69ad1 Andreas Eversberg 2008-09-06 101 if (*debug & (DEBUG_CORE | DEBUG_CLOCK))
3bd69ad1 Andreas Eversberg 2008-09-06 102 printk(KERN_DEBUG "%s: %s %d\n", __func__, name, pri);
3bd69ad1 Andreas Eversberg 2008-09-06 103 iclock = kzalloc(sizeof(struct mISDNclock), GFP_ATOMIC);
3bd69ad1 Andreas Eversberg 2008-09-06 104 if (!iclock) {
3bd69ad1 Andreas Eversberg 2008-09-06 105 printk(KERN_ERR "%s: No memory for clock entry.\n", __func__);
3bd69ad1 Andreas Eversberg 2008-09-06 106 return NULL;
3bd69ad1 Andreas Eversberg 2008-09-06 107 }
3bd69ad1 Andreas Eversberg 2008-09-06 108 strncpy(iclock->name, name, sizeof(iclock->name) - 1);
3bd69ad1 Andreas Eversberg 2008-09-06 109 iclock->pri = pri;
3bd69ad1 Andreas Eversberg 2008-09-06 110 iclock->priv = priv;
3bd69ad1 Andreas Eversberg 2008-09-06 111 iclock->ctl = ctl;
3bd69ad1 Andreas Eversberg 2008-09-06 112 write_lock_irqsave(&iclock_lock, flags);
3bd69ad1 Andreas Eversberg 2008-09-06 113 list_add_tail(&iclock->list, &iclock_list);
3bd69ad1 Andreas Eversberg 2008-09-06 114 select_iclock();
3bd69ad1 Andreas Eversberg 2008-09-06 115 write_unlock_irqrestore(&iclock_lock, flags);
3bd69ad1 Andreas Eversberg 2008-09-06 116 return iclock;
3bd69ad1 Andreas Eversberg 2008-09-06 117 }
3bd69ad1 Andreas Eversberg 2008-09-06 118 EXPORT_SYMBOL(mISDN_register_clock);
3bd69ad1 Andreas Eversberg 2008-09-06 119
3bd69ad1 Andreas Eversberg 2008-09-06 120 void
3bd69ad1 Andreas Eversberg 2008-09-06 121 mISDN_unregister_clock(struct mISDNclock *iclock)
3bd69ad1 Andreas Eversberg 2008-09-06 122 {
3bd69ad1 Andreas Eversberg 2008-09-06 123 u_long flags;
3bd69ad1 Andreas Eversberg 2008-09-06 124
3bd69ad1 Andreas Eversberg 2008-09-06 125 if (*debug & (DEBUG_CORE | DEBUG_CLOCK))
3bd69ad1 Andreas Eversberg 2008-09-06 126 printk(KERN_DEBUG "%s: %s %d\n", __func__, iclock->name,
3bd69ad1 Andreas Eversberg 2008-09-06 127 iclock->pri);
3bd69ad1 Andreas Eversberg 2008-09-06 128 write_lock_irqsave(&iclock_lock, flags);
3bd69ad1 Andreas Eversberg 2008-09-06 129 if (iclock_current == iclock) {
3bd69ad1 Andreas Eversberg 2008-09-06 130 if (*debug & DEBUG_CLOCK)
3bd69ad1 Andreas Eversberg 2008-09-06 131 printk(KERN_DEBUG
3bd69ad1 Andreas Eversberg 2008-09-06 132 "Current clock source '%s' unregisters.\n",
3bd69ad1 Andreas Eversberg 2008-09-06 133 iclock->name);
3bd69ad1 Andreas Eversberg 2008-09-06 134 iclock->ctl(iclock->priv, 0);
3bd69ad1 Andreas Eversberg 2008-09-06 135 }
3bd69ad1 Andreas Eversberg 2008-09-06 136 list_del(&iclock->list);
3bd69ad1 Andreas Eversberg 2008-09-06 137 select_iclock();
3bd69ad1 Andreas Eversberg 2008-09-06 138 write_unlock_irqrestore(&iclock_lock, flags);
3bd69ad1 Andreas Eversberg 2008-09-06 139 }
3bd69ad1 Andreas Eversberg 2008-09-06 140 EXPORT_SYMBOL(mISDN_unregister_clock);
3bd69ad1 Andreas Eversberg 2008-09-06 141
3bd69ad1 Andreas Eversberg 2008-09-06 142 void
3bd69ad1 Andreas Eversberg 2008-09-06 @143 mISDN_clock_update(struct mISDNclock *iclock, int samples, struct timeval *tv)
3bd69ad1 Andreas Eversberg 2008-09-06 144 {
3bd69ad1 Andreas Eversberg 2008-09-06 145 u_long flags;
d207c231 Tina Ruchandani 2015-10-29 146 ktime_t tv_now;
d207c231 Tina Ruchandani 2015-10-29 147 u16 delta;
3bd69ad1 Andreas Eversberg 2008-09-06 148
3bd69ad1 Andreas Eversberg 2008-09-06 149 write_lock_irqsave(&iclock_lock, flags);
3bd69ad1 Andreas Eversberg 2008-09-06 150 if (iclock_current != iclock) {
3bd69ad1 Andreas Eversberg 2008-09-06 151 printk(KERN_ERR "%s: '%s' sends us clock updates, but we do "
3bd69ad1 Andreas Eversberg 2008-09-06 152 "listen to '%s'. This is a bug!\n", __func__,
3bd69ad1 Andreas Eversberg 2008-09-06 153 iclock->name,
3bd69ad1 Andreas Eversberg 2008-09-06 154 iclock_current ? iclock_current->name : "nothing");
3bd69ad1 Andreas Eversberg 2008-09-06 155 iclock->ctl(iclock->priv, 0);
3bd69ad1 Andreas Eversberg 2008-09-06 156 write_unlock_irqrestore(&iclock_lock, flags);
3bd69ad1 Andreas Eversberg 2008-09-06 157 return;
3bd69ad1 Andreas Eversberg 2008-09-06 158 }
3bd69ad1 Andreas Eversberg 2008-09-06 159 if (iclock_tv_valid) {
3bd69ad1 Andreas Eversberg 2008-09-06 160 /* increment sample counter by given samples */
3bd69ad1 Andreas Eversberg 2008-09-06 161 iclock_count += samples;
3bd69ad1 Andreas Eversberg 2008-09-06 162 if (tv) { /* tv must be set, if function call is delayed */
d207c231 Tina Ruchandani 2015-10-29 @163 iclock_tv = *tv;
3bd69ad1 Andreas Eversberg 2008-09-06 164 } else
d207c231 Tina Ruchandani 2015-10-29 165 iclock_tv = ktime_get();
3bd69ad1 Andreas Eversberg 2008-09-06 166 } else {
3bd69ad1 Andreas Eversberg 2008-09-06 167 /* calc elapsed time by system clock */
3bd69ad1 Andreas Eversberg 2008-09-06 168 if (tv) { /* tv must be set, if function call is delayed */
d207c231 Tina Ruchandani 2015-10-29 169 tv_now = *tv;
3bd69ad1 Andreas Eversberg 2008-09-06 170 } else
d207c231 Tina Ruchandani 2015-10-29 171 tv_now = ktime_get();
d207c231 Tina Ruchandani 2015-10-29 172 delta = ktime_divns(ktime_sub(tv_now, iclock_tv),
d207c231 Tina Ruchandani 2015-10-29 173 (NSEC_PER_SEC / 8000));
3bd69ad1 Andreas Eversberg 2008-09-06 174 /* add elapsed time to counter and set new timestamp */
d207c231 Tina Ruchandani 2015-10-29 @175 iclock_tv += delta;
d207c231 Tina Ruchandani 2015-10-29 176 iclock_tv = tv_now;
3bd69ad1 Andreas Eversberg 2008-09-06 177 iclock_tv_valid = 1;
3bd69ad1 Andreas Eversberg 2008-09-06 178 if (*debug & DEBUG_CLOCK)
3bd69ad1 Andreas Eversberg 2008-09-06 179 printk("Received first clock from source '%s'.\n",
3bd69ad1 Andreas Eversberg 2008-09-06 180 iclock_current ? iclock_current->name : "nothing");
3bd69ad1 Andreas Eversberg 2008-09-06 181 }
3bd69ad1 Andreas Eversberg 2008-09-06 182 write_unlock_irqrestore(&iclock_lock, flags);
3bd69ad1 Andreas Eversberg 2008-09-06 183 }
3bd69ad1 Andreas Eversberg 2008-09-06 @184 EXPORT_SYMBOL(mISDN_clock_update);
3bd69ad1 Andreas Eversberg 2008-09-06 185
3bd69ad1 Andreas Eversberg 2008-09-06 186 unsigned short
3bd69ad1 Andreas Eversberg 2008-09-06 187 mISDN_clock_get(void)
:::::: The code at line 143 was first introduced by commit
:::::: 3bd69ad197a4a3d0085a5dc3b5796111bf176b12 mISDN: Add ISDN sample clock API to mISDN core
:::::: TO: Andreas Eversberg <andreas@xxxxxxxxxxxx>
:::::: CC: Karsten Keil <kkeil@xxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data