Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\char_dev.c Create Date:2022-07-28 20:02:46
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:dev_device_add() - add a char device and it's corresponding* struct device, linkink*@dev: the device structure*@cdev: the cdev structure* cdev_device_add() adds the char device represented by @cdev to the system,* just as cdev_add does

Proto:int cdev_device_add(struct cdev *cdev, struct device *dev)

Type:int

Parameter:

TypeParameterName
struct cdev *cdev
struct device *dev
536  rc = 0
538  If dev_t, creates the sysfs "dev" Then
539  dev_set_parent() - set the parent kobject for a char device*@p: the cdev structure*@kobj: the kobject to take a reference to* cdev_set_parent() sets a parent kobject which will be referenced* appropriately so the parent is not freed before the cdev. This
541  rc = dev_add() - add a char device to the system*@p: the cdev structure for the device*@dev: the first device number for which this device is responsible*@count: the number of consecutive minor numbers corresponding to this* device* cdev_add() adds the device
542  If rc Then Return rc
546  rc = device_add(dev)
547  If rc Then dev_del() - remove a cdev from the system*@p: the cdev structure to be removed* cdev_del() removes @p from the system, possibly freeing the structure* itself
550  Return rc