From patchwork Fri Mar 13 20:17:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11437785 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 CA89C1667 for ; Fri, 13 Mar 2020 20:19:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A663F2074B for ; Fri, 13 Mar 2020 20:19:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fqkX4R4V"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bicRCsTB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A663F2074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org 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=bombadil.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=/nKFUHhKhYBMepjcXHgjIuxD6w6QT7ec3XDCBrW22+Y=; b=fqkX4R4V9gJFw0 I5biBXS5vXmiltx3/WkiM4GZXeIiAlDYGa+raSCsKzFqIQH0vtrZOxbmoQ2y6K58wQMXK+lb8kj12 iAcoWOkV0F0UahfIpcycO+LnzlBzP7ycZ5yt0xq+RMXvZ5sWKwAdBmEtRHD/Iq3deFYmuTHolpddT 537iS5dGdk54CIu6IWyb4XEL+Wa80ErAlB7FOHFD+q5UYPKmKukzhEAu/tDwz5cYF5VikSzKWt++I nav6LC9JLpuqAnJzzGIMqv0aSqwGxEfceqaRHt78Pb7Y/Mlx52M03YGPvek6ttwt0A4boG+zmNe9Z any02StTouzwRViYnn0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCqlu-0001sy-Vx; Fri, 13 Mar 2020 20:19:07 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCqkt-0000uf-4g; Fri, 13 Mar 2020 20:18:05 +0000 Received: by mail-lf1-x142.google.com with SMTP id j11so8932508lfg.4; Fri, 13 Mar 2020 13:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BMotWAaAKwK3bHlZU4Nk/m5RAzk+ipGY0zwtvW/8Zts=; b=bicRCsTBUB8tfIHsGH2fiIPISDECvEwg2qpOocZbR6Q5Hu5nLZnxheMlNJjdFMj1vA FetnDYppdslEVeBKEPmwr8WrMhD61IJGWaIa/oOknKOO7ZOiVDeCrZAEt1rRlIeATOeQ lQUeg31d/qtLTQvZKVS8oVOgByqbjXAdbpVHUhMzaGLlHiCZgZxTu02M3BybD/yPSiCs ahnW70Fy4ZRggNSbvuqsYgGHX+zKz6Rf+am9rpyti9ywgjGu7/JU9lBZnBOAC291pAUi D4CS36tpf80ypwbFsaPf5LjIFxXf+7TRNNu+TyrfZhI56yAJSSBqb1LXqZR/fYFBO+Fx VZjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BMotWAaAKwK3bHlZU4Nk/m5RAzk+ipGY0zwtvW/8Zts=; b=sjMMn9ubgb999k00F3MaaWfuIhhy/uGuOo9mBvjj9Tw81+WEGYCkVBFhbOnDNCKYv+ eOzh23DyAgwicxnGWSObLkJTHzghfAFIPJOyrhk7xjUagCxR69S/dvW/eLX3T6HEkRaV V6GfGmZakejq4DymtxPUmg+SQK2/xPFX1ATmO7N4tZ39BFrZDz2yicyAUgdz2N/f2k8K 7FCY2giWR84uPoyMJqIjP4rAL2mi/5su0DP+b6KGzuNQQfRllxkCs5AYjnoxchcGrLQV hktkfRjj4tWINpjC68O+UQfKNUk2dxN5DmnDx9rvKj2iMUIkelG8SavpJDAP8kujwSft 9Mbg== X-Gm-Message-State: ANhLgQ1L6Qn6QL9B23Hm0KwvgM1oHlGmooxLj0yyFfIOo4NaAGBXHIbq KpD2+HzzZTihFvSLglVs4FI= X-Google-Smtp-Source: ADFU+vs08U2ulmgppOicKEegEgw20vyZjY26u9u2fNJnhJY6xWGz9lseT5UGyNTnkxc+BLfBZ40pHA== X-Received: by 2002:ac2:4145:: with SMTP id c5mr9320676lfi.19.1584130680533; Fri, 13 Mar 2020 13:18:00 -0700 (PDT) Received: from saturn.lan (18.158-248-194.customer.lyse.net. [158.248.194.18]) by smtp.gmail.com with ESMTPSA id v10sm30774074lfb.61.2020.03.13.13.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2020 13:18:00 -0700 (PDT) From: Sam Ravnborg To: Thomas Zimmermann , Daniel Vetter , Laurent Pinchart , dri-devel@lists.freedesktop.org Subject: [PATCH v1 2/3] drm: drm_simple_encoder_init() => drm_encoder_init() Date: Fri, 13 Mar 2020 21:17:43 +0100 Message-Id: <20200313201744.19773-3-sam@ravnborg.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200313201744.19773-1-sam@ravnborg.org> References: <20200313201744.19773-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200313_131803_208875_F46392BF X-CRM114-Status: GOOD ( 16.37 ) X-Spam-Score: 0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.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:142 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [sam.ravnborg[at]gmail.com] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 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: Alexandre Belloni , David Airlie , Jose Roberto de Souza , virtualization@lists.linux-foundation.org, Gerd Hoffmann , Sam Ravnborg , linux-stm32@st-md-mailman.stormreply.com, Emil Velikov , linux-samsung-soc@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Ludovic Desroches , NXP Linux Team , Dave Airlie , Maarten Lankhorst , Maxime Ripard , linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Boris Brezillon , Andrzej Pietrasiewicz , linux-renesas-soc@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org A lot of drivers requires only a basic encoder with no need to extend the functionality. This was previously implemented in drm_simple_kms_helper.c but encoders are not necessarily simple despite no need for a drm_encoder_funcs for adding functionality. Move the init function to drm_encoder.c to reflect this. And adjust the name to drm_encoder_init(). Drop include of drm_simple_kms_helper.h in the touched drivers as it is no logner required. Signed-off-by: Sam Ravnborg Cc: Dave Airlie Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: Laurent Pinchart Cc: David Airlie Cc: Daniel Vetter Cc: Gerd Hoffmann Cc: Sam Ravnborg Cc: Emil Velikov Cc: Andrzej Pietrasiewicz Cc: "José Roberto de Souza" --- drivers/gpu/drm/ast/ast_mode.c | 3 +- drivers/gpu/drm/drm_encoder.c | 37 ++++++++++++++++++++ drivers/gpu/drm/drm_simple_kms_helper.c | 45 +------------------------ drivers/gpu/drm/mgag200/mgag200_mode.c | 7 ++-- drivers/gpu/drm/qxl/qxl_display.c | 7 ++-- include/drm/drm_encoder.h | 3 ++ include/drm/drm_simple_kms_helper.h | 4 --- 7 files changed, 46 insertions(+), 60 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index cdd6c46d6557..4f6ace1afaf0 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -40,7 +40,6 @@ #include #include #include -#include #include "ast_drv.h" #include "ast_tables.h" @@ -964,7 +963,7 @@ static int ast_encoder_init(struct drm_device *dev) struct drm_encoder *encoder = &ast->encoder; int ret; - ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC); + ret = drm_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC); if (ret) return ret; diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index a76a5f04ab39..e1e90652094c 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -152,6 +152,43 @@ int drm_encoder_init_funcs(struct drm_device *dev, } EXPORT_SYMBOL(drm_encoder_init_funcs); +static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = { + .destroy = drm_encoder_cleanup, +}; + +/** + * drm_simple_init - Initialize a preallocated encoder with basic functionality. + * @dev: drm device + * @encoder: the encoder to initialize + * @encoder_type: user visible type of the encoder + * + * Initialises a preallocated encoder that has no further functionality. + * Settings for possible CRTC and clones are left to their initial values. + * The encoder will be cleaned up automatically as part of the mode-setting + * cleanup. + * + * The caller of drm_encoder_init() is responsible for freeing + * the encoder's memory after the encoder has been cleaned up. At the + * moment this only works reliably if the encoder data structure is + * stored in the device structure. Free the encoder's memory as part of + * the device release function. + * + * FIXME: Later improvements to DRM's resource management may allow for + * an automated kfree() of the encoder's memory. + * + * Returns: + * Zero on success, error code on failure. + */ +int drm_simple_init(struct drm_device *dev, + struct drm_encoder *encoder, + int encoder_type) +{ + return drm_encoder_init_funcs(dev, encoder, + &drm_simple_encoder_funcs_cleanup, + encoder_type, NULL); +} +EXPORT_SYMBOL(drm_encoder_init); + /** * drm_encoder_cleanup - cleans up an initialised encoder * @encoder: encoder to cleanup diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 24d4433c347b..d70170980839 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -26,51 +26,8 @@ * entity. Some flexibility for code reuse is provided through a separately * allocated &drm_connector object and supporting optional &drm_bridge * encoder drivers. - * - * Many drivers require only a very simple encoder that fulfills the minimum - * requirements of the display pipeline and does not add additional - * functionality. The function drm_simple_encoder_init() provides an - * implementation of such an encoder. */ -static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = { - .destroy = drm_encoder_cleanup, -}; - -/** - * drm_simple_encoder_init - Initialize a preallocated encoder with - * basic functionality. - * @dev: drm device - * @encoder: the encoder to initialize - * @encoder_type: user visible type of the encoder - * - * Initialises a preallocated encoder that has no further functionality. - * Settings for possible CRTC and clones are left to their initial values. - * The encoder will be cleaned up automatically as part of the mode-setting - * cleanup. - * - * The caller of drm_simple_encoder_init() is responsible for freeing - * the encoder's memory after the encoder has been cleaned up. At the - * moment this only works reliably if the encoder data structure is - * stored in the device structure. Free the encoder's memory as part of - * the device release function. - * - * FIXME: Later improvements to DRM's resource management may allow for - * an automated kfree() of the encoder's memory. - * - * Returns: - * Zero on success, error code on failure. - */ -int drm_simple_encoder_init(struct drm_device *dev, - struct drm_encoder *encoder, - int encoder_type) -{ - return drm_encoder_init_funcs(dev, encoder, - &drm_simple_encoder_funcs_cleanup, - encoder_type, NULL); -} -EXPORT_SYMBOL(drm_simple_encoder_init); - static enum drm_mode_status drm_simple_kms_crtc_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *mode) @@ -327,7 +284,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev, return ret; encoder->possible_crtcs = drm_crtc_mask(crtc); - ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_NONE); + ret = drm_encoder_init(dev, encoder, DRM_MODE_ENCODER_NONE); if (ret || !connector) return ret; diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index d90e83959fca..9de654b2dffd 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -15,7 +15,6 @@ #include #include #include -#include #include "mgag200_drv.h" @@ -1630,12 +1629,10 @@ int mgag200_modeset_init(struct mga_device *mdev) mga_crtc_init(mdev); - ret = drm_simple_encoder_init(mdev->dev, encoder, - DRM_MODE_ENCODER_DAC); + ret = drm_encoder_init(mdev->dev, encoder, DRM_MODE_ENCODER_DAC); if (ret) { drm_err(mdev->dev, - "drm_simple_encoder_init() failed, error %d\n", - ret); + "drm_encoder_init() failed, error %d\n", ret); return ret; } encoder->possible_crtcs = 0x1; diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 09583a08e141..43fb05df950c 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "qxl_drv.h" #include "qxl_object.h" @@ -1088,11 +1087,9 @@ static int qdev_output_init(struct drm_device *dev, int num_output) drm_connector_init(dev, &qxl_output->base, &qxl_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL); - ret = drm_simple_encoder_init(dev, &qxl_output->enc, - DRM_MODE_ENCODER_VIRTUAL); + ret = drm_encoder_init(dev, &qxl_output->enc, DRM_MODE_ENCODER_VIRTUAL); if (ret) { - drm_err(dev, "drm_simple_encoder_init() failed, error %d\n", - ret); + drm_err(dev, "drm_encoder_init() failed, error %d\n", ret); goto err_drm_connector_cleanup; } diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index 378ab1778be3..8298b696dca8 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -191,6 +191,9 @@ int drm_encoder_init_funcs(struct drm_device *dev, const struct drm_encoder_funcs *funcs, int encoder_type, const char *name, ...); +int drm_encoder_init(struct drm_device *dev, + struct drm_encoder *encoder, + int encoder_type); /** * drm_encoder_index - find the index of a registered encoder * @encoder: encoder to find index for diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h index a026375464ff..e253ba7bea9d 100644 --- a/include/drm/drm_simple_kms_helper.h +++ b/include/drm/drm_simple_kms_helper.h @@ -181,8 +181,4 @@ int drm_simple_display_pipe_init(struct drm_device *dev, const uint64_t *format_modifiers, struct drm_connector *connector); -int drm_simple_encoder_init(struct drm_device *dev, - struct drm_encoder *encoder, - int encoder_type); - #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */