Re: ni_usb: bug when setting kernel timer

Derek Kozel <[email protected]>
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <CAO27avDnLJOL0VumR0nmpNNXK9TgL4Oe+d2vZ0ocL6WD+n=_sg@mail.gmail.com>
Hello,

I've just had a chance to try the newly separated source trees and
encountered an error with the setup_timer compat header. The make log is
attached as linux-gpib-r1752-setup_timer-error.txt.

I'm running Ubuntu 16.04 with kernel 4.14.0-041400-generic. I have SVN rev
1752.

As the error was setup_timer being redefined I changed the kernel version
check to < 4.14 and attempted to recompile. Many drivers succeeded, but
then I encountered an incompatible pointer type error. The log for that is
also attached, I reran make after the first error to abbreviate the output.
My guess is that I'll have to try understanding the code a bit more to fix
this error, but I'm also slightly surprised it hasn't been encountered by
anyone else. Can anyone shed light on it?

Many thanks,
Derek

On Tue, May 8, 2018 at 3:41 PM, Frank Mori Hess <[email protected]> wrote:

> On Mon, May 7, 2018 at 10:46 AM, Stefan Mahr <[email protected]> wrote:
> > Hi,
> >
> > There's a timer initialisation bug in ni_usb driver, especially
> > for NI_USB_B. The timer is setup after first use of mod_timer
> > (ni_usb_b_read_serial_number->usb_send_bulk_msg), so kernel throws a
> > bug in timer.c: BUG_ON(!timer->function);
> >
> > Attached patch should fix this issue.
> >
>
> Thanks, I'm going to try implementing timer_setup using setup_timer in
> a compatibility header later today, to get rid of needing to #ifdef
> every timer setup.  I'll incorporate your change into that.
>
>
> --
> Frank
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-gpib-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
linux-gpib-r1752-setup_timer-error.txt (text/plain, 7.6 KB)
make  all-recursive
make[1]: Entering directory '/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel'
Making all in drivers
make[2]: Entering directory '/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers'
make -C /lib/modules/4.14.0-041400-generic/build/ V=1 modules\
	CC="gcc -I/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel -I/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/compat/include" \
	CONFIG_GPIB_ISA="no" \
	SUBDIRS="/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib"
make[3]: Entering directory '/usr/src/linux-headers-4.14.0-041400-generic'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (		\
echo >&2;							\
echo >&2 "  ERROR: Kernel configuration is invalid.";		\
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";	\
echo >&2 ;							\
/bin/false)
mkdir -p /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/.tmp_versions ; rm -f /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib
make -f ./scripts/Makefile.build obj=/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b
  gcc -I/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel -I/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/compat/include -Wp,-MD,/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/.agilent_82350b_init.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -fno-pie -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -fno-pie -no-pie -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -DCC_HAVE_ASM_GOTO -Wframe-larger-than=1024 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -I/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/include  -DMODULE  -DKBUILD_BASENAME='"agilent_82350b_init"'  -DKBUILD_MODNAME='"agilent_82350b"' -c -o /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/agilent_82350b_init.o /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/agilent_82350b_init.c
In file included from ./include/linux/workqueue.h:9:0,
                 from ./include/linux/srcu.h:34,
                 from ./include/linux/notifier.h:16,
                 from ./include/linux/memory_hotplug.h:7,
                 from ./include/linux/mmzone.h:780,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/idr.h:16,
                 from ./include/linux/kernfs.h:14,
                 from ./include/linux/sysfs.h:16,
                 from ./include/linux/kobject.h:21,
                 from ./include/linux/device.h:17,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/compat/include/linux/device.h:82,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/include/gpib_types.h:29,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/include/gpibP.h:24,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/agilent_82350b.h:21,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/agilent_82350b_init.c:18:
/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/compat/include/linux/timer.h:33:20: error: conflicting types for ‘timer_setup’
 static inline void timer_setup(struct timer_list *timer,
                    ^~~~~~~~~~~
In file included from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/compat/include/linux/timer.h:25:0,
                 from ./include/linux/workqueue.h:9,
                 from ./include/linux/srcu.h:34,
                 from ./include/linux/notifier.h:16,
                 from ./include/linux/memory_hotplug.h:7,
                 from ./include/linux/mmzone.h:780,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/idr.h:16,
                 from ./include/linux/kernfs.h:14,
                 from ./include/linux/sysfs.h:16,
                 from ./include/linux/kobject.h:21,
                 from ./include/linux/device.h:17,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/compat/include/linux/device.h:82,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/include/gpib_types.h:29,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/include/gpibP.h:24,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/agilent_82350b.h:21,
                 from /home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/agilent_82350b_init.c:18:
./include/linux/timer.h:175:20: note: previous definition of ‘timer_setup’ was here
 static inline void timer_setup(struct timer_list *timer,
                    ^~~~~~~~~~~
scripts/Makefile.build:314: recipe for target '/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/agilent_82350b_init.o' failed
make[5]: *** [/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b/agilent_82350b_init.o] Error 1
scripts/Makefile.build:573: recipe for target '/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b' failed
make[4]: *** [/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib/agilent_82350b] Error 2
Makefile:1509: recipe for target '_module_/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib' failed
make[3]: *** [_module_/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers/gpib] Error 2
make[3]: Leaving directory '/usr/src/linux-headers-4.14.0-041400-generic'
Makefile:417: recipe for target 'all-local' failed
make[2]: [all-local] Error 2 (ignored)
make[2]: Leaving directory '/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel/drivers'
make[2]: Entering directory '/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel'
make[2]: Leaving directory '/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel'
make[1]: Leaving directory '/home/dkozel/src/gpib/linux-gpib-code/linux-gpib-kernel'
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.