Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43ac9e62 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley
Browse files

[SCSI] bsg: use better helper list functions



This replace hlist_for_each and list_entry with hlist_for_each_entry
and list_first_entry respectively.

Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent c3ff1b90
Loading
Loading
Loading
Loading
+6 −8
Original line number Original line Diff line number Diff line
@@ -368,7 +368,7 @@ static struct bsg_command *bsg_next_done_cmd(struct bsg_device *bd)


	spin_lock_irq(&bd->lock);
	spin_lock_irq(&bd->lock);
	if (bd->done_cmds) {
	if (bd->done_cmds) {
		bc = list_entry(bd->done_list.next, struct bsg_command, list);
		bc = list_first_entry(&bd->done_list, struct bsg_command, list);
		list_del(&bc->list);
		list_del(&bc->list);
		bd->done_cmds--;
		bd->done_cmds--;
	}
	}
@@ -772,21 +772,19 @@ static struct bsg_device *bsg_add_device(struct inode *inode,


static struct bsg_device *__bsg_get_device(int minor)
static struct bsg_device *__bsg_get_device(int minor)
{
{
	struct bsg_device *bd = NULL;
	struct bsg_device *bd;
	struct hlist_node *entry;
	struct hlist_node *entry;


	mutex_lock(&bsg_mutex);
	mutex_lock(&bsg_mutex);


	hlist_for_each(entry, bsg_dev_idx_hash(minor)) {
	hlist_for_each_entry(bd, entry, bsg_dev_idx_hash(minor), dev_list) {
		bd = hlist_entry(entry, struct bsg_device, dev_list);
		if (bd->minor == minor) {
		if (bd->minor == minor) {
			atomic_inc(&bd->ref_count);
			atomic_inc(&bd->ref_count);
			break;
			goto found;
		}
		}

		bd = NULL;
	}
	}

	bd = NULL;
found:
	mutex_unlock(&bsg_mutex);
	mutex_unlock(&bsg_mutex);
	return bd;
	return bd;
}
}