函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\bsg.c Create Date:2022-07-27 19:13:31
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:bsg_init

函数原型:static int __init bsg_init(void)

返回类型:int

参数:

486 i小于BSG_LIST_ARRAY_SIZE循环INIT_HLIST_HEAD( & bsg_device_list[i])
489  bsg_class等于This is a #define to keep the compiler from merging different* instances of the __key variable (THIS_MODULE, "bsg")
490  如果是错误则返回:错误
492  devnode等于bsg_devnode
494  ret等于alloc_chrdev_region( & devid, 0, BSG_MAX_DEVS, "bsg")
495  如果ret则转到:destroy_bsg_class
498  bsg_major等于MAJOR(devid)
500  cdev_init( & bsg_cdev, & bsg_fops)
501  ret等于cdev_add( & bsg_cdev, MKDEV(bsg_major, 0), BSG_MAX_DEVS)
502  如果ret则转到:unregister_chrdev
505  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
507  返回:0
508  unregister_chrdev :
509  unregister_chrdev_region(MKDEV(bsg_major, 0), BSG_MAX_DEVS)
510  destroy_bsg_class :
511  class_destroy(bsg_class)
512  返回:ret