Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp387328imn; Fri, 29 Jul 2022 09:52:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uH/D9a9ezPwDv1Uu2+BqWwcjTjLMS9Z8jSdM4SjwEf9Kb1a20LgPwkZ85+eb6WUU2MY/uf X-Received: by 2002:a63:2102:0:b0:41a:8139:2cb3 with SMTP id h2-20020a632102000000b0041a81392cb3mr3681529pgh.314.1659113548531; Fri, 29 Jul 2022 09:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659113548; cv=none; d=google.com; s=arc-20160816; b=Kf4pL9OMtaTlVsXO/rVLNX07WUS26EaaRk+xuusKt1HwWexn2Dyvns6XX4avc12nSh YFDgmpV3adeAkXJsun3vR2zD0GaAjcUIBPyKpWSCy1VBMIjZUhh0F2+hpZUWKfl/zVfJ 5LBKjaI42z9N2MXaDOuRzhuOtH1PmvZcDJPBgEnjV9po1DAiiQBovoIMjnBhyoByTZry D1fP5rHr5/Z+zFrHl54edbRO+BrSIJhb8oF9AuQPsEvxVZRpkQhNJ0SCFwVylf/yw9FW kA/YeibA3eMojcfLTFYRnEJTFBmiepwi5N/n189ixHSwDSRfrkiL1BkNwJnGSprJqq+M Y4Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=Vukv1YK6KFpFeMtPU+pPqM7OIglwqAumIwUtACYHZg8=; b=a16KWYcSnzWYGvV5o/UEipExvgVNzJdu6ge7aTo9dD/qeF7WEtZPt2A64Uexz6ub03 ZO6uCucigBmJPG+v4SjaJvUHp8ELskjber4zCmOzmWPW4ISUIn/IVpuavNuKd/ChsNDg MEJpBTmcK35sSf8kl/yLVt1ezmXeWIS2n8JMDwOMkFfXSKyvBHj0i/fhfzPzKMyr9VOI qDBl5ag30X7aHQl9C2peBgSNfc+L1gC1sMNJ1WsinJi/O1+5QDTueD6swpf90WGb719I YRELzgIxvn7HSWEI7HAjcWYwfl4pC5+Y1iKTbTUHRXYb/rauTrN+c63uw3mMQiPN58QA KznQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=XOfQJnrb; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=yyGdVrMn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020a170902ea0f00b0016c46ef4762si4916002plg.315.2022.07.29.09.52.13; Fri, 29 Jul 2022 09:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=XOfQJnrb; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=yyGdVrMn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238131AbiG2QqS (ORCPT + 99 others); Fri, 29 Jul 2022 12:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238146AbiG2Qpu (ORCPT ); Fri, 29 Jul 2022 12:45:50 -0400 Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A73A88F14 for ; Fri, 29 Jul 2022 09:45:49 -0700 (PDT) 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=20Tr=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 Content-Type: text/plain; charset="utf-8" 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 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); -- b4 0.10.0-dev-49460