Skip to content

Commit 12bdcbd

Browse files
lgebyungchulparkNicholas Bellinger
authored andcommitted
vhost/scsi: Don't reinvent the wheel but use existing llist API
Although llist provides proper APIs, they are not used. Make them used. Signed-off-by: Byungchul Park <[email protected]> Acked-by: Nicholas Bellinger <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent fb41824 commit 12bdcbd

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/vhost/scsi.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,12 @@ static void vhost_scsi_evt_work(struct vhost_work *work)
496496
struct vhost_scsi *vs = container_of(work, struct vhost_scsi,
497497
vs_event_work);
498498
struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
499-
struct vhost_scsi_evt *evt;
499+
struct vhost_scsi_evt *evt, *t;
500500
struct llist_node *llnode;
501501

502502
mutex_lock(&vq->mutex);
503503
llnode = llist_del_all(&vs->vs_event_list);
504-
while (llnode) {
505-
evt = llist_entry(llnode, struct vhost_scsi_evt, list);
506-
llnode = llist_next(llnode);
504+
llist_for_each_entry_safe(evt, t, llnode, list) {
507505
vhost_scsi_do_evt_work(vs, evt);
508506
vhost_scsi_free_evt(vs, evt);
509507
}
@@ -529,10 +527,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
529527

530528
bitmap_zero(signal, VHOST_SCSI_MAX_VQ);
531529
llnode = llist_del_all(&vs->vs_completion_list);
532-
while (llnode) {
533-
cmd = llist_entry(llnode, struct vhost_scsi_cmd,
534-
tvc_completion_list);
535-
llnode = llist_next(llnode);
530+
llist_for_each_entry(cmd, llnode, tvc_completion_list) {
536531
se_cmd = &cmd->tvc_se_cmd;
537532

538533
pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__,

0 commit comments

Comments
 (0)