From patchwork Fri Jul 29 16:34:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12932617 X-Patchwork-Delegate: neil.armstrong@linaro.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 536DBC00144 for ; Fri, 29 Jul 2022 16:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DyPAZUqSe33SZzqNrQoK8eu1jiqCkWu3BBEfC5fkc1s=; b=GkxiWlh8RK8tTM IQYoxeP2AR4cu8R4950rB34VnCMEHl7k+jEuaFqyCxCYbD2cdUWwB8DiZGfzVhYnywVb9Cziod3ph uFGMkkCq9dqfRxCUo/jc6HgTjfhXSG3eLxEsE8s7xHnrD0z6VhkBUx6RVVV3Um+VGXlQhAfHpcLvM j5UD/phQ0N7cUM69r5MTaKyocXAMsLh8ZZZNTNUoustitLrghYrEgl17aWy9uMViHIsnjraM9Qj8j Zx4pgOJw8ILD8P3B55PviD8frKRpWySJsnHNfnDY5qoIhx2gFlDtVIky+sNwXoqZocylBqBj+wlOZ yuZzIxquhhVNk8lCksEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHT1g-006Uar-6e; Fri, 29 Jul 2022 16:39:48 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHSxq-006Rys-H9; Fri, 29 Jul 2022 16:35:52 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id D479858075F; Fri, 29 Jul 2022 12:35:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 29 Jul 2022 12:35:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1659112549; x= 1659119749; bh=Vukv1YK6KFpFeMtPU+pPqM7OIglwqAumIwUtACYHZg8=; b=X OfQJnrbmK4CI59PvH5b1/hLH2Q+RKy53EhMj8XRRW6gDowlzepM6ZLKuSjGufzWp L9sblTBBWyAKfbeXmz6Zh6w52+U22zVCzmQGzDH3GswQLFaHV8IGjYxgcrcIMJIN LXbJgMLplAjj8O97diFI1vpCUQMz60nQemZBQc7xxSaaMu32l59zO/SfHm4dkT21 6rp7Ui5RBcQ9ZQ9hu8X3tnoKtc7lk78GEgflGTOmQTRAAB/7l5IN9pjHq83aDDbQ hoYOFzD8dAy6yzWy5G0N619ti4ZBO4z4lJkIGqa/+ErfnPSRlQHpFYMNgf9rUB8W iPyydpv69nrgVJkkswB9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1659112549; x= 1659119749; bh=Vukv1YK6KFpFeMtPU+pPqM7OIglwqAumIwUtACYHZg8=; b=y yGdVrMndN2GDHe5hUwKEWAjUKorz7JejanyGgNntt16a6aMpjYJTp94GLkff+s/g 2UqmpWGn4Vzogr1ccbW2qKm9/PGvZNYTOTeJfgz2czRalaCE7sG05bOhHrqyptWS FweumVeHzlH6DtU/lrl6EDHmTsriCtFfBxDt5VD+8KvPwScCE5qY3v2jABGoFgdP yzY+WOnSmAf/CBfT4hQR3TD9FOD8GQ7Mz0x/Jkmq56NUAEF67xperhMMRK5aigrd C5DiK00rTGtUCb4mU80V7RB8vSdX73hQ97InCVj2XzhA4gdV/0WmMlOiGbcVGzQb Tcb/bJ8NpPk85+TinEWAg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddujedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfgggtoffgsehtkeertdertdejnecuhfhrohhmpefo rgigihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecugg ftrfgrthhtvghrnhepgfffgfetffduudelhfevieffffduleevgfegkeeutefgffejheel leekjeefhfejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Jul 2022 12:35:48 -0400 (EDT) From: Maxime Ripard To: Jernej Skrabec , Martin Blumenstingl , Chen-Yu Tsai , Philipp Zabel , Jerome Brunet , Samuel Holland , Thomas Zimmermann , Daniel Vetter , Emma Anholt , David Airlie , Maarten Lankhorst , =?utf-8?q?Noralf_Tr?= =?utf-8?q?=C3=B8nnes?= , Kevin Hilman , Neil Armstrong , Maxime Ripard Cc: Maxime Ripard , linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Phil Elwell , Mateusz Kwiatkowski , linux-arm-kernel@lists.infradead.org, Geert Uytterhoeven , Dave Stevenson , linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, Dom Cobley Subject: [PATCH v1 06/35] drm/connector: Only register TV mode property if present Date: Fri, 29 Jul 2022 18:34:49 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v1-6-3d53ae722097@cerno.tech> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> References: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> MIME-Version: 1.0 X-Mailer: b4 0.10.0-dev-49460 X-Developer-Signature: v=1; a=openpgp-sha256; l=1716; i=maxime@cerno.tech; h=from:subject:message-id; bh=r0YGPY/lR3DbpNDfMeJZNI+IjZaGoFc9GNv9eKuIsNA=; b=owGbwMvMwCHc4XzqmfnC7acZT6slMSQ94VHq+DhJr3FT9FW/hPvh5RJJm696M5x7WdSZZ13l9FZf q2ZSRykLgzAHg6yYIst1wbd2fGFRbhE8HzbDzGFlAhnCwMUpABMpfMXIsOmnq2Sb1fa8oKOvuJa9e1 S24xdXs84euxsa63YwGL/Iv8zwP/UvX4tdlV+k8tSlv5iPKU2auWZqjnspq5D4mktS1j9C+gA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_093550_701216_DC23F31C X-CRM114-Status: UNSURE ( 8.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The drm_create_tv_properties() will create the TV mode property unconditionally. However, since we'll gradually phase it out, let's register it only if we have a list passed as an argument. This will make the transition easier. Signed-off-by: Maxime Ripard Acked-by: Noralf Trønnes diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 68a4e47f85a9..d73a68764b6e 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1684,7 +1684,6 @@ int drm_mode_create_tv_properties(struct drm_device *dev, struct drm_property *tv_selector; struct drm_property *tv_subconnector; struct drm_property *tv_norm; - unsigned int i; if (dev->mode_config.tv_select_subconnector_property) return 0; @@ -1723,15 +1722,19 @@ int drm_mode_create_tv_properties(struct drm_device *dev, goto nomem; dev->mode_config.tv_norm_property = tv_norm; - dev->mode_config.tv_mode_property = - drm_property_create(dev, DRM_MODE_PROP_ENUM, - "mode", num_modes); - if (!dev->mode_config.tv_mode_property) - goto nomem; + if (num_modes) { + unsigned int i; - for (i = 0; i < num_modes; i++) - drm_property_add_enum(dev->mode_config.tv_mode_property, - i, modes[i]); + dev->mode_config.tv_mode_property = + drm_property_create(dev, DRM_MODE_PROP_ENUM, + "mode", num_modes); + if (!dev->mode_config.tv_mode_property) + goto nomem; + + for (i = 0; i < num_modes; i++) + drm_property_add_enum(dev->mode_config.tv_mode_property, + i, modes[i]); + } dev->mode_config.tv_brightness_property = drm_property_create_range(dev, 0, "brightness", 0, 100);