From patchwork Fri Sep 4 14:39:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11757591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A5CA138E for ; Fri, 4 Sep 2020 14:41:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0365B206F2 for ; Fri, 4 Sep 2020 14:41:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Df3nCVKE"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="OOfQuuEj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0365B206F2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FV4fMNMQXcQwwIJ1I5E9MbdjN0VfI/BkRw1VrVLKtGw=; b=Df3nCVKEC9uIZq9lR8EeyiPLR DNFEdpsn8zIdE4sqFx9xDbAOzs10jXZxsJVsnlGrRSHDzWJh/1yvwCfx6ILME4LyPYQ3tSb7Eb2VM g3liNhHoySLb6SFmMumXQD9AxxwZLllyQlnXn/fISiy46UCc1YZsuFsLPX6XEZ1kj41Egob4CQzoR +oFdV5XArnUybHYdnWz8rwBmNe9bgj0oTfJD4v8PoLpGvL7FHqz7zduvCk4luhDo89bkAjZFdQh8o wURRWYr3JRUDPmKoOSXT3v+TwG4DQyytpCnyVnQj3rVSUUK0s6gpe41X3k5la4HtOAkLsGvddLYhW gMPts3Guw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kECsg-0005kS-UT; Fri, 04 Sep 2020 14:39:59 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kECse-0005jE-Dh for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2020 14:39:57 +0000 Received: by mail-wm1-x342.google.com with SMTP id w2so6315357wmi.1 for ; Fri, 04 Sep 2020 07:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jVoidh4eK5SMWwvVdGvcbPkxD3QsnFfymSXNjak7xmE=; b=OOfQuuEjKv7K7JE/iEfPadM7YeVbvi5x5/nRiuZ6Tiu4JjvAjZGDTsrz58t4W/Q186 sia+cMjtDK6YHVoR3S9fGguTewDkrDaHcwW/icau3G6FNw5SWLBqlNWPg0qLRt7QOOCF J3VwzJUi2cBNzOJF6tXyipqqGGXF3Xs0YBwA8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jVoidh4eK5SMWwvVdGvcbPkxD3QsnFfymSXNjak7xmE=; b=avyWpzyR58MNI+kt4TajN+huv3FxpBVT3sFRcCZELFKf7r1HllxvjSxB75AsWg8JyU 1lhJEHqTs7irC+/fzCu8k+wFkkEA1JX/dN/WqaKv0Xt5n/BrlCUkzxwhpzlmECKuAdag AynAFyQMJFgqoMVqAO+DpLr300GKCrGUq+Gpr/X07wepydPl5lC8R292SIFsMQD8HUcy vvODzv3Z6kCzT3Za6e/ik45/ID4BOLy+MpDpNFCNgAet8p39Z1N9ja323fMeMB/1NrPL s56thmh0xijbHCeTakvwj3uvOAFACiFNDB7FjiZHTp7hDDUfjNGLG651rCBEgcC69ZoX o5aw== X-Gm-Message-State: AOAM532IsQBWlqqnHssbqHF2juEtxoRZ888yzDUPmqMUOhusMWwbPYrH LLxzbrsaYW89lf8vleDSYQ7/ng== X-Google-Smtp-Source: ABdhPJwXq6NOrlxpVN3brn1Ux/H7QK48bMhmZeY6MRyKCSG1l5Ra/JAtR0LL2xfsumSS1k1GSsxlxg== X-Received: by 2002:a1c:2d95:: with SMTP id t143mr7665997wmt.44.1599230393790; Fri, 04 Sep 2020 07:39:53 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id z15sm11597949wrv.94.2020.09.04.07.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 07:39:53 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 03/24] drm/aspeed: Use managed drmm_mode_config_cleanup Date: Fri, 4 Sep 2020 16:39:20 +0200 Message-Id: <20200904143941.110665-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200904143941.110665-1-daniel.vetter@ffwll.ch> References: <20200904143941.110665-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200904_103956_474256_81B7AE42 X-CRM114-Status: GOOD ( 15.67 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aspeed@lists.ozlabs.org, Andrew Jeffery , Daniel Vetter , Intel Graphics Development , Joel Stanley , Daniel Vetter , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Since aspeed doesn't use devm_kzalloc anymore we can use the managed mode config cleanup. v2: Keep call order as suggested by Sam. Acked-by: Sam Ravnborg Signed-off-by: Daniel Vetter Cc: Joel Stanley Cc: Andrew Jeffery Cc: linux-aspeed@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c index 903f4f304647..2b424b2b85cc 100644 --- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c @@ -63,15 +63,21 @@ static const struct drm_mode_config_funcs aspeed_gfx_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; -static void aspeed_gfx_setup_mode_config(struct drm_device *drm) +static int aspeed_gfx_setup_mode_config(struct drm_device *drm) { - drm_mode_config_init(drm); + int ret; + + ret = drmm_mode_config_init(drm); + if (ret) + return ret; drm->mode_config.min_width = 0; drm->mode_config.min_height = 0; drm->mode_config.max_width = 800; drm->mode_config.max_height = 600; drm->mode_config.funcs = &aspeed_gfx_mode_config_funcs; + + return ret; } static irqreturn_t aspeed_gfx_irq_handler(int irq, void *data) @@ -144,7 +150,9 @@ static int aspeed_gfx_load(struct drm_device *drm) writel(0, priv->base + CRT_CTRL1); writel(0, priv->base + CRT_CTRL2); - aspeed_gfx_setup_mode_config(drm); + ret = aspeed_gfx_setup_mode_config(drm); + if (ret < 0) + return ret; ret = drm_vblank_init(drm, 1); if (ret < 0) { @@ -179,7 +187,6 @@ static int aspeed_gfx_load(struct drm_device *drm) static void aspeed_gfx_unload(struct drm_device *drm) { drm_kms_helper_poll_fini(drm); - drm_mode_config_cleanup(drm); } DEFINE_DRM_GEM_CMA_FOPS(fops);