这个方法是摸索出来的,也不一定对:
1、驱动层module_init(module_init_function)作为模块初始化,并且提供模块内部初始化的函数名;
2、找到所有驱动目录drivers下所有module_init(module_init_function),在内核6.9.0版本实际上找到1979个:module_init_all_in_drivers_path.txt · r77683962/linux-6.9.0 - Gitee.comhttps://gitee.com/r77683962/linux-6.9.0/blob/master/module_init_all_in_drivers_path.txt
命令行:
find drivers -name "*.c" | xargs -i grep -Hrn "^module_init(" {} > module_inits.txt
3、从找到的模块函数中添加打印信息;
4、重新编译代码,重启系统,然后可以看到操作系统在驱动初始化时对哪些模块进行了初始化:
这是完整启动dmesg完整日志:
test_log/dmesg_modules_init.txt · r77683962/linux-6.9.0-testlog - Gitee.comhttps://gitee.com/r77683962/linux-6.9.0-testlog/blob/c31fe277671c2270aa3b77d07b1727f593850ab7/test_log/dmesg_modules_init.txt内核最上层看到的是系统调用入口,最底层是驱动。
另一种方法是直接在driver_register函数添加打印信息:
root@A:/var/log# grep -r "driver_register" dmesg
[ 0.263535] kernel: [drivers/base/driver.c driver_register 227] drv->name: gpio_stub_drv, drv->mod_name: (null), drv->bus->name: gpio, drv->bus->dev_name: (null)
[ 0.263535] kernel: [drivers/base/driver.c driver_register 227] drv->name: reg-dummy, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.265980] kernel: [drivers/base/driver.c driver_register 227] drv->name: sram, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.265999] kernel: [drivers/base/driver.c driver_register 227] drv->name: syscon, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.266073] kernel: [drivers/base/driver.c driver_register 227] drv->name: dummy, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 0.267134] kernel: [drivers/base/driver.c driver_register 227] drv->name: ctrl, drv->mod_name: (null), drv->bus->name: serial-base, drv->bus->dev_name: (null)
[ 0.267147] kernel: [drivers/base/driver.c driver_register 227] drv->name: port, drv->mod_name: (null), drv->bus->name: serial-base, drv->bus->dev_name: (null)
[ 0.271741] kernel: [drivers/base/driver.c driver_register 227] drv->name: sx150x-pinctrl, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 0.271763] kernel: [drivers/base/driver.c driver_register 227] drv->name: byt_gpio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.271778] kernel: [drivers/base/driver.c driver_register 227] drv->name: cherryview-pinctrl, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.271800] kernel: [drivers/base/driver.c driver_register 227] drv->name: palmas-gpio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.271816] kernel: [drivers/base/driver.c driver_register 227] drv->name: rc5t583-gpio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.271837] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps6586x-gpio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.271852] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps65910-gpio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 0.398535] kernel: [drivers/base/driver.c driver_register 227] drv->name: clk-lpss-atom, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.042535] kernel: [drivers/base/driver.c driver_register 227] drv->name: ec, drv->mod_name: (null), drv->bus->name: acpi, drv->bus->dev_name: (null)
[ 1.043653] kernel: [drivers/base/driver.c driver_register 227] drv->name: 88PM860x, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043705] kernel: [drivers/base/driver.c driver_register 227] drv->name: WM8400, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043719] kernel: [drivers/base/driver.c driver_register 227] drv->name: wm831x, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043731] kernel: [drivers/base/driver.c driver_register 227] drv->name: wm831x, drv->mod_name: (null), drv->bus->name: spi, drv->bus->dev_name: (null)
[ 1.043743] kernel: [drivers/base/driver.c driver_register 227] drv->name: wm8350, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043755] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps65910, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043768] kernel: [drivers/base/driver.c driver_register 227] drv->name: ezx-pcap, drv->mod_name: (null), drv->bus->name: spi, drv->bus->dev_name: (null)
[ 1.043781] kernel: [drivers/base/driver.c driver_register 227] drv->name: da903x, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043794] kernel: [drivers/base/driver.c driver_register 227] drv->name: da9052, drv->mod_name: (null), drv->bus->name: spi, drv->bus->dev_name: (null)
[ 1.043807] kernel: [drivers/base/driver.c driver_register 227] drv->name: da9052, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043825] kernel: [drivers/base/driver.c driver_register 227] drv->name: lp8788, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043838] kernel: [drivers/base/driver.c driver_register 227] drv->name: da9055-pmic, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043852] kernel: [drivers/base/driver.c driver_register 227] drv->name: max77843, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043864] kernel: [drivers/base/driver.c driver_register 227] drv->name: max8925, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043877] kernel: [drivers/base/driver.c driver_register 227] drv->name: max8997, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043888] kernel: [drivers/base/driver.c driver_register 227] drv->name: max8998, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043900] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps6586x, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043913] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps65090, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043925] kernel: [drivers/base/driver.c driver_register 227] drv->name: aat2870, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043937] kernel: [drivers/base/driver.c driver_register 227] drv->name: palmas, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043955] kernel: [drivers/base/driver.c driver_register 227] drv->name: rc5t583, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.043973] kernel: [drivers/base/driver.c driver_register 227] drv->name: as3711, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.044060] kernel: [drivers/base/driver.c driver_register 227] drv->name: nd_bus, drv->mod_name: libnvdimm, drv->bus->name: nd, drv->bus->dev_name: (null)
[ 1.044072] kernel: [drivers/base/driver.c driver_register 227] drv->name: nvdimm, drv->mod_name: libnvdimm, drv->bus->name: nd, drv->bus->dev_name: (null)
[ 1.044085] kernel: [drivers/base/driver.c driver_register 227] drv->name: nd_region, drv->mod_name: libnvdimm, drv->bus->name: nd, drv->bus->dev_name: (null)
[ 1.044535] kernel: [drivers/base/driver.c driver_register 227] drv->name: Generic Clause 45 PHY, drv->mod_name: (null), drv->bus->name: mdio_bus, drv->bus->dev_name: (null)
[ 1.044535] kernel: [drivers/base/driver.c driver_register 227] drv->name: Generic PHY, drv->mod_name: (null), drv->bus->name: mdio_bus, drv->bus->dev_name: (null)
[ 1.044535] kernel: [drivers/base/driver.c driver_register 227] drv->name: usbfs, drv->mod_name: usbcore, drv->bus->name: usb, drv->bus->dev_name: (null)
[ 1.044535] kernel: [drivers/base/driver.c driver_register 227] drv->name: hub, drv->mod_name: usbcore, drv->bus->name: usb, drv->bus->dev_name: (null)
[ 1.044535] kernel: [drivers/base/driver.c driver_register 227] drv->name: usb, drv->mod_name: (null), drv->bus->name: usb, drv->bus->dev_name: (null)
[ 1.044535] kernel: [drivers/base/driver.c driver_register 227] drv->name: i2c_designware, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.066535] kernel: [drivers/base/driver.c driver_register 227] drv->name: system, drv->mod_name: (null), drv->bus->name: pnp, drv->bus->dev_name: (null)
[ 1.195016] kernel: [drivers/base/driver.c driver_register 227] drv->name: iosf_mbi_pci, drv->mod_name: iosf_mbi, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.195303] kernel: [drivers/base/driver.c driver_register 227] drv->name: alarmtimer, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.221663] kernel: [drivers/base/driver.c driver_register 227] drv->name: amd_gpio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.221689] kernel: [drivers/base/driver.c driver_register 227] drv->name: basic-mmio-gpio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.221713] kernel: [drivers/base/driver.c driver_register 227] drv->name: crystal_cove_gpio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.221729] kernel: [drivers/base/driver.c driver_register 227] drv->name: crystal_cove_pwm, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.221743] kernel: [drivers/base/driver.c driver_register 227] drv->name: pwm-lpss, drv->mod_name: pwm_lpss_pci, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.221773] kernel: [drivers/base/driver.c driver_register 227] drv->name: pwm-lpss, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.221788] kernel: [drivers/base/driver.c driver_register 227] drv->name: aer, drv->mod_name: (null), drv->bus->name: pci_express, drv->bus->dev_name: (null)
[ 1.221802] kernel: [drivers/base/driver.c driver_register 227] drv->name: pcie_pme, drv->mod_name: (null), drv->bus->name: pci_express, drv->bus->dev_name: (null)
[ 1.221814] kernel: [drivers/base/driver.c driver_register 227] drv->name: dpc, drv->mod_name: (null), drv->bus->name: pci_express, drv->bus->dev_name: (null)
[ 1.221832] kernel: [drivers/base/driver.c driver_register 227] drv->name: pciehp, drv->mod_name: (null), drv->bus->name: pci_express, drv->bus->dev_name: (null)
[ 1.221846] kernel: [drivers/base/driver.c driver_register 227] drv->name: pcieport, drv->mod_name: pcieportdrv, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.271047] kernel: [drivers/base/driver.c driver_register 227] drv->name: shpchp, drv->mod_name: shpchp, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.271258] kernel: [drivers/base/driver.c driver_register 227] drv->name: dw-pcie, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.271280] kernel: [drivers/base/driver.c driver_register 227] drv->name: imsttfb, drv->mod_name: imsttfb, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.271306] kernel: [drivers/base/driver.c driver_register 227] drv->name: asiliantfb, drv->mod_name: asiliantfb, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.271329] kernel: [drivers/base/driver.c driver_register 227] drv->name: acpi-ged, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.271408] kernel: [drivers/base/driver.c driver_register 227] drv->name: ac, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.272230] kernel: [drivers/base/driver.c driver_register 227] drv->name: button, drv->mod_name: (null), drv->bus->name: acpi, drv->bus->dev_name: (null)
[ 1.272677] kernel: [drivers/base/driver.c driver_register 227] drv->name: acpi-fan, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.272697] kernel: [drivers/base/driver.c driver_register 227] drv->name: processor, drv->mod_name: (null), drv->bus->name: cpu, drv->bus->dev_name: cpu
[ 1.274281] kernel: [drivers/base/driver.c driver_register 227] drv->name: thermal, drv->mod_name: (null), drv->bus->name: acpi, drv->bus->dev_name: (null)
[ 1.274454] kernel: [drivers/base/driver.c driver_register 227] drv->name: hardware_error_device, drv->mod_name: (null), drv->bus->name: acpi, drv->bus->dev_name: (null)
[ 1.274611] kernel: [drivers/base/driver.c driver_register 227] drv->name: byt_crystal_cove_pmic, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274628] kernel: [drivers/base/driver.c driver_register 227] drv->name: cht_crystal_cove_pmic, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274644] kernel: [drivers/base/driver.c driver_register 227] drv->name: axp288_pmic_acpi, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274673] kernel: [drivers/base/driver.c driver_register 227] drv->name: bxt_whiskey_cove_pmic, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274688] kernel: [drivers/base/driver.c driver_register 227] drv->name: cht_whiskey_cove_pmic, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274702] kernel: [drivers/base/driver.c driver_register 227] drv->name: cht_dollar_cove_ti_pmic, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274717] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps68470_pmic_opregion, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274740] kernel: [drivers/base/driver.c driver_register 227] drv->name: gpio-clk, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274759] kernel: [drivers/base/driver.c driver_register 227] drv->name: clk-fch, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274772] kernel: [drivers/base/driver.c driver_register 227] drv->name: clk-pmc-atom, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274787] kernel: [drivers/base/driver.c driver_register 227] drv->name: lgm-dma, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274805] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio-mmio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.274813] kernel: [drivers/base/driver.c driver_register 227] drv->name: battery, drv->mod_name: (null), drv->bus->name: acpi, drv->bus->dev_name: (null)
[ 1.274820] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio-pci, drv->mod_name: virtio_pci, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.274845] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio_balloon, drv->mod_name: (null), drv->bus->name: virtio, drv->bus->dev_name: (null)
[ 1.274861] kernel: [drivers/base/driver.c driver_register 227] drv->name: xen-platform-pci, drv->mod_name: platform_pci, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.274889] kernel: [drivers/base/driver.c driver_register 227] drv->name: simple-reset, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.275074] kernel: [drivers/base/driver.c driver_register 227] drv->name: serial, drv->mod_name: (null), drv->bus->name: pnp, drv->bus->dev_name: (null)
[ 1.282191] kernel: [drivers/base/driver.c driver_register 227] drv->name: serial8250, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.282230] kernel: [drivers/base/driver.c driver_register 227] drv->name: 8250_mid, drv->mod_name: 8250_mid, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.282259] kernel: [drivers/base/driver.c driver_register 227] drv->name: serial, drv->mod_name: 8250_pci, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.282463] kernel: [drivers/base/driver.c driver_register 227] drv->name: max310x, drv->mod_name: (null), drv->bus->name: spi, drv->bus->dev_name: (null)
[ 1.282483] kernel: [drivers/base/driver.c driver_register 227] drv->name: max310x, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.282500] kernel: [drivers/base/driver.c driver_register 227] drv->name: uart-sccnxp, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.282520] kernel: [drivers/base/driver.c driver_register 227] drv->name: kgdboc, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.282740] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio_console, drv->mod_name: (null), drv->bus->name: virtio, drv->bus->dev_name: (null)
[ 1.282761] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio_rproc_serial, drv->mod_name: (null), drv->bus->name: virtio, drv->bus->dev_name: (null)
[ 1.282878] kernel: [drivers/base/driver.c driver_register 227] drv->name: hpet, drv->mod_name: (null), drv->bus->name: acpi, drv->bus->dev_name: (null)
[ 1.283579] kernel: [drivers/base/driver.c driver_register 227] drv->name: agpgart-amd64, drv->mod_name: amd64_agp, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.283620] kernel: [drivers/base/driver.c driver_register 227] drv->name: agpgart-intel, drv->mod_name: intel_agp, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.285805] kernel: [drivers/base/driver.c driver_register 227] drv->name: agpgart-via, drv->mod_name: via_agp, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.285848] kernel: [drivers/base/driver.c driver_register 227] drv->name: tpm_tis, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.285868] kernel: [drivers/base/driver.c driver_register 227] drv->name: tpm_tis, drv->mod_name: (null), drv->bus->name: pnp, drv->bus->dev_name: (null)
[ 1.285888] kernel: [drivers/base/driver.c driver_register 227] drv->name: tpm_crb, drv->mod_name: (null), drv->bus->name: acpi, drv->bus->dev_name: (null)
[ 1.286054] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio_iommu, drv->mod_name: (null), drv->bus->name: virtio, drv->bus->dev_name: (null)
[ 1.292071] kernel: [drivers/base/driver.c driver_register 227] drv->name: simple-framebuffer, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.312198] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio_blk, drv->mod_name: (null), drv->bus->name: virtio, drv->bus->dev_name: (null)
[ 1.312223] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps65912, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312241] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps65912, drv->mod_name: (null), drv->bus->name: spi, drv->bus->dev_name: (null)
[ 1.312255] kernel: [drivers/base/driver.c driver_register 227] drv->name: twl, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312269] kernel: [drivers/base/driver.c driver_register 227] drv->name: twl4030-audio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.312295] kernel: [drivers/base/driver.c driver_register 227] drv->name: twl6040, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312333] kernel: [drivers/base/driver.c driver_register 227] drv->name: da9063, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312351] kernel: [drivers/base/driver.c driver_register 227] drv->name: max14577, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312365] kernel: [drivers/base/driver.c driver_register 227] drv->name: max77693, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312378] kernel: [drivers/base/driver.c driver_register 227] drv->name: adp5520, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312390] kernel: [drivers/base/driver.c driver_register 227] drv->name: crystal_cove_i2c, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312405] kernel: [drivers/base/driver.c driver_register 227] drv->name: CHT Whiskey Cove PMIC, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.312425] kernel: [drivers/base/driver.c driver_register 227] drv->name: e820_pmem, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.312740] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio_scsi, drv->mod_name: (null), drv->bus->name: virtio, drv->bus->dev_name: (null)
[ 1.312774] kernel: [drivers/base/driver.c driver_register 227] drv->name: sd, drv->mod_name: (null), drv->bus->name: scsi, drv->bus->dev_name: (null)
[ 1.312793] kernel: [drivers/base/driver.c driver_register 227] drv->name: sr, drv->mod_name: (null), drv->bus->name: scsi, drv->bus->dev_name: (null)
[ 1.312826] kernel: [drivers/base/driver.c driver_register 227] drv->name: ata_piix, drv->mod_name: ata_piix, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.314909] kernel: [drivers/base/driver.c driver_register 227] drv->name: pata_sis, drv->mod_name: pata_sis, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.314933] kernel: [drivers/base/driver.c driver_register 227] drv->name: ata_generic, drv->mod_name: ata_generic, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.314988] kernel: [drivers/base/driver.c driver_register 227] drv->name: Broadcom BCM84881, drv->mod_name: (null), drv->bus->name: mdio_bus, drv->bus->dev_name: (null)
[ 1.315394] kernel: [drivers/base/driver.c driver_register 227] drv->name: virtio_net, drv->mod_name: (null), drv->bus->name: virtio, drv->bus->dev_name: (null)
[ 1.315542] kernel: [drivers/base/driver.c driver_register 227] drv->name: dwc2, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.315578] kernel: [drivers/base/driver.c driver_register 227] drv->name: ehci-pci, drv->mod_name: ehci_pci, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.315626] kernel: [drivers/base/driver.c driver_register 227] drv->name: ehci-platform, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.315654] kernel: [drivers/base/driver.c driver_register 227] drv->name: ohci-pci, drv->mod_name: ohci_pci, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.315678] kernel: [drivers/base/driver.c driver_register 227] drv->name: ohci-platform, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.315725] kernel: [drivers/base/driver.c driver_register 227] drv->name: uhci_hcd, drv->mod_name: uhci_hcd, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.318587] kernel: [drivers/base/driver.c driver_register 227] drv->name: i8042 kbd, drv->mod_name: (null), drv->bus->name: pnp, drv->bus->dev_name: (null)
[ 1.318625] kernel: [drivers/base/driver.c driver_register 227] drv->name: i8042 aux, drv->mod_name: (null), drv->bus->name: pnp, drv->bus->dev_name: (null)
[ 1.318675] kernel: [drivers/base/driver.c driver_register 227] drv->name: i8042, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.320295] kernel: [drivers/base/driver.c driver_register 227] drv->name: atkbd, drv->mod_name: atkbd, drv->bus->name: serio, drv->bus->dev_name: (null)
[ 1.320325] kernel: [drivers/base/driver.c driver_register 227] drv->name: elants_i2c, drv->mod_name: (null), drv->bus->name: i2c, drv->bus->dev_name: (null)
[ 1.320540] kernel: [drivers/base/driver.c driver_register 227] drv->name: rtc_cmos, drv->mod_name: (null), drv->bus->name: pnp, drv->bus->dev_name: (null)
[ 1.321910] kernel: [drivers/base/driver.c driver_register 227] drv->name: mt6323-pwrc, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.321929] kernel: [drivers/base/driver.c driver_register 227] drv->name: poweroff-restart, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.321946] kernel: [drivers/base/driver.c driver_register 227] drv->name: tps65086-restart, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 1.323043] kernel: [drivers/base/driver.c driver_register 227] drv->name: intel_scu, drv->mod_name: intel_scu_pcidrv, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 1.323089] kernel: [drivers/base/driver.c driver_register 227] drv->name: rproc-virtio, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 2.068687] kernel: [drivers/base/driver.c driver_register 227] drv->name: charger-manager, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 2.068732] kernel: [drivers/base/driver.c driver_register 227] drv->name: acpi-cpufreq, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 2.068761] kernel: [drivers/base/driver.c driver_register 227] drv->name: pcc-cpufreq, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 3.095184] kernel: [drivers/base/driver.c driver_register 227] drv->name: floppy, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 3.244886] kernel: [drivers/base/driver.c driver_register 227] drv->name: pata_acpi, drv->mod_name: pata_acpi, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 3.268718] kernel: [drivers/base/driver.c driver_register 227] drv->name: ahci, drv->mod_name: ahci, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 3.328734] kernel: [drivers/base/driver.c driver_register 227] drv->name: e1000, drv->mod_name: e1000, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 3.338325] kernel: [drivers/base/driver.c driver_register 227] drv->name: usbhid, drv->mod_name: usbhid, drv->bus->name: usb, drv->bus->dev_name: (null)
[ 3.339205] kernel: [drivers/base/driver.c driver_register 227] drv->name: psmouse, drv->mod_name: psmouse, drv->bus->name: serio, drv->bus->dev_name: (null)
[ 3.373274] kernel: [drivers/base/driver.c driver_register 227] drv->name: mptspi, drv->mod_name: mptspi, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 3.383359] kernel: [drivers/base/driver.c driver_register 227] drv->name: hid-generic, drv->mod_name: hid_generic, drv->bus->name: hid, drv->bus->dev_name: (null)
[ 5.944697] kernel: [drivers/base/driver.c driver_register 227] drv->name: lp, drv->mod_name: lp, drv->bus->name: parport, drv->bus->dev_name: (null)
[ 5.963017] kernel: [drivers/base/driver.c driver_register 227] drv->name: ppdev, drv->mod_name: ppdev, drv->bus->name: parport, drv->bus->dev_name: (null)
[ 5.985266] kernel: [drivers/base/driver.c driver_register 227] drv->name: parport_pc, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
[ 5.985385] kernel: [drivers/base/driver.c driver_register 227] drv->name: parport_pc, drv->mod_name: (null), drv->bus->name: pnp, drv->bus->dev_name: (null)
[ 5.989126] kernel: [drivers/base/driver.c driver_register 227] drv->name: parport_pc, drv->mod_name: parport_pc, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 6.244285] kernel: [drivers/base/driver.c driver_register 227] drv->name: vmwgfx, drv->mod_name: vmwgfx, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 6.848340] kernel: [drivers/base/driver.c driver_register 227] drv->name: vmw_vmci, drv->mod_name: vmw_vmci, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 7.529969] kernel: [drivers/base/driver.c driver_register 227] drv->name: serio_raw, drv->mod_name: serio_raw, drv->bus->name: serio, drv->bus->dev_name: (null)
[ 9.356557] kernel: [drivers/base/driver.c driver_register 227] drv->name: piix4_smbus, drv->mod_name: i2c_piix4, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 10.185300] kernel: [drivers/base/driver.c driver_register 227] drv->name: snd_seq_midi, drv->mod_name: (null), drv->bus->name: snd_seq, drv->bus->dev_name: (null)
[ 10.472591] kernel: [drivers/base/driver.c driver_register 227] drv->name: snd_ens1371, drv->mod_name: snd_ens1371, drv->bus->name: pci, drv->bus->dev_name: (null)
[ 10.547640] kernel: [drivers/base/driver.c driver_register 227] drv->name: intel_rapl_msr, drv->mod_name: (null), drv->bus->name: platform, drv->bus->dev_name: (null)
从打印的结果来看,一共169个驱动模块进行了注册,这种不太容易看到驱动所在的代码目录,第一种可以看到代码目录,各有优劣吧。
方法也是摸索出来的,不一定对。