From patchwork Sat Sep 3 07:06:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9313113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 90F1E60760 for ; Mon, 5 Sep 2016 06:04:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DECD28992 for ; Mon, 5 Sep 2016 06:04:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72B64289B3; Mon, 5 Sep 2016 06:04:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8DB5B28992 for ; Mon, 5 Sep 2016 06:04:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E43616E35D; Mon, 5 Sep 2016 06:04:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.smtpout.orange.fr (smtp12.smtpout.orange.fr [80.12.242.134]) by gabe.freedesktop.org (Postfix) with ESMTPS id E0FF16E013 for ; Sat, 3 Sep 2016 07:06:35 +0000 (UTC) Received: from localhost.localdomain ([92.140.166.52]) by mwinf5d47 with ME id ev6Y1t007189VV003v6Yx2; Sat, 03 Sep 2016 09:06:33 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 03 Sep 2016 09:06:33 +0200 X-ME-IP: 92.140.166.52 From: Christophe JAILLET To: airlied@linux.ie Subject: [PATCH] drm: flip-work: Simplify code Date: Sat, 3 Sep 2016 09:06:30 +0200 Message-Id: <1472886390-29868-1-git-send-email-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.7.4 X-Antivirus: avast! (VPS 160902-5, 03/09/2016), Outbound message X-Antivirus-Status: Clean X-Mailman-Approved-At: Mon, 05 Sep 2016 06:04:02 +0000 Cc: Christophe JAILLET , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Calling 'list_splice_tail' followed by 'INIT_LIST_HEAD' is equivalent to 'list_splice_tail_init'. This has been spotted with the following coccinelle script: ///// @@ expression y,z; @@ - list_splice_tail(y,z); - INIT_LIST_HEAD(y); + list_splice_tail_init(y,z); Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/drm_flip_work.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_flip_work.c b/drivers/gpu/drm/drm_flip_work.c index 12dea16f22a8..c8b54a6694f6 100644 --- a/drivers/gpu/drm/drm_flip_work.c +++ b/drivers/gpu/drm/drm_flip_work.c @@ -101,8 +101,7 @@ void drm_flip_work_commit(struct drm_flip_work *work, unsigned long flags; spin_lock_irqsave(&work->lock, flags); - list_splice_tail(&work->queued, &work->commited); - INIT_LIST_HEAD(&work->queued); + list_splice_tail_init(&work->queued, &work->commited); spin_unlock_irqrestore(&work->lock, flags); queue_work(wq, &work->worker); } @@ -119,8 +118,7 @@ static void flip_worker(struct work_struct *w) INIT_LIST_HEAD(&tasks); spin_lock_irqsave(&work->lock, flags); - list_splice_tail(&work->commited, &tasks); - INIT_LIST_HEAD(&work->commited); + list_splice_tail_init(&work->commited, &tasks); spin_unlock_irqrestore(&work->lock, flags); if (list_empty(&tasks))