Message ID | 3bdae868a5ebd999c5610f5b19e6a085c51db059.1478858760.git.geliangtang@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, 2016-11-11 at 20:26 +0800, Geliang Tang wrote: > Use list_move() instead of list_del() + list_add_tail() to simplify > the code. > > Signed-off-by: Geliang Tang <geliangtang@gmail.com> > --- > drivers/hid/intel-ish-hid/ishtp/client.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/drivers/hid/intel-ish-hid/ishtp/client.c > b/drivers/hid/intel-ish-hid/ishtp/client.c > index aad6132..0979e04 100644 > --- a/drivers/hid/intel-ish-hid/ishtp/client.c > +++ b/drivers/hid/intel-ish-hid/ishtp/client.c > @@ -497,12 +497,8 @@ int ishtp_cl_read_start(struct ishtp_cl *cl) > out: > /* if ishtp_hbm_cl_flow_control_req failed, return rb to > free list */ > if (rets && rb) { > - spin_lock_irqsave(&dev->read_list_spinlock, > dev_flags); > - list_del(&rb->list); > - spin_unlock_irqrestore(&dev->read_list_spinlock, > dev_flags); > - > spin_lock_irqsave(&cl->free_list_spinlock, flags); > - list_add_tail(&rb->list, &cl->free_rb_list.list); > + list_move_tail(&rb->list, &cl->free_rb_list.list); Logically the result is not same. They were protected under two spinlocks, now they are not. Thanks, Srinivas > spin_unlock_irqrestore(&cl->free_list_spinlock, > flags); > } > return rets; -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/hid/intel-ish-hid/ishtp/client.c b/drivers/hid/intel-ish-hid/ishtp/client.c index aad6132..0979e04 100644 --- a/drivers/hid/intel-ish-hid/ishtp/client.c +++ b/drivers/hid/intel-ish-hid/ishtp/client.c @@ -497,12 +497,8 @@ int ishtp_cl_read_start(struct ishtp_cl *cl) out: /* if ishtp_hbm_cl_flow_control_req failed, return rb to free list */ if (rets && rb) { - spin_lock_irqsave(&dev->read_list_spinlock, dev_flags); - list_del(&rb->list); - spin_unlock_irqrestore(&dev->read_list_spinlock, dev_flags); - spin_lock_irqsave(&cl->free_list_spinlock, flags); - list_add_tail(&rb->list, &cl->free_rb_list.list); + list_move_tail(&rb->list, &cl->free_rb_list.list); spin_unlock_irqrestore(&cl->free_list_spinlock, flags); } return rets;
Use list_move() instead of list_del() + list_add_tail() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@gmail.com> --- drivers/hid/intel-ish-hid/ishtp/client.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)