From patchwork Wed Nov 2 14:07:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9409233 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 D38126022E for ; Wed, 2 Nov 2016 14:08:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5FAF2A144 for ; Wed, 2 Nov 2016 14:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAB062A1E9; Wed, 2 Nov 2016 14:08:01 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,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 C8C082A144 for ; Wed, 2 Nov 2016 14:08:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC2296E551; Wed, 2 Nov 2016 14:07:59 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9386A6E551 for ; Wed, 2 Nov 2016 14:07:58 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id u144so3258526wmu.0 for ; Wed, 02 Nov 2016 07:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=D6GqqpPQ4y4q5+dqvPPkLCiQ8d4/AfmbYDKW6G1Rq3A=; b=WaOYTZuPyLEFj/ViIfC+cbmIr14rJgpssRGgqLa5PsUSG3M8D98d3p3hnm9OxWELFk oMFTVaPp2gnn1FgNvyRboWncyAN84kSxlc5+W0UtSIZ0Br4L25WEIsbzPmujvS8JarpW 2aNDDxZNl+1dtpgyj5Yb7T8f9QFJCixhb8Mw+nuPyKIXgLXXxj9pvoGK2bUp10CHrBpT OjIBX07GbR7OdAF0iMfacBWJ7VvfF+cN7l5Kqm24x0htjA/VmCdpK14TReXe3Ehaa2oW vBPugheItURfHw37ETFZBe8sOPvhgfKIsVxe6b4OIffwN0qO8XOEtkf+Ib4wdO/RDSQS 26SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=D6GqqpPQ4y4q5+dqvPPkLCiQ8d4/AfmbYDKW6G1Rq3A=; b=hdkKVIe4ntzRn30Grjz+ou2nxhlLrfGMvwbHAFNapHCwpCN8yLuQzWLn9Adqx1LKNT Wu8ic6y2bPzg39uh6y4iTnz3qCV8+Ii3hBPpCjqmUzD9f0XznzDNf0y3QwgKj6oxYDx1 FPumhr7iVDMUG2UBQ5DGPngKSfgx1q/qQoJg7rqnNYyQxPHSBkrvk3J6uxCi0LDD6UBM w7+Z3U02LRi1dx0TUx3WjH6sV0pkkVOIuUZ6BTK9avrZ5mfbeY9KAZ4QaMvr4UTjX/6h JVwRqmuaRDHtv9W4PZe7T0wnNZR7xpBZIWXu327bC6WL9lZKfFcOkKFQJvHa/1TTSqhB VB1A== X-Gm-Message-State: ABUngveg8roadWAbjifXhQAV71XMe2YDl2EWclsJH4Zx/UNyxy/itPu701fZC1ZaSEC/GA== X-Received: by 10.28.227.9 with SMTP id a9mr3030963wmh.85.1478095677166; Wed, 02 Nov 2016 07:07:57 -0700 (PDT) Received: from t460p.intel ([2a02:c7d:9bd6:b000:f37e:1e07:a7d8:46cd]) by smtp.gmail.com with ESMTPSA id l19sm3471480wmg.5.2016.11.02.07.07.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Nov 2016 07:07:56 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 2 Nov 2016 14:07:48 +0000 Message-Id: <1478095668-11404-1-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.7.4 Subject: [Intel-gfx] [PATCH] drm/i915: Tidy slab cache allocations 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-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin We can use the preferred KMEM_CACHE helper for brevity. Also simplifiy error unwind by only setting the ENOMEM error code once. Signed-off-by: Tvrtko Ursulin Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_gem.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 5839bebba64a..a6da5b55764a 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4716,33 +4716,22 @@ i915_gem_load_init(struct drm_device *dev) struct drm_i915_private *dev_priv = to_i915(dev); int err; - dev_priv->objects = - kmem_cache_create("i915_gem_object", - sizeof(struct drm_i915_gem_object), 0, - SLAB_HWCACHE_ALIGN, - NULL); + dev_priv->objects = KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN); if (!dev_priv->objects) { err = -ENOMEM; goto err_out; } - dev_priv->vmas = - kmem_cache_create("i915_gem_vma", - sizeof(struct i915_vma), 0, - SLAB_HWCACHE_ALIGN, - NULL); + dev_priv->vmas = KMEM_CACHE(i915_vma, SLAB_HWCACHE_ALIGN); if (!dev_priv->vmas) { err = -ENOMEM; goto err_objects; } - dev_priv->requests = - kmem_cache_create("i915_gem_request", - sizeof(struct drm_i915_gem_request), 0, - SLAB_HWCACHE_ALIGN | - SLAB_RECLAIM_ACCOUNT | - SLAB_DESTROY_BY_RCU, - NULL); + dev_priv->requests = KMEM_CACHE(drm_i915_gem_request, + SLAB_HWCACHE_ALIGN | + SLAB_RECLAIM_ACCOUNT | + SLAB_DESTROY_BY_RCU); if (!dev_priv->requests) { err = -ENOMEM; goto err_vmas;