From patchwork Mon Jan 18 15:54:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 8055881 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 74E559F440 for ; Mon, 18 Jan 2016 16:10:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A617B204AD for ; Mon, 18 Jan 2016 16:10:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0E6E9203F1 for ; Mon, 18 Jan 2016 16:10:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62C576E5EB; Mon, 18 Jan 2016 08:10:33 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: delayed 919 seconds by postgrey-1.34 at gabe; Mon, 18 Jan 2016 08:10:31 PST Received: from m50-133.163.com (m50-133.163.com [123.125.50.133]) by gabe.freedesktop.org (Postfix) with ESMTP id 249FC6E5EA; Mon, 18 Jan 2016 08:10:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=tQ+971IXm3mzfMmBXS 9Snk31T42fae8E3NS8vTYZMSM=; b=oTI+Asc3wbyhZSlAMJio48DBzDZtE+XhRE /6lHXyYN1WJ6VPzv1Rhij3CHjn9NNNjZXZl6sm9PIT6UE0DYm6aLyA0rLuTfJrxo HiA8OV+bNDiHXEBfsSmFl7F8FJjmXllPCgQJPON6QIu6X61Xa2w9LI+/G4PB+P84 L8G5QllYw= Received: from localhost (unknown [116.77.128.113]) by smtp3 (Coremail) with SMTP id DdGowEAJHUOyCp1Wm08wAA--.6981S3; Mon, 18 Jan 2016 23:54:28 +0800 (CST) From: Geliang Tang To: Daniel Vetter , Jani Nikula , David Airlie Date: Mon, 18 Jan 2016 23:54:20 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: <20160113151255.GH3541@nuc-i3427.alporthouse.com> X-CM-TRANSID: DdGowEAJHUOyCp1Wm08wAA--.6981S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Gr1fZw1UAr4fGF48XrW7CFg_yoWDuFXE9r WkZrnrGw48JrsY9F47Cr9xZFyIyFnYqrs5Ww1Iv3yrAr17Can8ZrZIqryUZrW7WF4rJF1U Ww1kWFZxKrnrGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjsXo7UUUUU== X-Originating-IP: [116.77.128.113] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiGRXzmVXlQosFIAAAs6 Cc: Geliang Tang , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 1/5 v2] drm/i915: use hlist_for_each_entry X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use hlist_for_each_entry() instead of hlist_for_each() to simplify the code. Signed-off-by: Geliang Tang --- Changes in v2: - Keep head = &eb->buckets[handle & eb->and] --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index dccb517..7dc95a7 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -193,13 +193,10 @@ static struct i915_vma *eb_get_vma(struct eb_vmas *eb, unsigned long handle) return eb->lut[handle]; } else { struct hlist_head *head; - struct hlist_node *node; + struct i915_vma *vma; head = &eb->buckets[handle & eb->and]; - hlist_for_each(node, head) { - struct i915_vma *vma; - - vma = hlist_entry(node, struct i915_vma, exec_node); + hlist_for_each_entry(vma, head, exec_node) { if (vma->exec_handle == handle) return vma; }