From patchwork Fri Mar 1 12:56:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 10835295 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCE1E1575 for ; Fri, 1 Mar 2019 13:03:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC7AA2F86D for ; Fri, 1 Mar 2019 13:03:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B02922F9CF; Fri, 1 Mar 2019 13:03:18 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 627C02F86D for ; Fri, 1 Mar 2019 13:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387439AbfCANDR (ORCPT ); Fri, 1 Mar 2019 08:03:17 -0500 Received: from mblankhorst.nl ([141.105.120.124]:42966 "EHLO mblankhorst.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732687AbfCANDR (ORCPT ); Fri, 1 Mar 2019 08:03:17 -0500 From: Maarten Lankhorst To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, Maarten Lankhorst , Laurent Pinchart , Kieran Bingham , linux-renesas-soc@vger.kernel.org Subject: [PATCH 12/17] drm/rcar-du: Convert to using __drm_atomic_helper_crtc_reset() for reset. Date: Fri, 1 Mar 2019 13:56:22 +0100 Message-Id: <20190301125627.7285-13-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190301125627.7285-1-maarten.lankhorst@linux.intel.com> References: <20190301125627.7285-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert rcar-du to using __drm_atomic_helper_crtc_reset(), instead of writing its own version. Instead of open coding destroy_state(), call it directly for freeing the old state. Signed-off-by: Maarten Lankhorst Cc: Laurent Pinchart Cc: Kieran Bingham Cc: linux-renesas-soc@vger.kernel.org --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 4cdea14d552f..7766551e67fc 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -891,22 +891,17 @@ static void rcar_du_crtc_cleanup(struct drm_crtc *crtc) static void rcar_du_crtc_reset(struct drm_crtc *crtc) { - struct rcar_du_crtc_state *state; + struct rcar_du_crtc_state *state = kzalloc(sizeof(*state), GFP_KERNEL); - if (crtc->state) { + if (crtc->state) rcar_du_crtc_atomic_destroy_state(crtc, crtc->state); - crtc->state = NULL; - } - state = kzalloc(sizeof(*state), GFP_KERNEL); + __drm_atomic_helper_crtc_reset(crtc, &state->state); if (state == NULL) return; state->crc.source = VSP1_DU_CRC_NONE; state->crc.index = 0; - - crtc->state = &state->state; - crtc->state->crtc = crtc; } static int rcar_du_crtc_enable_vblank(struct drm_crtc *crtc)