Commit 842ea771 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[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: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 43ac9e62
...@@ -37,7 +37,6 @@ struct bsg_device { ...@@ -37,7 +37,6 @@ struct bsg_device {
struct list_head done_list; struct list_head done_list;
struct hlist_node dev_list; struct hlist_node dev_list;
atomic_t ref_count; atomic_t ref_count;
int minor;
int queued_cmds; int queued_cmds;
int done_cmds; int done_cmds;
wait_queue_head_t wq_done; wait_queue_head_t wq_done;
...@@ -758,9 +757,8 @@ static struct bsg_device *bsg_add_device(struct inode *inode, ...@@ -758,9 +757,8 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
bsg_set_block(bd, file); bsg_set_block(bd, file);
atomic_set(&bd->ref_count, 1); atomic_set(&bd->ref_count, 1);
bd->minor = iminor(inode);
mutex_lock(&bsg_mutex); mutex_lock(&bsg_mutex);
hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(bd->minor)); hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode)));
strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1); strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1);
dprintk("bound to <%s>, max queue %d\n", dprintk("bound to <%s>, max queue %d\n",
...@@ -770,7 +768,7 @@ static struct bsg_device *bsg_add_device(struct inode *inode, ...@@ -770,7 +768,7 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
return bd; return bd;
} }
static struct bsg_device *__bsg_get_device(int minor) static struct bsg_device *__bsg_get_device(int minor, struct request_queue *q)
{ {
struct bsg_device *bd; struct bsg_device *bd;
struct hlist_node *entry; struct hlist_node *entry;
...@@ -778,7 +776,7 @@ static struct bsg_device *__bsg_get_device(int minor) ...@@ -778,7 +776,7 @@ static struct bsg_device *__bsg_get_device(int minor)
mutex_lock(&bsg_mutex); mutex_lock(&bsg_mutex);
hlist_for_each_entry(bd, entry, bsg_dev_idx_hash(minor), dev_list) { hlist_for_each_entry(bd, entry, bsg_dev_idx_hash(minor), dev_list) {
if (bd->minor == minor) { if (bd->queue == q) {
atomic_inc(&bd->ref_count); atomic_inc(&bd->ref_count);
goto found; goto found;
} }
...@@ -806,7 +804,7 @@ static struct bsg_device *bsg_get_device(struct inode *inode, struct file *file) ...@@ -806,7 +804,7 @@ static struct bsg_device *bsg_get_device(struct inode *inode, struct file *file)
if (!bcd) if (!bcd)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
bd = __bsg_get_device(iminor(inode)); bd = __bsg_get_device(iminor(inode), bcd->queue);
if (bd) if (bd)
return bd; return bd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment