Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:bsg_register_queue

Proto:int bsg_register_queue(struct request_queue *q, struct device *parent, const char *name, const struct bsg_ops *ops)

Type:int

Parameter:

TypeParameterName
struct request_queue *q
struct device *parent
const char *name
const struct bsg_ops *ops
412  struct device * class_dev = NULL
417  If Not queue_is_mq(q) Then Return 0
420  bcd = bsg_dev
421  memset(bcd, 0, size of bcd )
423  mutex_lock( & bsg_mutex)
425  ret = dr_alloc() - Allocate an ID.*@idr: IDR handle.*@ptr: Pointer to be associated with the new ID.*@start: The minimum ID (inclusive).*@end: The maximum ID (exclusive).*@gfp: Memory allocation flags.
426  If ret < 0 Then
427  If ret == -ENOSPC Then
429  ret = -EINVAL
431  Go to unlock
434  minor = ret
435  queue = q
436  ops = ops
437  dev = MKDEV(bsg_major, minor)
438  class_dev = device_create(bsg_class, parent, dev, NULL, "%s", name)
439  If IS_ERR(class_dev) Then
440  ret = PTR_ERR(class_dev)
441  Go to idr_remove
443  class_dev = class_dev
445  If sysfs directory entry Then
446  ret = sysfs_create_link( & * queue kobject, & kobj, "bsg")
447  If ret Then Go to unregister_class_dev
451  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
452  Return 0
454  unregister_class_dev :
455  device_unregister(class_dev)
456  idr_remove :
457  dr_remove() - Remove an ID from the IDR
458  unlock :
459  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
460  Return ret
Caller
NameDescribe
bsg_scsi_register_queue
bsg_setup_queuesg_setup_queue - Create and add the bsg hooks so we can receive requests*@dev: device to attach bsg device to*@name: device to give bsg device*@job_fn: bsg job handler*@timeout: timeout handler function pointer*@dd_job_size: size of LLD data needed for