Przemyslaw Urbanski (Przemyslaw.Urbanski@xxxxxxxxxxxx) wrote: > Hey, > > I have very simple module like: > > #include <linux/module.h> > #include <linux/kernel.h> > #include <linux/init.h> > #include <linux/fs.h> > #include <linux/devfs_fs_kernel.h> > #include <asm/uaccess.h> > #include <linux/pci.h> > > int ppval_init() > { > struct pci_dev *urbi_dev; > urbi_dev = pci_get_device(0x109e,0x036e,NULL); > return 0; > } > > void ppval_cleanup() > { > } > > module_init(ppval_init); > module_exit(ppval_cleanup); > > It compiles, I can load and unload module. > > If I add > > CFLAGS = -I/lib/modules/$(shell uname -r)/build/include/asm/mach-default > > module will cause seg fault while loading the module. Any idea, why? > > P I think you should read linux/Documentation/pci.txt. I can read : 3. Enabling and disabling devices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Before you do anything with the device you've found, you need to enable it by calling pci_enable_device() which enables I/O and memory regions of the device, allocates an IRQ if necessary, assigns missing resources if needed and wakes up the device if it was in suspended state. Please note that this function can fail. Your segfault would come from this. ~Christophe -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/