Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\bsg.c Create Date:2022-07-28 17:37:58
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:bsg_init

Proto:static int __init bsg_init(void)

Type:int

Parameter:Nothing

486  When i < BSG_LIST_ARRAY_SIZE cycle 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  If IS_ERR(bsg_class) Then Return PTR_ERR(bsg_class)
492  devnode = bsg_devnode
494  ret = alloc_chrdev_region( & devid, 0, BSG_MAX_DEVS, "bsg")
495  If ret Then Go to 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  If ret Then Go to 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  Return 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  Return ret