aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-03-30 21:03:41 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-18 12:48:26 -0400
commit842ea771c38a3f0f78bdb1b4d47881e6a210fc15 (patch)
tree9cf19d7f833922ddada7cf3ccbeec617ac77eda1 /block
parent43ac9e62c4a0a47fe3de1f1eb9ca7b8c91dce234 (diff)
[SCSI] bsg: remove minor in struct bsg_device
minor in struct bsg_device is used as identifier to find the corresponding struct bsg_device_class. However, request_queuse can be used as identifier for that and the minor in struct bsg_device is unnecessary. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'block')
-rw-r--r--block/bsg.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/block/bsg.c b/block/bsg.c
index b413318a7c5d..933998124211 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -37,7 +37,6 @@ struct bsg_device {
37 struct list_head done_list; 37 struct list_head done_list;
38 struct hlist_node dev_list; 38 struct hlist_node dev_list;
39 atomic_t ref_count; 39 atomic_t ref_count;
40 int minor;
41 int queued_cmds; 40 int queued_cmds;
42 int done_cmds; 41 int done_cmds;
43 wait_queue_head_t wq_done; 42 wait_queue_head_t wq_done;
@@ -758,9 +757,8 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
758 bsg_set_block(bd, file); 757 bsg_set_block(bd, file);
759 758
760 atomic_set(&bd->ref_count, 1); 759 atomic_set(&bd->ref_count, 1);
761 bd->minor = iminor(inode);
762 mutex_lock(&bsg_mutex); 760 mutex_lock(&bsg_mutex);
763 hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(bd->minor)); 761 hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode)));
764 762
765 strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1); 763 strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1);
766 dprintk("bound to <%s>, max queue %d\n", 764 dprintk("bound to <%s>, max queue %d\n",
@@ -770,7 +768,7 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
770 return bd; 768 return bd;
771} 769}
772 770
773static struct bsg_device *__bsg_get_device(int minor) 771static struct bsg_device *__bsg_get_device(int minor, struct request_queue *q)
774{ 772{
775 struct bsg_device *bd; 773 struct bsg_device *bd;
776 struct hlist_node *entry; 774 struct hlist_node *entry;
@@ -778,7 +776,7 @@ static struct bsg_device *__bsg_get_device(int minor)
778 mutex_lock(&bsg_mutex); 776 mutex_lock(&bsg_mutex);
779 777
780 hlist_for_each_entry(bd, entry, bsg_dev_idx_hash(minor), dev_list) { 778 hlist_for_each_entry(bd, entry, bsg_dev_idx_hash(minor), dev_list) {
781 if (bd->minor == minor) { 779 if (bd->queue == q) {
782 atomic_inc(&bd->ref_count); 780 atomic_inc(&bd->ref_count);
783 goto found; 781 goto found;
784 } 782 }
@@ -806,7 +804,7 @@ static struct bsg_device *bsg_get_device(struct inode *inode, struct file *file)
806 if (!bcd) 804 if (!bcd)
807 return ERR_PTR(-ENODEV); 805 return ERR_PTR(-ENODEV);
808 806
809 bd = __bsg_get_device(iminor(inode)); 807 bd = __bsg_get_device(iminor(inode), bcd->queue);
810 if (bd) 808 if (bd)
811 return bd; 809 return bd;
812 810