Re: [PATCH] HID: intel_ish-hid: use list_move_tail in ishtp_cl_read_start
From: Srinivas Pandruvada
Date: Fri Nov 11 2016 - 17:51:41 EST
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@xxxxxxxxx>
> ---
> Â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;