linux - How can my kernel module access a PCI device without using pci_get_device()? -


at present, have linux 2.6 kernel module accesses device via pci_get_device() , pci_read_config_dword(). in future, module shall modified also work different machine seems have no pci bus (/sys/bus/pci doesn't exist), has device @ fixed, known address. now, have one module binary without parameters works on both machines. able load module on non-pci machine, think must refrain using pci_get_device() etc.; have needed config space info on pci machine in other way. read /sys/bus/pci/devices/.../resource in init_module(), gather considered bad practice make kernel modules read files. there better ways achieve goal?

when functions pci_get_device() cannot used (because module must work kernels don't provide such functions), apparently there no better way pci address info reading /sys/bus/pci/devices/.../resource. resorted doing so, using filp_open(), vfs_read() , filp_close() on basis of how read/write files within linux kernel module?.


Comments