From patchwork Mon Dec 12 11:53:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9470529 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 DCEDC60760 for ; Mon, 12 Dec 2016 11:54:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1BFC283C2 for ; Mon, 12 Dec 2016 11:54:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C340F2846A; Mon, 12 Dec 2016 11:54:24 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 DAF7A28472 for ; Mon, 12 Dec 2016 11:54:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9A776E2C7; Mon, 12 Dec 2016 11:54:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9C8F6E2C7; Mon, 12 Dec 2016 11:53:59 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id a20so10756490wme.2; Mon, 12 Dec 2016 03:53:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=rx6siDufB6fVvEbewVAC299CqlmyJkTnaRa9pa9R2+E=; b=Lq11bYgodUhWgvCcCnP3mjq5dF1djYXTiDcoKp2LsZ/JirC4UsGQkrmOZix7AQzlAE vJp562Nl/6bUSfpAG7XVRBWCP0ejVUekN1KkahFzNVeTtaBRFBE28+MveNIBF4QRUt29 yBncR/f0wRnm4n17cJQxqdLR22njWujWph+oKlNXl0cff0YrAN0WafVlTpE7JXZcrEy2 abHH22LMMRicu7/zhrQzcBwVClbcG9mZtpKhPKYt4vO5ZP7gP7bTt3GtgL9gesNiuZ/M oPLUu83CspYZjhW4ExabaB1fa+dzjwKN3B1TUg99m7fzkzvPI7gIIS7KwRvDmXv+dF+9 4okQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=rx6siDufB6fVvEbewVAC299CqlmyJkTnaRa9pa9R2+E=; b=I8aN4ZgZhnUDaUIeyQBuTWYvQaksu9Ywye9dXtef4Bl12W32hrFp1O572PxGpnIJ6u Yon73N2a7c2Bg17MAZVN3ix2zkDzAFaLRlraAAsqh/VDNxRjvIoWaC7v0e6h/eYUvndE Pf1HaPArgxlg3cIM1ahf4Oy+R4f2MeWPKHSehPyJ+ZLCB/UH+8SC2Tu1+qMCmlTMeTaj rdqjmtNK3PM6OI7wSNNWSYdz6FmNG6gSKfio1FKMlbshp+58+KqytWnTrA/Ch74J2hpf We8IibhUYdw5/UzOcL1kaovFU6IWN8IgmfVoBwTJPJ+oe1sVthR+zK8awf952bFzjW+Z Vo9Q== X-Gm-Message-State: AKaTC00d22RXcuItZVxfhtkh6bqu7giHlK3IwBcyBGmmGFodvC1BhSQ/Axkxonk/9hiigQ== X-Received: by 10.28.209.7 with SMTP id i7mr9636855wmg.62.1481543637921; Mon, 12 Dec 2016 03:53:57 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id u81sm35077381wmu.10.2016.12.12.03.53.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 03:53:57 -0800 (PST) From: Chris Wilson To: dri-devel@lists.freedesktop.org Subject: [PATCH 02/34] drm/i915: Simplify i915_gtt_color_adjust() Date: Mon, 12 Dec 2016 11:53:18 +0000 Message-Id: <20161212115350.780-3-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161212115350.780-1-chris@chris-wilson.co.uk> References: <20161212115350.780-1-chris@chris-wilson.co.uk> Cc: intel-gfx@lists.freedesktop.org, joonas.lahtinen@linux.intel.com 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 If we remember that node_list is a circular list containing the fake head_node, we can use a simple list_next_entry() and skip the NULL check for the allocated check against the head_node. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_gem_gtt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index ef00d36680c9..b5d4a6357d8a 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -2723,10 +2723,8 @@ static void i915_gtt_color_adjust(struct drm_mm_node *node, if (node->color != color) *start += 4096; - node = list_first_entry_or_null(&node->node_list, - struct drm_mm_node, - node_list); - if (node && node->allocated && node->color != color) + node = list_next_entry(node, node_list); + if (node->allocated && node->color != color) *end -= 4096; }