diff options
author | James Bottomley <James.Bottomley@steeleye.com> | 2007-07-19 11:15:10 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-07-19 13:37:34 -0400 |
commit | 80ed71ce1a3369521c693ebf30abb9cfe1dc7e66 (patch) | |
tree | f439b74804b10b04a34fe0c3f4c4597f1f7e890a /block/bsg.c | |
parent | b02b6bc46571b21a545c9e697df1e226ff22bc81 (diff) |
[SCSI] bsg: separate bsg and SCSI (so SCSI can be modular)
This patch moves the bsg registration into SCSI so that bsg no longer
has a dependency on the scsi_interface_register API.
This can be viewed as a temporary expedient until we can get universal
bsg binding sorted out properly. Also use the sdev bus_id as the
generic bsg name (to avoid clashes with the queue name).
Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'block/bsg.c')
-rw-r--r-- | block/bsg.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/block/bsg.c b/block/bsg.c index baa04e7adf19..4e0be1b2e2a0 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -1009,29 +1009,6 @@ err: | |||
1009 | } | 1009 | } |
1010 | EXPORT_SYMBOL_GPL(bsg_register_queue); | 1010 | EXPORT_SYMBOL_GPL(bsg_register_queue); |
1011 | 1011 | ||
1012 | static int bsg_add(struct class_device *cl_dev, struct class_interface *cl_intf) | ||
1013 | { | ||
1014 | int ret; | ||
1015 | struct scsi_device *sdp = to_scsi_device(cl_dev->dev); | ||
1016 | struct request_queue *rq = sdp->request_queue; | ||
1017 | |||
1018 | if (rq->kobj.parent) | ||
1019 | ret = bsg_register_queue(rq, kobject_name(rq->kobj.parent)); | ||
1020 | else | ||
1021 | ret = bsg_register_queue(rq, kobject_name(&sdp->sdev_gendev.kobj)); | ||
1022 | return ret; | ||
1023 | } | ||
1024 | |||
1025 | static void bsg_remove(struct class_device *cl_dev, struct class_interface *cl_intf) | ||
1026 | { | ||
1027 | bsg_unregister_queue(to_scsi_device(cl_dev->dev)->request_queue); | ||
1028 | } | ||
1029 | |||
1030 | static struct class_interface bsg_intf = { | ||
1031 | .add = bsg_add, | ||
1032 | .remove = bsg_remove, | ||
1033 | }; | ||
1034 | |||
1035 | static struct cdev bsg_cdev = { | 1012 | static struct cdev bsg_cdev = { |
1036 | .kobj = {.name = "bsg", }, | 1013 | .kobj = {.name = "bsg", }, |
1037 | .owner = THIS_MODULE, | 1014 | .owner = THIS_MODULE, |
@@ -1069,16 +1046,9 @@ static int __init bsg_init(void) | |||
1069 | if (ret) | 1046 | if (ret) |
1070 | goto unregister_chrdev; | 1047 | goto unregister_chrdev; |
1071 | 1048 | ||
1072 | ret = scsi_register_interface(&bsg_intf); | ||
1073 | if (ret) | ||
1074 | goto remove_cdev; | ||
1075 | |||
1076 | printk(KERN_INFO BSG_DESCRIPTION " version " BSG_VERSION | 1049 | printk(KERN_INFO BSG_DESCRIPTION " version " BSG_VERSION |
1077 | " loaded (major %d)\n", bsg_major); | 1050 | " loaded (major %d)\n", bsg_major); |
1078 | return 0; | 1051 | return 0; |
1079 | remove_cdev: | ||
1080 | printk(KERN_ERR "bsg: failed register scsi interface %d\n", ret); | ||
1081 | cdev_del(&bsg_cdev); | ||
1082 | unregister_chrdev: | 1052 | unregister_chrdev: |
1083 | unregister_chrdev_region(MKDEV(bsg_major, 0), BSG_MAX_DEVS); | 1053 | unregister_chrdev_region(MKDEV(bsg_major, 0), BSG_MAX_DEVS); |
1084 | destroy_bsg_class: | 1054 | destroy_bsg_class: |